Rail LuaEntity - query rail block state
Posted: Wed Jun 27, 2018 3:05 pm
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?
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?