Method | Description |
---|---|
isTrainPassing() | Checks if a train is detected |
getPassingTrainName() | Gets the detected train's name |
Event | Description |
---|---|
train_passing | Triggers when the observer detects a train |
train_passed | Triggers when the observer stops detecting a train |
isTrainPassing()
Checks if a train is currently within the train observer's range.
Returns
boolean
The state of the observer.true
means it's outputting redstone signal.
getPassingTrainName()
Gets the name of a train within the train observer's range.
Returns
string
The name of the train detected, ornil
if none is found.
Events
The following are events that can be accessed with os.pullEvent(filter)
.
Event: train_passing
Triggers whenever a train enters the observer's range.
Returns
string
Name of train.
Event: train_passed
Triggers whenever a train leaves the observer's range.
Returns
string
Name of train.