Advertisement
infiniteblock

Untitled

Mar 24th, 2020
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local uri = "https://dis"
  2. local p = peripheral.find("warpdriveShipController")
  3. local name = p.name()
  4. local shipdim = p.isInHyperspace() and "Hyperspace"or"Space/Planet"
  5. local x,y,z = p.getLocalPosition()
  6. local mass = p.getShipSize()
  7. local energyStored, energyMax, energyUnits = p.getEnergyStatus()
  8. local text = x .. " "..y.." "..z; local oldText = ""
  9. if fs.exists(".profiles") then
  10. local f = fs.open(".profiles","r");
  11. oldText = f.readAll();
  12. f.close();
  13. end
  14. if oldText ~= text then
  15. local f2 = fs.open(".profiles","w");
  16. f2.write(text);
  17. if energyMax <= 2057142 then core = "Shuttle" elseif energyMax <= 41142857 then core = "Corvette" else core = "Frigate"
  18. end
  19. http.post(uri,"{\"content\":\"```yaml\\nShipname: "..name.." \\nType: "..core.." \\nDimension: "..shipdim.." \\nLocation: "..text.."\\nEnergy: "..energyStored.." "..energyUnits.."\\nTons: "..mass.."```\"}",{['content-type']="application/json"}); f2.close();
  20. end
  21. sleep(10)
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement