Page 1 of 1
[0.12.4][hanziq] Chain signal's signal_state inconsistent
Posted: Sun Aug 23, 2015 5:47 am
by theit8514
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.

- 2015-08-23 01_41_01-Factorio 0.12.4.png (414.67 KiB) Viewed 2132 times
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.

- 2015-08-23 01_41_34-Factorio 0.12.4.png (880.84 KiB) Viewed 2132 times
Should it be outputting 1, or should there be a new state, like "blocked ahead?"
Re: [0.12.4][hanziq] Chain signal's signal_state inconsistent
Posted: Thu Aug 27, 2015 8:44 am
by HanziQ
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.
Re: [0.12.4][hanziq] Chain signal's signal_state inconsistent
Posted: Thu Aug 27, 2015 9:03 am
by dee-
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.
my 2 cent:
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.