Konijima / Fuel-API

Mod for Project Zomboid, add custom fuel container item to your mods.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible mistake in container capacity operations (Utils.GetProperLitres)

Tread4 opened this issue · comments

I am uncertain of why you used "0.125" in line 48 of Utils.lua

local diff = customCapacity / (1 / 0.125);

from my tests it seems that it results in very strange values "taken" from the fuel tanks for any custom container. Possibly you had a reason that I am missing, nonetheless I found that value of 0.1 (1/10 as regular jerrycan stores 10 units of petrol) works much better for my use case (values taken from fuel tanks matched exactly the container capacity).

Confirmation of what I am saying can be found in Vehicles.lua from TIS. Probably some time ago they used value of 8 for JerryCanLitres. Now it is at 10:
Vehicles.JerryCanLitres = 10

In my game your code resulted in siphoning taking more petrol units from Gas Tank then container capacity suggested. Since same coefficient was used for tanking no real harm was done.

Only problem is unlogical behaviour of taking 12,5 L from gas tank into 10L Jerry Can. Pouring back such full, 10L Jerry Can results in tanking gas tank by 12,5L. Woring but probably not as intended.

Fuel API changed and doesn't overwrite those actions anymore.