Repository navigation
Doors
Doors cover the whole consist. There is no door state per carriage, one call moves every door on the train.
No control lease needed. setDoors is the one setter that works without
one, but it opens a lease for itself, so isManualControl() reads true after you call it.
Calling setDoors removes station control of the doors. The station normally opens them on
arrival and shuts them on departure. Once a computer sets them, the station no longer changes them and
they stay as set until you give them back.
True while the doors are open.
Opens every door with true, shuts them with false.
The setting stays. The station will not change it back, which also means it will not close the doors for you.
Gives the doors back to the station.
Call it when you are done, or the doors stay where you left them until the lease is released.
Open, wait, close, then return control to the station.
train.setDoors(true)
os.sleep(5)
train.setDoors(false)
train.releaseDoors()Open on arrival, wait until a link says the platform is clear, then close and give them back.
train.setFrequency("platform", "minecraft:green_dye", "minecraft:white_dye")
local _, id, station = os.pullEvent("train_arrived")
if id == train.getId() then
train.setDoors(true)
print("doors open at " .. station)
repeat os.sleep(0.5) until train.getFrequencyState("platform") > 0
train.setDoors(false)
train.releaseDoors()
endA missing releaseDoors() is the common error. The doors stay shut and the next station cannot
open them.
Start here
Reading the train
- Identity
- Motion
- State
- Station
- Signals
- Track ahead
- Orientation
- World position
- Carriages
- Consist wide cargo
Driving the train
Schedules
Doors and body
Links
The whole railway
Reacting to changes
Programs and reference
Start here
Controlling the plate
Automatic modes
Reading the turntable
Reference