AssortedBrunoz

oil_finder_pc

Sep 16th, 2024
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. local turtle_id = 4
  2. os.loadAPI("Orion_API.lua")
  3.  
  4. rednet.open("right")
  5.  
  6. term.redirect(peripheral.find("monitor"))
  7. Orion_API.reset()
  8.  
  9. while true do
  10.    
  11.     local id, message = rednet.receive() -- {{x,y,z}, fuel, oil}
  12.     if id == turtle_id then
  13.  
  14.         if message[3] then
  15.             Orion_API.reset()
  16.             local x,y,z = table.unpack(message[1])
  17.             local str = "OIL HAS BEEN FOUND AT:\nX: "..x.."\nY: "..y.."\nZ: "..z.."\nTURTLE SHUTTING DOWN."
  18.             write(str)
  19.             local f = fs.open("location.txt", "w")
  20.             f.write(str)
  21.             f.close()
  22.         else
  23.             Orion_API.reset()
  24.             local x,y,z = table.unpack(message[1])
  25.             write("CURRENT POSITION:\nX: "..x.."\nY: "..y.."\nZ: "..z.."\nFUEL: "..message[2])
  26.         end
  27.     end
  28. end
  29.  
Add Comment
Please, Sign In to add comment