[0.12.4][hanziq] Chain signal's signal_state inconsistent

This subforum contains all the issues which we already resolved.
Post Reply
theit8514
Inserter
Inserter
Posts: 46
Joined: Sun Apr 20, 2014 2:11 am
Contact:

[0.12.4][hanziq] Chain signal's signal_state inconsistent

Post 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
2015-08-23 01_41_01-Factorio 0.12.4.png (414.67 KiB) Viewed 1733 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
2015-08-23 01_41_34-Factorio 0.12.4.png (880.84 KiB) Viewed 1733 times
Should it be outputting 1, or should there be a new state, like "blocked ahead?"

User avatar
HanziQ
Former Staff
Former Staff
Posts: 630
Joined: Fri Mar 27, 2015 7:07 am
Contact:

Re: [0.12.4][hanziq] Chain signal's signal_state inconsistent

Post 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.

dee-
Filter Inserter
Filter Inserter
Posts: 416
Joined: Mon Jan 19, 2015 9:21 am
Contact:

Re: [0.12.4][hanziq] Chain signal's signal_state inconsistent

Post 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.

Post Reply

Return to “Resolved Problems and Bugs”