Merge branch 'develop' into FF/Fox2

This commit is contained in:
Frank
2020-03-14 20:41:35 +01:00
2 changed files with 11 additions and 37 deletions
+2 -2
View File
@@ -190,7 +190,7 @@ end
function DATABASE:AddUnit( DCSUnitName ) function DATABASE:AddUnit( DCSUnitName )
if not self.UNITS[DCSUnitName] then if not self.UNITS[DCSUnitName] then
self:I( { "Add UNIT:", DCSUnitName } ) self:T( { "Add UNIT:", DCSUnitName } )
local UnitRegister = UNIT:Register( DCSUnitName ) local UnitRegister = UNIT:Register( DCSUnitName )
self.UNITS[DCSUnitName] = UNIT:Register( DCSUnitName ) self.UNITS[DCSUnitName] = UNIT:Register( DCSUnitName )
@@ -526,7 +526,7 @@ end
function DATABASE:AddGroup( GroupName ) function DATABASE:AddGroup( GroupName )
if not self.GROUPS[GroupName] then if not self.GROUPS[GroupName] then
self:I( { "Add GROUP:", GroupName } ) self:T( { "Add GROUP:", GroupName } )
self.GROUPS[GroupName] = GROUP:Register( GroupName ) self.GROUPS[GroupName] = GROUP:Register( GroupName )
end end
+9 -35
View File
@@ -1246,19 +1246,14 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
if self:_GetSpawnIndex( SpawnIndex ) then if self:_GetSpawnIndex( SpawnIndex ) then
if self.SpawnGroups[self.SpawnIndex].Visible then if self.SpawnGroups[self.SpawnIndex].Visible then
env.info("FF visible ==> activate")
self.SpawnGroups[self.SpawnIndex].Group:Activate() self.SpawnGroups[self.SpawnIndex].Group:Activate()
else else
env.info("FF get template")
local SpawnTemplate = self.SpawnGroups[self.SpawnIndex].SpawnTemplate local SpawnTemplate = self.SpawnGroups[self.SpawnIndex].SpawnTemplate
self:T( SpawnTemplate.name ) self:T( SpawnTemplate.name )
if SpawnTemplate then if SpawnTemplate then
env.info("FF found template")
local PointVec3 = POINT_VEC3:New( SpawnTemplate.route.points[1].x, SpawnTemplate.route.points[1].alt, SpawnTemplate.route.points[1].y ) local PointVec3 = POINT_VEC3:New( SpawnTemplate.route.points[1].x, SpawnTemplate.route.points[1].alt, SpawnTemplate.route.points[1].y )
self:T( { "Current point of ", self.SpawnTemplatePrefix, PointVec3 } ) self:T( { "Current point of ", self.SpawnTemplatePrefix, PointVec3 } )
@@ -1429,14 +1424,6 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
SpawnGroup:SetAIOnOff( self.AIOnOff ) SpawnGroup:SetAIOnOff( self.AIOnOff )
end end
env.info("FF Returning spawn group")
if SpawnGroup then
else
end
self:T3( SpawnTemplate.name ) self:T3( SpawnTemplate.name )
-- If there is a SpawnFunction hook defined, call it. -- If there is a SpawnFunction hook defined, call it.
@@ -1448,16 +1435,13 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
--if self.Repeat then --if self.Repeat then
-- _DATABASE:SetStatusGroup( SpawnTemplate.name, "ReSpawn" ) -- _DATABASE:SetStatusGroup( SpawnTemplate.name, "ReSpawn" )
--end --end
--else
-- self:E("ERROR: No spawn template.")
end end
self.SpawnGroups[self.SpawnIndex].Spawned = true self.SpawnGroups[self.SpawnIndex].Spawned = true
return self.SpawnGroups[self.SpawnIndex].Group return self.SpawnGroups[self.SpawnIndex].Group
else else
self:E( { self.SpawnTemplatePrefix, "No more Groups to Spawn:", SpawnIndex, self.SpawnMaxGroups } ) --self:E( { self.SpawnTemplatePrefix, "No more Groups to Spawn:", SpawnIndex, self.SpawnMaxGroups } )
end end
return nil return nil
@@ -1958,20 +1942,9 @@ function SPAWN:SpawnAtAirbase( SpawnAirbase, Takeoff, TakeoffAltitude, TerminalT
SpawnTemplate.uncontrolled = self.SpawnUnControlled SpawnTemplate.uncontrolled = self.SpawnUnControlled
env.info("FF spawning group with index "..self.SpawnIndex)
-- Spawn group. -- Spawn group.
local GroupSpawned = self:SpawnWithIndex( self.SpawnIndex ) local GroupSpawned = self:SpawnWithIndex( self.SpawnIndex )
if GroupSpawned then
env.info("ERROR: spawn group is there!")
GroupSpawned:SmokeRed()
local n=#GroupSpawned:GetUnits()
env.info("FF n="..tostring(n))
else
env.info("ERROR: spawn group not there!")
end
-- When spawned in the air, we need to generate a Takeoff Event. -- When spawned in the air, we need to generate a Takeoff Event.
if Takeoff == GROUP.Takeoff.Air then if Takeoff == GROUP.Takeoff.Air then
for UnitID, UnitSpawned in pairs( GroupSpawned:GetUnits() ) do for UnitID, UnitSpawned in pairs( GroupSpawned:GetUnits() ) do
@@ -3012,13 +2985,14 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) --R2.2
-- self.SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix ) -- self.SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix )
-- end -- end
local SpawnTemplate local SpawnTemplate
if self.TweakedTemplate ~= nil and self.TweakedTemplate == true then if self.TweakedTemplate ~= nil and self.TweakedTemplate == true then
BASE:I("WARNING: You are using a tweaked template.") BASE:I("WARNING: You are using a tweaked template.")
SpawnTemplate = self.SpawnTemplate SpawnTemplate = self.SpawnTemplate
else else
SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix ) SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix )
end SpawnTemplate.name = self:SpawnGroupName( SpawnIndex )
end
SpawnTemplate.groupId = nil SpawnTemplate.groupId = nil