Blazuno

TurtleSwarmPORTABLE

Oct 31st, 2021 (edited)
802
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1. local arg1, arg2, arg3, arg4 = ...
  2. local plrXPos, plrYPos, plrZPos = gps.locate()
  3. local plrYPos = plrYPos - 1
  4. local plrXPos = math.floor(plrXPos)
  5. local plrYPos = math.floor(plrYPos)
  6. local plrZPos = math.floor(plrZPos)
  7. local plrPos = {plrXPos, plrYPos, plrZPos}
  8. local miningDimensions  = {arg1, arg2, arg3, arg4}
  9. local PCID = os.getComputerID()
  10. rednet.open("back")
  11.  
  12. for i,v in pairs(plrPos) do
  13.     print(i..":"..v)
  14. end
  15.  
  16.  
  17. function receiveHomePCID()
  18.   HomePCID = nil
  19.   local k
  20.   local l
  21.     repeat
  22.       sleep(1)
  23.       HomePCID, l, k = rednet.receive()
  24.     until HomePCID ~= nil
  25.   print("Debug: "..HomePCID)
  26. end
  27.  
  28. function receiveTurtlePCIDs()
  29.   tableTurtlePCID = nil
  30.     local k
  31.     local j
  32.     repeat
  33.       k, tabelTurtlePCID, j = rednet.recieve()
  34.       sleep(1)
  35.     until tableTurtlePCID ~= nil
  36. end
  37.  
  38. function receiveTurtleCountNeeded()
  39.   turtleCountNeeded = nil
  40.   local k
  41.   local l
  42.     repeat
  43.       sleep(1)
  44.       turtleCountNeeded, l, k = rednet.receive()
  45.     until turtleCountNeeded ~= nil
  46.   print("Debug: "..turtleCountNeeded)
  47. end
  48.  
  49.  
  50.  
  51. function sendPhonePCID()
  52.     rednet.broadcast(PCID)
  53. end
  54.  
  55. function sendPlrPos(Str)
  56.   if Str == nil then
  57.     rednet.broadcast(plrPos)
  58.   else
  59.     rednet.send(Str, plrPos)
  60.   end
  61. end
  62.  
  63.  
  64.  
  65. function sendMiningDimensionsSignal(Str)
  66.   rednet.send(Str, miningPosition)
  67. end
  68.  
  69. packet = {PCID, plrPos[1], plrPos[2], plrPos[3], miningDimensions[1], miningDimensions[2], miningDimensions[3], miningDimensions[4]}
  70.  
  71. sleep(5)
  72. rednet.broadcast(packet)
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
Add Comment
Please, Sign In to add comment