Add fluid system number read to LuaFluidBox

Post Reply
Erythion
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sun May 20, 2018 3:40 pm
Contact:

Add fluid system number read to LuaFluidBox

Post 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).

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2241
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Add fluid system number read to LuaFluidBox

Post 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.

Erythion
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sun May 20, 2018 3:40 pm
Contact:

Re: Add fluid system number read to LuaFluidBox

Post 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?

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 451
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Add fluid system number read to LuaFluidBox

Post 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 2052 times
Don't forget, you're here forever.

curiosity
Filter Inserter
Filter Inserter
Posts: 322
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Add fluid system number read to LuaFluidBox

Post by curiosity »

But a method to tell if two fluid boxes are connected won't?

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2241
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Add fluid system number read to LuaFluidBox

Post by boskid »

OK. It is now implemented for 1.1.54.
1.1.54's changelog wrote:Added LuaFluidBox::get_fluid_system_id() method.

sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Add fluid system number read to LuaFluidBox

Post by sparr »

Raiguard wrote:
Fri Jan 28, 2022 1:12 am
my Pipe Visualizer mod.
You, sir, are a terrible tease.

Post Reply

Return to “Implemented mod requests”