RH, GROUP

This commit is contained in:
Frank
2019-08-18 21:02:23 +02:00
parent aade1eebf1
commit 94bbb8a9a4
2 changed files with 107 additions and 100 deletions
+5 -3
View File
@@ -907,7 +907,7 @@ function RESCUEHELO:onafterStart(From, Event, To)
-- Use an uncontrolled aircraft group. -- Use an uncontrolled aircraft group.
self.helo=GROUP:FindByName(self.helogroupname) self.helo=GROUP:FindByName(self.helogroupname)
if self.helo:IsAlive() then if self.helo and self.helo:IsAlive() then
-- Start uncontrolled group. -- Start uncontrolled group.
self.helo:StartUncontrolled() self.helo:StartUncontrolled()
@@ -1020,7 +1020,7 @@ function RESCUEHELO:onafterStatus(From, Event, To)
else else
-- Send helo back to base. -- Send helo back to base.
self:RTB() self:RTB(self.airbase)
end end
@@ -1211,7 +1211,9 @@ function RESCUEHELO:onafterReturned(From, Event, To, airbase)
self.helo:InitModex(self.modex) self.helo:InitModex(self.modex)
-- Respawn helo at current airbase. -- 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. -- Restart the formation.
self:__Run(10) self:__Run(10)
@@ -1773,6 +1773,8 @@ end
function GROUP:RespawnAtCurrentAirbase(SpawnTemplate, Takeoff, Uncontrolled) -- R2.4 function GROUP:RespawnAtCurrentAirbase(SpawnTemplate, Takeoff, Uncontrolled) -- R2.4
self:F2( { SpawnTemplate, Takeoff, Uncontrolled} ) self:F2( { SpawnTemplate, Takeoff, Uncontrolled} )
if self and self:IsAlive() then
-- Get closest airbase. Should be the one we are currently on. -- Get closest airbase. Should be the one we are currently on.
local airbase=self:GetCoordinate():GetClosestAirbase() local airbase=self:GetCoordinate():GetClosestAirbase()
@@ -1878,6 +1880,9 @@ function GROUP:RespawnAtCurrentAirbase(SpawnTemplate, Takeoff, Uncontrolled) --
return self return self
end end
else
self:E("WARNING: GROUP is not alive!")
end
return nil return nil
end end