trainworld_computercraft/computer/27/dismemberer.lua
2025-07-03 01:23:46 +02:00

31 lines
628 B
Lua

ts = peripheral.wrap("back")
--[[
on the tick where the train
was imminent, but was not present.
and now is present and imminent:
payload sequence
]]
function ready()
wasimminent = isimminent
isimminent = ts.isTrainImminent()
waspresent = ispresent
ispresent = ts.isTrainPresent()
if
wasimminent and
isimminent and
(not waspresent) and
ispresent
then
payload()
end
end
function payload()
sleep(0.3)
if ts.isTrainPresent() then
ts.disassemble()
sleep(0.3)
ts.assemble()
end
end
repeat ready() sleep(0.05) until false