Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modem = peripheral.wrap("bottom")
- monitor = peripheral.wrap("top")
- isSpawning = false
- function writeCenter(text)
- x, y = monitor.getSize()
- x2, y2 = monitor.getCursorPos()
- monitor.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), math.ceil(y / 2))
- monitor.write(text)
- end
- function switchOn()
- modem.transmit(81, 81, "on")
- monitor.setBackgroundColor(colors.green)
- monitor.clear()
- writeCenter("Slaughtering hard")
- end
- function switchOff()
- modem.transmit(81, 81, "off")
- monitor.setBackgroundColor(colors.red)
- monitor.clear()
- writeCenter("Click to start slaughtering")
- end
- switchOff()
- while true do
- event, side, xPos, yPos = os.pullEvent("monitor_touch")
- if isSpawning == true then
- isSpawning = false
- switchOff()
- else
- isSpawning = true
- switchOn()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement