View difference between Paste ID: 001NNZDK and QwE0guDX
SHOW: | | - or go back to the newest paste.
1-
local sensor = peripheral.wrap "back"
1+
local radar = peripheral.find "radar"
2
local radar_offset = {0, 0, -1}
3-
local key = settings.get "lasers.key"
3+
local x, y, z = gps.locate()
4-
if not key then error "SPUDNET key for laser control not found." end
4+
5-
local ws, err = http.websocket("wss://osmarks.tk/wsthing/lasers/admin", { authorization = "Key " .. key })
5+
6
	write "Target: "
7-
if err then
7+
	local target = read()
8-
	error(err)
8+
9-
else
9+
	local es = radar.getEntities()
10-
	print "Connected to THOR satellite backend."
10+
11-
end
11+
		if e.name == target then
12
			print "Found matching entity."
13-
local hist = {}
13+
			local tx, ty, tz = x + e.x + radar_offset[1], y + e.y + radar_offset[2], z + e.z + radar_offset[3]
14
			print(("Target is at %f %f %f"):format(tx, ty, tz))
15
			break
16-
	local target = read(nil, hist)
16+
17-
	table.insert(hist, target)
17+
18
end