This commit is contained in:
Frank 2020-03-14 19:19:55 +01:00
parent 3616e4264a
commit 36666df76f
2 changed files with 31 additions and 3 deletions

View File

@ -187,7 +187,7 @@ end
function DATABASE:AddUnit( DCSUnitName ) function DATABASE:AddUnit( DCSUnitName )
if not self.UNITS[DCSUnitName] then if not self.UNITS[DCSUnitName] then
self:T( { "Add UNIT:", DCSUnitName } ) self:I( { "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 )
@ -512,7 +512,7 @@ end
function DATABASE:AddGroup( GroupName ) function DATABASE:AddGroup( GroupName )
if not self.GROUPS[GroupName] then if not self.GROUPS[GroupName] then
self:T( { "Add GROUP:", GroupName } ) self:I( { "Add GROUP:", GroupName } )
self.GROUPS[GroupName] = GROUP:Register( GroupName ) self.GROUPS[GroupName] = GROUP:Register( GroupName )
end end

View File

@ -1246,14 +1246,19 @@ 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 } )
@ -1424,6 +1429,14 @@ 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.
@ -1435,12 +1448,16 @@ 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
@ -1941,9 +1958,20 @@ 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