mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-15 11:45:42 +00:00
parent
58e6e9ea46
commit
7e5970673f
@ -103,7 +103,7 @@ function locate( _nTimeout, _bDebug )
|
|||||||
local sSide, sChannel, sReplyChannel, tMessage, nDistance = p1, p2, p3, p4, p5
|
local sSide, sChannel, sReplyChannel, tMessage, nDistance = p1, p2, p3, p4, p5
|
||||||
if sSide == sModemSide and sChannel == os.getComputerID() and sReplyChannel == CHANNEL_GPS and nDistance then
|
if sSide == sModemSide and sChannel == os.getComputerID() and sReplyChannel == CHANNEL_GPS and nDistance then
|
||||||
-- Received the correct message from the correct modem: use it to determine position
|
-- Received the correct message from the correct modem: use it to determine position
|
||||||
if type(tMessage) == "table" and #tMessage == 3 then
|
if type(tMessage) == "table" and #tMessage == 3 and type(tMessage[1]) == "number" and type(tMessage[2]) == "number" and type(tMessage[3]) == "number" then
|
||||||
local tFix = { vPosition = vector.new( tMessage[1], tMessage[2], tMessage[3] ), nDistance = nDistance }
|
local tFix = { vPosition = vector.new( tMessage[1], tMessage[2], tMessage[3] ), nDistance = nDistance }
|
||||||
if _bDebug then
|
if _bDebug then
|
||||||
print( tFix.nDistance.." metres from "..tostring( tFix.vPosition ) )
|
print( tFix.nDistance.." metres from "..tostring( tFix.vPosition ) )
|
||||||
|
@ -76,9 +76,9 @@ local vmetatable = {
|
|||||||
|
|
||||||
function new( x, y, z )
|
function new( x, y, z )
|
||||||
local v = {
|
local v = {
|
||||||
x = x or 0,
|
x = type(x) == "number" and x or 0,
|
||||||
y = y or 0,
|
y = type(y) == "number" and y or 0,
|
||||||
z = z or 0
|
z = type(z) == "number" and z or 0
|
||||||
}
|
}
|
||||||
setmetatable( v, vmetatable )
|
setmetatable( v, vmetatable )
|
||||||
return v
|
return v
|
||||||
|
Loading…
Reference in New Issue
Block a user