Method | Description |
---|---|
getState() | Gets the signal state |
isForcedRed() | Checks if the red signal is locked |
setForcedRed(forced) | Locks/Unlocks the red signal |
getSignalType() | Gets the signal type |
cycleSignalType() | Switches the signal type |
listBlockingTrainNames() | Lists trains triggering the signal |
Event | Description |
---|---|
train_signal_state_change | Triggers whenever the signal changes |
getState()
Gets the train signal's currently displayed signal, as how the trains see it.
Returns
string
The color of the signal currently displayed - either "GREEN" or "RED".
isForcedRed()
Checks if the signal is forced red by the computer.
Returns
boolean
The state of the computer-controlled red light.
setForcedRed(forced)
Forces the signal to be red regardless of redstone and free space ahead.
Goes back to default behaviour when losing connection with the computer.
Parameters
- forced:
boolean
enable/disable forced red mode.
getSignalType()
Gets the train signal's signal type (Normally toggled witha wrench) as how the trains see it.
Returns
string
The signal type - either "ENTRY_SIGNAL" or "CROSS_SIGNAL".
cycleSignalType()
Cycles through the train signal's signal types like if you used a wrench on it.
listBlockingTrainNames()
Retrurns
table
List of train namestring
s occupying the track.
Events
The following are events that can be accessed with os.pullEvent(filter)
.
Event: train_signal_state_change
Triggers whenever the signal changes.
Returns
string
Name of the signal it switched to, either "RED" or "GREEN".