A mod I use uses the signal_state to output a logistics state. I noticed that there are some inconsistencies with the signal_state of the chain signal.
When the block that a chain signal points towards is blocked, the signal shows red, and the output is 1.
If the block that it points to is not blocked, but further up the chain is blocked, the signal shows red, but outputs 0 instead.
Should it be outputting 1, or should there be a new state, like "blocked ahead?"
[0.12.4][hanziq] Chain signal's signal_state inconsistent
Re: [0.12.4][hanziq] Chain signal's signal_state inconsistent
Chain signals are an extension over regular signals, so the signal_state is acting exactly the same way, as if the signal were a normal one. There is a different state variable, that is used in chain signals only, but is not yet exposed, it contains these states:
NONE = 0 - invalid state, internal only, no signal should ever have this chain state
ALL_OPEN = 1 - green
PARTIALLY_OPEN = 2 - blue
NONE_OPEN = 3 - red
These states do not affect the logic of the chain signals, only the visuals. Trains themselves keep track of the chains and act accordingly. I will expose this variable for 0.12.5.
NONE = 0 - invalid state, internal only, no signal should ever have this chain state
ALL_OPEN = 1 - green
PARTIALLY_OPEN = 2 - blue
NONE_OPEN = 3 - red
These states do not affect the logic of the chain signals, only the visuals. Trains themselves keep track of the chains and act accordingly. I will expose this variable for 0.12.5.
Re: [0.12.4][hanziq] Chain signal's signal_state inconsistent
my 2 cent:HanziQ wrote:Chain signals are an extension over regular signals, so the signal_state is acting exactly the same way, as if the signal were a normal one. There is a different state variable, that is used in chain signals only, but is not yet exposed, it contains these states:
NONE = 0 - invalid state, internal only, no signal should ever have this chain state
ALL_OPEN = 1 - green
PARTIALLY_OPEN = 2 - blue
NONE_OPEN = 3 - red
These states do not affect the logic of the chain signals, only the visuals. Trains themselves keep track of the chains and act accordingly. I will expose this variable for 0.12.5.
If this flag is really just used for the visual representation of a different internal state flag, then it would be better to keep it hidden, to keep further logik only to be able to look at real logic flags, not purely visual indicator flags: Separation of Logical Status <-> Representation of it.