Schall Oil Fuel


Allows various oil barrels to be used as fuel, to vehicles and machines. Fuel settings are balanced towards vanilla fuel. (Locale: English, Deutsch, 正體中文, Português Brasileiro)

Tweaks
2 years ago
0.17 - 1.1
4.85K
Fluids

i Legacy-proofing and idiot-proofing of undefined fuel category type.

1 year, 2 months ago

Since fuel category of an entity defaults to "chemical" if it is a burner, we can read it while data updating. Additional check could be made to exclude entities without fuel inventories (to both narrow list of entities and avoid crashes due to nil values). This modified code should include burner vehicles without defined fuel_category. It might turn some positives if an entity is defined as multifuel one (using fuel_categories table), but I don't think that it would be a problem.

local burner = v2.burner or v2.energy_source
if burner and (burner.fuel_category == "chemical" or not burner.fuel_category) then
if burner.fuel_inventory_size then
burner.burnt_inventory_size = burner.fuel_inventory_size
OFlib.debuglog(" " .. v2.name .. " (" .. burner.burnt_inventory_size .. ")")
end
end

New response