Fixed bugs and optimized ESCORT following logic

- Optimized the following logic of planes and helicopters.
- Fixed bugs with menus already present in the cache of the client.
- Fixed a bug in the SPAWN ReSpawn function.
- Optimized the JoinUp logic.
This commit is contained in:
FlightControl
2016-04-08 20:03:15 +02:00
parent ab332f22e7
commit 8e901b61f4
8 changed files with 117 additions and 54 deletions

View File

@@ -418,12 +418,15 @@ function SPAWN:ReSpawn( SpawnIndex )
SpawnIndex = 1
end
local SpawnGroup = self:GetGroupFromIndex( SpawnIndex )
local SpawnDCSGroup = SpawnGroup:GetDCSGroup()
if SpawnDCSGroup then
SpawnGroup:Destroy()
end
-- TODO: This logic makes DCS crash and i don't know why (yet).
-- local SpawnGroup = self:GetGroupFromIndex( SpawnIndex )
-- if SpawnGroup then
-- local SpawnDCSGroup = SpawnGroup:GetDCSGroup()
-- if SpawnDCSGroup then
-- SpawnGroup:Destroy()
-- end
-- end
return self:SpawnWithIndex( SpawnIndex )
end
@@ -762,12 +765,15 @@ end
function SPAWN:GetGroupFromIndex( SpawnIndex )
self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnIndex } )
if SpawnIndex then
if not SpawnIndex then
SpawnIndex = 1
end
if self.SpawnGroups and self.SpawnGroups[SpawnIndex] then
local SpawnGroup = self.SpawnGroups[SpawnIndex].Group
return SpawnGroup
else
local SpawnGroup = self.SpawnGroups[1].Group
return SpawnGroup
return nil
end
end