consider this fluid wagon:
the debugger shows that get_fluid_contents correctly returns the amount (9520 petroleum-gas) but the fluid box contains no fluids:
[2.0.17] fluid wagon has contents but the fluidbox is empty
Re: [2.0.17] fluid wagon has contents but the fluidbox is empty
Thanks for the report however this is not a bug. Fluid wagon is not storing its fluid inside of a fluidbox (which could have a connections in and out, ground or underground). For the same reason FluidTurret (flamethrower) may expose part of the fluid related to the FluidBox but it will not expose the internal fluid buffer through FluidBoxes API. For those cases a LuaEntity::fluids_count read, get_fluid() and set_fluid() should allow you to change them.
It is like comparing inventories to item stacks: most of the item stacks are part of inventories, but inserters have item stack that is not part of an inventory.
It is like comparing inventories to item stacks: most of the item stacks are part of inventories, but inserters have item stack that is not part of an inventory.
Re: [2.0.17] fluid wagon has contents but the fluidbox is empty
Thanks for the quick answer. This seems to be a change from the 1.1 API. I am looking at the code for the Inventory Sensor (https://github.com/0ptera/Inventory-Sen ... 2C1-L409C1) that used to work and it uses the fluidbox field to retrieve the values.
In the documentation for get_fluid_contents (https://lua-api.factorio.com/latest/cla ... d_contents) states that "If information about fluid temperatures is required, LuaEntity::fluidbox should be used instead.". The wagon clearly has this information (it says "25˚C") but how would I retrieve it from the entity?
In the documentation for get_fluid_contents (https://lua-api.factorio.com/latest/cla ... d_contents) states that "If information about fluid temperatures is required, LuaEntity::fluidbox should be used instead.". The wagon clearly has this information (it says "25˚C") but how would I retrieve it from the entity?
Re: [2.0.17] fluid wagon has contents but the fluidbox is empty
It was changed since 1.1 because there was a pile of hacks to attempt to pretend fluid wagons contain fluid box while they did not use a fluid box, that was causing various inconsistencies when trying to obtain a fluid box prototype which was not possible to be given since wagons are not using fluid boxes.
LuaEntity::get_fluid returns Fluid which should contain temperature information. I was not checking what is the state of LuaEntity::get_fluid/set_fluid since they were implemented before fluid segments merged fluid storage was added since it vandalized quite a lot of lua api, but i think it should still keep working for fluid wagons.
LuaEntity::get_fluid returns Fluid which should contain temperature information. I was not checking what is the state of LuaEntity::get_fluid/set_fluid since they were implemented before fluid segments merged fluid storage was added since it vandalized quite a lot of lua api, but i think it should still keep working for fluid wagons.
Re: [2.0.17] fluid wagon has contents but the fluidbox is empty
Hi,
Thanks for the explanation. It seems that this is actually a documentation issue; LuaEntity::get_fluid_contents should probably refer to get_fluid/set_fluid.
Thanks for the explanation. It seems that this is actually a documentation issue; LuaEntity::get_fluid_contents should probably refer to get_fluid/set_fluid.