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?
Rail LuaEntity - query rail block state
-
- Fast Inserter
- Posts: 128
- Joined: Thu Feb 08, 2018 8:25 am
- Contact:
Re: Rail LuaEntity - query rail block state
This is something I'm looking into.
If you want to get ahold of me I'm almost always on Discord.
-
- Fast Inserter
- Posts: 128
- Joined: Thu Feb 08, 2018 8:25 am
- Contact:
Re: Rail LuaEntity - query rail block state
The new LuaEntity::trains_in_block in 0.17 will fit my needs for this request, this can be moved to Implemented.