Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sensor = peripheral.wrap "back"
- local key = settings.get "lasers.key"
- if not key then error "SPUDNET key for laser control not found." end
- local ws, err = http.websocket("wss://osmarks.tk/wsthing/lasers/admin", { authorization = "Key " .. key })
- if err then
- error(err)
- else
- print "Connected to THOR satellite backend."
- end
- local hist = {}
- while true do
- write "Target: "
- local target = read(nil, hist)
- table.insert(hist, target)
- print "Scanning..."
- local es = sensor.sense()
- for _, e in pairs(es) do
- if e.name:match(target) or e.displayName:match(target) then
- local x, y, z = gps.locate()
- local tx, ty, tz = e.x + x, e.y + y - 1, e.z + z
- ws.send(("fire_position %f %f %f 5"):format(tx, ty, tz))
- print(e.name, e.displayName, tx, ty, tz)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement