SHOW:
|
|
- or go back to the newest paste.
| 1 | - | if warpdriveCommons then os.unloadAPI("warpdriveCommons") end
|
| 1 | + | local uri = "https://dis" |
| 2 | - | if not os.loadAPI("warpdrive/warpdriveCommons") then error("missing warpdriveCommons") end
|
| 2 | + | local p = peripheral.find("warpdriveShipController")
|
| 3 | - | local w = warpdriveCommons.w |
| 3 | + | local name = p.name() |
| 4 | - | |
| 4 | + | local shipdim = p.isInHyperspace() and "Hyperspace"or"Space/Planet" |
| 5 | - | local data |
| 5 | + | local x,y,z = p.getLocalPosition() |
| 6 | - | |
| 6 | + | local mass = p.getShipSize() |
| 7 | - | ----------- Ship support |
| 7 | + | local energyStored, energyMax, energyUnits = p.getEnergyStatus() |
| 8 | - | |
| 8 | + | local text = x .. " "..y.." "..z; local oldText = "" |
| 9 | - | local ship |
| 9 | + | if fs.exists(".profiles") then
|
| 10 | - | local ship_front = 0 |
| 10 | + | local f = fs.open(".profiles","r");
|
| 11 | - | local ship_right = 0 |
| 11 | + | oldText = f.readAll(); |
| 12 | - | local ship_up = 0 |
| 12 | + | f.close(); |
| 13 | - | local ship_back = 0 |
| 13 | + | end |
| 14 | - | local ship_left = 0 |
| 14 | + | if oldText ~= text then |
| 15 | - | local ship_down = 0 |
| 15 | + | local f2 = fs.open(".profiles","w");
|
| 16 | - | local ship_isInHyper = false |
| 16 | + | f2.write(text); |
| 17 | - | local ship_x, ship_y, ship_z = 0, 0, 0 |
| 17 | + | if energyMax <= 2057142 then core = "Shuttle" elseif energyMax <= 41142857 then core = "Corvette" else core = "Frigate" |
| 18 | - | local ship_xTarget, ship_yTarget, ship_zTarget = 0, 0, 0 |
| 18 | + | end |
| 19 | - | local ship_actualDistance = 0 |
| 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 | - | local ship_energyRequired = 0 |
| 20 | + | end |
| 21 | - | local ship_movement = { 0, 0, 0 }
|
| 21 | + | sleep(10) |
| 22 | - | local ship_rotationSteps = 0 |
| 22 | + |