Advertisement
tobast

[CC] Minecart call

May 10th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. os.loadAPI('/lib/slot_sig')
  2.  
  3. REDSTONE_SIDE='right'
  4. SCREEN_SIDE='left'
  5. MODEM_SIDE='top'
  6.  
  7. function sendCart()
  8.     redstone.setOutput(REDSTONE_SIDE,true)
  9.     sleep(1)
  10.     redstone.setOutput(REDSTONE_SIDE,false)
  11. end
  12.  
  13. function onRednet(data)
  14.     local sender=data[1]
  15.     local mess=data[2]
  16.     if(mess.type == 'call') then
  17.         sendCart()
  18.     end
  19. end
  20.  
  21. function sendCall()
  22.     rednet.send(OTH_ID, {type="call"})
  23. end
  24.  
  25. function onClick(data)
  26.     sendCall()
  27. end
  28.  
  29. function main()
  30.     slot_sig.connectSlot('monitor_touch', onClick)
  31.     slot_sig.connectSlot('rednet_message', onRednet)
  32.  
  33.     screen=peripheral.wrap(SCREEN_SIDE)
  34.     screen.setCursorPos(3,3)
  35.     screen.write("CALL CART")
  36.  
  37.     rednet.open(MODEM_SIDE)
  38.     slot_sig.run()
  39. end
  40.  
  41. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement