Page 1 of 1

Add fluid system number read to LuaFluidBox

Posted: Wed Nov 04, 2020 1:14 pm
by Erythion
The fluid system number looks very useful to tell whether two fluidboxes are connected to each other without snaking over every pipe segment in-between. The game is already keeping track of it and showing it on the debug tooltip, why not put a getter function to the Lua object? Something like LuaFluidBox.get_system_number(index).

Re: Add fluid system number read to LuaFluidBox

Posted: Wed Nov 04, 2020 1:21 pm
by boskid
ID of a FluidSystem is not part of the game state, it is not save-loaded. If you build pipes, save the game and reload you will get different id of the fluid system. Because of that it cannot be given as it would desync. It is a value only for the purpose of debugging. Similar case is with rail block id's.

If anything, method that would accept 2 fluid boxes could return bool if they both belong to the same fluid system.

Re: Add fluid system number read to LuaFluidBox

Posted: Wed Nov 04, 2020 1:24 pm
by Erythion
That function should be enough to check for connectivity, yes. Thanks.

edit: isn't the content of a fluidbox returned from the operator [] just the fluid data? how do you get the reference for the two separate fluidboxes for the parameters, then?

Re: Add fluid system number read to LuaFluidBox

Posted: Fri Jan 28, 2022 1:12 am
by Raiguard
I could like to request that this be made part of gamestate. It would SIGNIFICANTLY reduce the complexity of my Pipe Visualizer mod.
2022-01-27_18-12.png
2022-01-27_18-12.png (2.87 MiB) Viewed 667 times

Re: Add fluid system number read to LuaFluidBox

Posted: Fri Jan 28, 2022 1:35 pm
by curiosity
But a method to tell if two fluid boxes are connected won't?

Re: Add fluid system number read to LuaFluidBox

Posted: Fri Jan 28, 2022 5:20 pm
by boskid
OK. It is now implemented for 1.1.54.
1.1.54's changelog wrote:Added LuaFluidBox::get_fluid_system_id() method.

Re: Add fluid system number read to LuaFluidBox

Posted: Fri Jan 28, 2022 5:37 pm
by sparr
Raiguard wrote:
Fri Jan 28, 2022 1:12 am
my Pipe Visualizer mod.
You, sir, are a terrible tease.