fix detected port

test-utf-8
rubin 2 years ago
parent 0cd85aeff8
commit 5ce521cb7d
  1. 20
      TruckHUD.lua

@ -4275,7 +4275,7 @@ function luChecker.checker()
if getLocalPlayerId() ~= playerId then if getLocalPlayerId() ~= playerId then
local dist = getDistanceBetweenCoords3d(position_3dtext.x,position_3dtext.y,position_3dtext.z,position_trailer.x,position_trailer.y,position_trailer.z) local dist = getDistanceBetweenCoords3d(position_3dtext.x,position_3dtext.y,position_3dtext.z,position_trailer.x,position_trailer.y,position_trailer.z)
if dist < 50 then if dist < 50 then
local key = getKeysPoint(position_trailer.x,position_trailer.y,position_trailer.z) local key = getPort(position_trailer.x,position_trailer.y,position_trailer.z)
if key == "ls" or key == "sf" then if key == "ls" or key == "sf" then
if inifiles.Settings.luCheckerCargo >= 1 and inifiles.Settings.luCheckerCargo <= 3 then if inifiles.Settings.luCheckerCargo >= 1 and inifiles.Settings.luCheckerCargo <= 3 then
key = key..cargo_replace[inifiles.Settings.luCheckerCargo] key = key..cargo_replace[inifiles.Settings.luCheckerCargo]
@ -4340,6 +4340,24 @@ function getKeysPoint(x, y, z)
return minResult, resX, resY, resZ return minResult, resX, resY, resZ
end end
function getPort(x, y, z)
local coords = {
["ls"] = {x = 2507.02, y = -2234.05, z = 13.55},
["sf"] = {x = -1731.5022, y = 118.8936, z = 3.5547}
}
local minDist, minResult = 1000000, ""
local resX, resY, resZ = 0.0, 0.0, 0.0
for name, cord in pairs(coords) do
local distance = getDistanceBetweenCoords3d(x, y, z, cord.x, cord.y, cord.z)
if distance < minDist then
minDist = distance
minResult = name
resX, resY, resZ = cord.x, cord.y, cord.z
end
end
return minResult, resX, resY, resZ
end
--- luCheckerCargo --- luCheckerCargo

Loading…
Cancel
Save