mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Update RAT.lua
- Tried to fix bug the Pnow is nil
This commit is contained in:
parent
725b55a505
commit
b962096661
@ -3814,15 +3814,20 @@ function RAT:Status(message, forID)
|
|||||||
local N0units=group:GetInitialSize()
|
local N0units=group:GetInitialSize()
|
||||||
|
|
||||||
-- Monitor travelled distance since last check.
|
-- Monitor travelled distance since last check.
|
||||||
local Pnow=coords
|
local Dtravel=0
|
||||||
local Dtravel=Pnow:Get2DDistance(ratcraft.Pnow)
|
if coords and ratcraft.Pnow then
|
||||||
ratcraft.Pnow=Pnow
|
local Dtravel=coords:Get2DDistance(ratcraft.Pnow)
|
||||||
|
ratcraft.Pnow=coords
|
||||||
|
end
|
||||||
|
|
||||||
-- Add up the travelled distance.
|
-- Add up the travelled distance.
|
||||||
ratcraft.Distance=ratcraft.Distance+Dtravel
|
ratcraft.Distance=ratcraft.Distance+Dtravel
|
||||||
|
|
||||||
-- Distance remaining to destination.
|
-- Distance remaining to destination.
|
||||||
local Ddestination=Pnow:Get2DDistance(ratcraft.destination:GetCoordinate())
|
local Ddestination=-1
|
||||||
|
if ratcraft.Pnow then
|
||||||
|
Ddestination=ratcraft.Pnow:Get2DDistance(ratcraft.destination:GetCoordinate())
|
||||||
|
end
|
||||||
|
|
||||||
-- Status report.
|
-- Status report.
|
||||||
if (forID and spawnindex==forID) or (not forID) then
|
if (forID and spawnindex==forID) or (not forID) then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user