Advertisement
sanovskiy

autosummon

Aug 19th, 2014
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. TYPE_WARP = "warpcore"
  2. warpCore = nil
  3. term.clear()
  4. term.setCursorPos(1,1)
  5. sides = {'left','right','back','top','bottom','front'}
  6. function twiddle_thumbs()
  7.   os.queueEvent("randomEvent")
  8.   os.pullEvent()      
  9. end
  10.  
  11. for i = 1,#sides do
  12.   if peripheral.getType(sides[i]) == TYPE_WARP then
  13.     warpCore = peripheral.wrap(sides[i])
  14.     warpCore.set_mode(0)
  15.     break;
  16.   end
  17. end
  18.  
  19. if warpCore == nil then
  20.   print("No warps found")
  21.   error()
  22. end
  23.  
  24.  
  25. print("Going idle...")
  26. print("")
  27. while true do
  28.   for i,side in pairs(sides) do
  29.     if redstone.getInput(side) then
  30.       print("Got signal from "..side.."!")
  31.       warpCore.set_mode(1)
  32.       print("WarpCore powered on")
  33.       sleep(10)
  34.       print("Summoning "..warpCore.get_attached_players())
  35.       warpCore.summon_all()
  36.       print("Cooling down...")
  37.       sleep(30)
  38.       warpCore.set_mode(0)
  39.       print("WarpCore shutted down")
  40.       print("Going idle...")
  41.       print("")
  42.     else
  43.       twiddle_thumbs()
  44.     end
  45.   end
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement