Advertisement
MajorVictory

Mob Grinder Controls

May 2nd, 2014
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1. os.unloadAPI("output")
  2. os.unloadAPI("button")
  3.  
  4. os.loadAPI("output") -- requires: fDvvvy0L
  5. os.loadAPI("button") -- requires: E9cdkHLf
  6.  
  7. local grinderState = false -- fale == off
  8. local spawnerState = false -- false == off
  9. local doorState = false -- false == open
  10. local fanState = false -- false == off
  11.  
  12. output.setside("bottom")
  13.  
  14. function fillTable()
  15.   button.heading("-----")
  16.   button.addButton("Door", doDoor,1,7,2,3)
  17.   button.addButton("Spawn", doSpawn,1,7,5,6)
  18.   button.addButton("Kill", doKill,1,7,8,9)
  19.   button.addButton("Fans", doFans,1,7,11,12)
  20.   button.screen()
  21. end
  22.  
  23. function getClick()
  24.   event,side,x,y = os.pullEvent("monitor_touch")
  25.   button.checkxy(x,y)
  26. end
  27.  
  28. function doSpawn()
  29.   spawnerState = not spawnerState
  30.   output.set("blue", (not spawnerState))
  31.   button.setState("Spawn", spawnerState)
  32. end
  33.  
  34. function doKill()
  35.   grinderState = not grinderState
  36.   output.set("red", (not grinderState))
  37.   button.setState("Kill", grinderState)
  38. end
  39.  
  40. function doFans()
  41.   fanState = not fanState
  42.   output.set("yellow", (not fanState))
  43.   button.setState("Fans", fanState)
  44. end
  45.  
  46. function doDoor()
  47.   if not spawnerState and not grinderState then
  48.     doorState = not doorState
  49.     output.set("white", doorState)
  50.     button.setState("Door", doorState)
  51.   else
  52.     button.flash("Door")
  53.   end
  54. end
  55.  
  56. function onBoot()
  57.  
  58.     grinderState = true
  59.     spawnerState = true
  60.     fanState = true
  61.     doorState = false
  62.  
  63.     doSpawn()
  64.     doKill()
  65.     doFans()
  66.     doDoor()
  67.  
  68. end
  69.  
  70. fillTable()
  71. onBoot()
  72. while true do getClick() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement