Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rs = peripheral.find("redstoneIntegrator")
- if not rs then error("No redstone integrator") end
- local dandelifeon = "south"
- local destructor = "north"
- local constructor = "up"
- local lever = "west"
- local cancelKey = keys.c
- local function pulse(direction, duration)
- if not duration then duration = 1 end
- rs.setOutput(direction, true)
- sleep(duration)
- rs.setOutput(direction, false)
- end
- local function initOutput(direction)
- rs.setOutput(direction, false)
- end
- initOutput(dandelifeon)
- initOutput(destructor)
- initOutput(constructor)
- local function main()
- print("Cellular Block Farm")
- while true do
- if rs.getInput(lever) then
- sleep(1)
- else
- pulse(destructor)
- pulse(constructor)
- pulse(dandelifeon, 2)
- end
- end
- end
- local function canceller()
- print("Program is running now, press", keys.getName(cancelKey), "to cancel")
- while true do
- local event, key = os.pullEvent("key")
- if key == cancelKey then
- print("Okay, goodbye...")
- return
- end
- end
- end
- parallel.waitForAny(main, canceller)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement