Page 1 of 1
Document behavior of get_fluid() and set_fluid() for Fluid Wagons
Posted: Tue Sep 02, 2025 1:08 pm
by robot256
It would be helpful to note that
returns the contents of the wagon, including temperature. I did not expect this work because #fluid_wagon.fluidbox == 0. Also that
works the same way. There is no defines entry for "fluid storage index" indicating what to use to get the fluid wagon or fluid turret contents.
Re: Document behavior of get_fluid() and set_fluid() for Fluid Wagons
Posted: Tue Sep 02, 2025 1:33 pm
by Osmo
It is documented on
https://lua-api.factorio.com/latest/cla ... uids_count which get_fluid indirectly links to, but that's not very noticeable
Re: Document behavior of get_fluid() and set_fluid() for Fluid Wagons
Posted: Tue Sep 02, 2025 1:55 pm
by robot256
I didn't see that connection at all because I thought fluids_count was the total size of the fluid storage in the entity, not the number fluid containers in it that can be indexed by get_fluid. This connection definitely needs to be documented in get_fluid and set_fluid for the limits of the 'index' parameter, especially since they are far apart in the docums listing.
Re: Document behavior of get_fluid() and set_fluid() for Fluid Wagons
Posted: Tue Sep 02, 2025 4:00 pm
by curiosity
robot256 wrote: Tue Sep 02, 2025 1:55 pm
This connection definitely needs to be documented in get_fluid and set_fluid for the limits of the 'index' parameter, especially since they are far apart in the docums listing.
...but it is documented.
https://lua-api.factorio.com/latest/cla ... #get_fluid says explicitly what the valid range is and links to fluids_count. And the description mentions "fluid storage", which is suspicious if you expect it to just be fluidboxes.
Re: Document behavior of get_fluid() and set_fluid() for Fluid Wagons
Posted: Tue Sep 02, 2025 4:06 pm
by robot256
curiosity wrote: Tue Sep 02, 2025 4:00 pm
robot256 wrote: Tue Sep 02, 2025 1:55 pm
This connection definitely needs to be documented in get_fluid and set_fluid for the limits of the 'index' parameter, especially since they are far apart in the docums listing.
...but it is documented.
https://lua-api.factorio.com/latest/cla ... #get_fluid says explicitly what the valid range is and links to fluids_count. And the description mentions "fluid storage", which is suspicious if you expect it to just be fluidboxes.
Thank you, apparently I can't read. The other thing that threw me off was the declaration "ged_fluid(index)" and the description "gets the i-th fluid". No, it gets the "index-th" fluid ...
Also the error message when calling get_fluid(1) on an entity with fluid_count of 0 is funny, "index must be between 1 and 0."
Here's an actual useful suggestion: In the description of "get_fluid_contents()" it says that if temperature is needed, you must use fluidbox. This should say fluidbox or get_fluid().
Re: Document behavior of get_fluid() and set_fluid() for Fluid Wagons
Posted: Tue Sep 02, 2025 4:15 pm
by curiosity
Or just not mention fluidboxes at all, since get_fluid already works with them and the indexing is the same, unlike fluidboxes.
Re: Document behavior of get_fluid() and set_fluid() for Fluid Wagons
Posted: Mon Sep 08, 2025 10:43 am
by Bilka
Thanks for pointing this out, I've expanded the documentation for 2.0.67.