mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-26 06:45:29 +00:00
RH, GROUP
This commit is contained in:
@@ -907,7 +907,7 @@ function RESCUEHELO:onafterStart(From, Event, To)
|
||||
-- Use an uncontrolled aircraft group.
|
||||
self.helo=GROUP:FindByName(self.helogroupname)
|
||||
|
||||
if self.helo:IsAlive() then
|
||||
if self.helo and self.helo:IsAlive() then
|
||||
|
||||
-- Start uncontrolled group.
|
||||
self.helo:StartUncontrolled()
|
||||
@@ -1020,7 +1020,7 @@ function RESCUEHELO:onafterStatus(From, Event, To)
|
||||
else
|
||||
|
||||
-- Send helo back to base.
|
||||
self:RTB()
|
||||
self:RTB(self.airbase)
|
||||
|
||||
end
|
||||
|
||||
@@ -1211,7 +1211,9 @@ function RESCUEHELO:onafterReturned(From, Event, To, airbase)
|
||||
self.helo:InitModex(self.modex)
|
||||
|
||||
-- Respawn helo at current airbase.
|
||||
self.helo:RespawnAtCurrentAirbase()
|
||||
if self.helo and self.helo:IsAlive() then
|
||||
self:ScheduleOnce(5, self.helo.RespawnAtCurrentAirbase, self.helo)
|
||||
end
|
||||
|
||||
-- Restart the formation.
|
||||
self:__Run(10)
|
||||
|
||||
@@ -1773,6 +1773,8 @@ end
|
||||
function GROUP:RespawnAtCurrentAirbase(SpawnTemplate, Takeoff, Uncontrolled) -- R2.4
|
||||
self:F2( { SpawnTemplate, Takeoff, Uncontrolled} )
|
||||
|
||||
if self and self:IsAlive() then
|
||||
|
||||
-- Get closest airbase. Should be the one we are currently on.
|
||||
local airbase=self:GetCoordinate():GetClosestAirbase()
|
||||
|
||||
@@ -1878,6 +1880,9 @@ function GROUP:RespawnAtCurrentAirbase(SpawnTemplate, Takeoff, Uncontrolled) --
|
||||
|
||||
return self
|
||||
end
|
||||
else
|
||||
self:E("WARNING: GROUP is not alive!")
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user