Rail LuaEntity - query rail block state

Post Reply
shanemadden
Fast Inserter
Fast Inserter
Posts: 128
Joined: Thu Feb 08, 2018 8:25 am
Contact:

Rail LuaEntity - query rail block state

Post by shanemadden »

When looking at a rail entity, as far as I can tell the best way to get the state of the train block is to find a signal entity with find_entities_filtered to check its
defines.signal_state. I have a new mod https://mods.factorio.com/mod/train-scaling that builds trains on demand, and it'd be great to have a simple check for whether it's safe for the construction station to start building.

Would it be possible to have an attribute on the rails themselves that would either contain information about the rail block's occupation/reservation state, or an attribute with an array of LuaEntity references to the signal(s) that control entry into the block, to avoid a computationally expensive search for signal entities?

User avatar
Godmave
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Tue Nov 15, 2016 3:52 pm
Contact:

Re: Rail LuaEntity - query rail block state

Post by Godmave »


Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Rail LuaEntity - query rail block state

Post by Rseding91 »

This is something I'm looking into.
If you want to get ahold of me I'm almost always on Discord.

shanemadden
Fast Inserter
Fast Inserter
Posts: 128
Joined: Thu Feb 08, 2018 8:25 am
Contact:

Re: Rail LuaEntity - query rail block state

Post by shanemadden »

The new LuaEntity::trains_in_block in 0.17 will fit my needs for this request, this can be moved to Implemented.

Post Reply

Return to “Implemented mod requests”