mirror of
				https://github.com/kepler155c/opus
				synced 2025-10-31 07:33:00 +00:00 
			
		
		
		
	Anonymize GPS
Damn you gollark!
This commit is contained in:
		| @@ -20,13 +20,12 @@ function GPS.locate(timeout, debug) | |||||||
|  |  | ||||||
| 	local modem = device.wireless_modem | 	local modem = device.wireless_modem | ||||||
| 	local closeChannel = false | 	local closeChannel = false | ||||||
| 	local selfID = os.getComputerID() | 	if not modem.isOpen(GPS.CHANNEL_GPS) then | ||||||
| 	if not modem.isOpen(selfID) then | 		modem.open(GPS.CHANNEL_GPS) | ||||||
| 		modem.open(selfID) |  | ||||||
| 		closeChannel = true | 		closeChannel = true | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
| 	modem.transmit(GPS.CHANNEL_GPS, selfID, "PING") | 	modem.transmit(GPS.CHANNEL_GPS, GPS.CHANNEL_GPS, "PING") | ||||||
|  |  | ||||||
| 	local fixes = {} | 	local fixes = {} | ||||||
| 	local pos = nil | 	local pos = nil | ||||||
| @@ -34,7 +33,7 @@ function GPS.locate(timeout, debug) | |||||||
| 	while true do | 	while true do | ||||||
| 		local e, side, chan, reply, msg, dist = os.pullEvent() | 		local e, side, chan, reply, msg, dist = os.pullEvent() | ||||||
| 		if e == "modem_message" then | 		if e == "modem_message" then | ||||||
| 			if side == modem.side and chan == selfID and reply == GPS.CHANNEL_GPS and dist then | 			if side == modem.side and chan == GPS.CHANNEL_GPS and reply == GPS.CHANNEL_GPS and dist then | ||||||
| 				if type(msg) == "table" and #msg == 3 and tonumber(msg[1]) and tonumber(msg[2]) and tonumber(msg[3]) then | 				if type(msg) == "table" and #msg == 3 and tonumber(msg[1]) and tonumber(msg[2]) and tonumber(msg[3]) then | ||||||
| 					local fix = { | 					local fix = { | ||||||
| 						position = vector.new(unpack(msg)), | 						position = vector.new(unpack(msg)), | ||||||
| @@ -60,7 +59,7 @@ function GPS.locate(timeout, debug) | |||||||
| 	end | 	end | ||||||
|  |  | ||||||
| 	if closeChannel then | 	if closeChannel then | ||||||
| 		modem.close(selfID) | 		modem.close(GPS.CHANNEL_GPS) | ||||||
| 	end | 	end | ||||||
| 	if debug then | 	if debug then | ||||||
| 		print("Position is "..pos.x..","..pos.y..","..pos.z) | 		print("Position is "..pos.x..","..pos.y..","..pos.z) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Anavrins
					Anavrins