SHOW:
|
|
- or go back to the newest paste.
1 | - | local uri = "https://discordapp.com/api/webhooks/885394220875807/FCm0iGEm6QO0YL1eG-TMdZpYhKFtFWPP4dTdeEP2HKLH3YahB2-R_nDpHqM-sQJjLg99" |
1 | + | local uri = "" |
2 | - | --local p = peripheral.find("warpdriveShipController") |
2 | + | |
3 | - | --if p == nil or p.isInterfaced() == nil then |
3 | + | |
4 | - | --print("No Controller Detected") |
4 | + | |
5 | - | --sleep(8) |
5 | + | if peripheral.getType(side) == "warpdriveShipController" then |
6 | - | --os.reboot() |
6 | + | print("Wrapping " .. side) |
7 | - | --end |
7 | + | table.insert(shipcores, peripheral.wrap(side)) |
8 | elseif peripheral.getType(side) == "modem" then | |
9 | rednet.open(side) | |
10 | end | |
11 | - | if peripheral.getType(side) == "warpdriveShipController" then |
11 | + | |
12 | - | print("Wrapping " .. side) |
12 | + | |
13 | - | table.insert(shipcores, peripheral.wrap(side)) |
13 | + | for _, shipcore in pairs(shipcores) do |
14 | - | end |
14 | + | local name = shipcore.name() |
15 | file = name:gsub(" ","") | |
16 | local shipdim = shipcore.isInHyperspace() and "Hyperspace"or"Space/Planet" | |
17 | - | for _, shipcore in pairs(shipcores) do |
17 | + | timeout = 10 |
18 | - | local name = shipcore.name() |
18 | + | repeat |
19 | - | file = name:gsub(" ","") |
19 | + | local pos |
20 | - | --os.setComputerLabel(name) |
20 | + | pos = shipcore.getLocalPosition() |
21 | - | local shipdim = shipcore.isInHyperspace() and "Hyperspace"or"Space/Planet" |
21 | + | local x, y, z |
22 | - | timeout = 10 |
22 | + | x, y, z = shipcore.getLocalPosition() |
23 | - | local pos |
23 | + | sleep(0.05) |
24 | - | repeat |
24 | + | timeout = timeout - 1 |
25 | - | pos = shipcore.getLocalPosition() |
25 | + | until pos ~= nil or timeout < 0 |
26 | - | local x, y, z = shipcore.getLocalPosition() |
26 | + | if timeout < 0 then |
27 | - | sleep(0.05) |
27 | + | print(name.." Position Error") |
28 | - | timeout = timeout - 1 |
28 | + | else |
29 | - | until pos ~= nil or timeout < 0 |
29 | + | text = x.." "..y.." "..z |
30 | - | if timeout < 0 then |
30 | + | oldText = "" |
31 | - | print(name.." Position Error") |
31 | + | local mass = shipcore.getShipSize() |
32 | - | --sleep(10) |
32 | + | local energyStored, energyMax, energyUnits = shipcore.getEnergyStatus() |
33 | - | --os.reboot() |
33 | + | if fs.exists("disk/ships/"..file) then |
34 | - | else |
34 | + | local f = fs.open("disk/ships/"..file,"r") |
35 | - | local x,y,z = shipcore.getLocalPosition() |
35 | + | oldText = f.readAll() |
36 | - | local mass = shipcore.getShipSize() |
36 | + | f.close() |
37 | - | local energyStored, energyMax, energyUnits = shipcore.getEnergyStatus() |
37 | + | end |
38 | - | local text = x .. " "..y.." "..z |
38 | + | if string.find(oldText, text) then |
39 | - | local oldText = "" |
39 | + | print(name.." No Movement") |
40 | - | if fs.exists("disk/ships/"..file) then |
40 | + | else |
41 | - | local f = fs.open("disk/ships/"..file,"r"); |
41 | + | stt = "disk/ships/"..file |
42 | - | oldText = f.readAll(); |
42 | + | local f2 = fs.open(stt,"w") |
43 | - | --print("No Movement") |
43 | + | f2.write("Shipname: "..name.."\n") |
44 | - | f.close(); |
44 | + | if energyMax <= 2057142 then core = "Shuttle" elseif energyMax <= 41142857 then core = "Corvette" else core = "Frigate" |
45 | - | end |
45 | + | end |
46 | - | if string.find(oldText, text) then |
46 | + | f2.write("Type: "..core.."\n") |
47 | - | print(name.." No Movement") |
47 | + | f2.write("Dimension: "..shipdim.."\n") |
48 | - | else |
48 | + | f2.write("Location: "..pos.."\n") |
49 | - | --if oldText ~= text then |
49 | + | f2.write("Energy: "..energyStored.." "..energyUnits.."\n") |
50 | - | stt = "disk/ships/"..file |
50 | + | f2.write("Tons: "..mass.."\n") |
51 | - | print(stt) |
51 | + | print(name.." Movment Detected") |
52 | - | local f2 = fs.open(stt,"w") |
52 | + | http.post(uri,"{\"content\":\"```yaml\\nShipname: "..name.." \\nType: "..core.." \\nDimension: "..shipdim.." \\nLocation: "..text.."\\nEnergy: "..energyStored.." "..energyUnits.."\\nTons: "..mass.."```\"}",{['content-type']="application/json"}) |
53 | - | f2.write("Shipname: "..name.."\n") |
53 | + | output ="\1672".."CoreNET: ".."\1674".."Movement Detected.\nShipname: "..name.." \nType: "..core.." \nDimension: "..shipdim.." \nLocation: "..text.."\nEnergy: "..energyStored.." "..energyUnits.."\nTons: "..mass |
54 | - | if energyMax <= 2057142 then core = "Shuttle" elseif energyMax <= 41142857 then core = "Corvette" else core = "Frigate" |
54 | + | rednet.broadcast(output) |
55 | - | end |
55 | + | f2.close() |
56 | - | f2.write("Type: "..core.."\n") |
56 | + | end |
57 | - | f2.write("Dimension: "..shipdim.."\n") |
57 | + | end |
58 | - | f2.write("Location: "..text.."\n") |
58 | + | sleep(5) |
59 | - | f2.write("Energy: "..energyStored.." "..energyUnits.."\n") |
59 | + | end |
60 | - | f2.write("Tons: "..mass.."\n") |
60 | + | |
61 | - | print("Movment Detected"); |
61 | + | os.reboot() |