mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-07-26 11:57:16 +00:00
Merge branch 'FF/Develop' into FF/Fox2
This commit is contained in:
@@ -190,7 +190,7 @@ end
|
||||
function DATABASE:AddUnit( DCSUnitName )
|
||||
|
||||
if not self.UNITS[DCSUnitName] then
|
||||
self:T( { "Add UNIT:", DCSUnitName } )
|
||||
self:I( { "Add UNIT:", DCSUnitName } )
|
||||
local UnitRegister = UNIT:Register( DCSUnitName )
|
||||
self.UNITS[DCSUnitName] = UNIT:Register( DCSUnitName )
|
||||
|
||||
@@ -526,7 +526,7 @@ end
|
||||
function DATABASE:AddGroup( GroupName )
|
||||
|
||||
if not self.GROUPS[GroupName] then
|
||||
self:T( { "Add GROUP:", GroupName } )
|
||||
self:I( { "Add GROUP:", GroupName } )
|
||||
self.GROUPS[GroupName] = GROUP:Register( GroupName )
|
||||
end
|
||||
|
||||
|
||||
@@ -326,6 +326,7 @@ function SPAWN:New( SpawnTemplatePrefix )
|
||||
self.SpawnInitRadio = nil -- No radio comms setting.
|
||||
self.SpawnInitModex = nil
|
||||
self.SpawnInitAirbase = nil
|
||||
self.TweakedTemplate = false -- Check if the user is using self made template.
|
||||
|
||||
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
|
||||
else
|
||||
@@ -379,7 +380,8 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
|
||||
self.SpawnInitRadio = nil -- No radio comms setting.
|
||||
self.SpawnInitModex = nil
|
||||
self.SpawnInitAirbase = nil
|
||||
|
||||
self.TweakedTemplate = false -- Check if the user is using self made template.
|
||||
|
||||
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
|
||||
else
|
||||
error( "SPAWN:New: There is no group declared in the mission editor with SpawnTemplatePrefix = '" .. SpawnTemplatePrefix .. "'" )
|
||||
@@ -407,7 +409,11 @@ end
|
||||
function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix )
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
self:F( { SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix } )
|
||||
|
||||
if SpawnAliasPrefix == nil or SpawnAliasPrefix == "" then
|
||||
BASE:I("ERROR: in function NewFromTemplate, required paramter SpawnAliasPrefix is not set")
|
||||
return nil
|
||||
end
|
||||
|
||||
if SpawnTemplate then
|
||||
self.SpawnTemplate = SpawnTemplate -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!
|
||||
self.SpawnTemplatePrefix = SpawnTemplatePrefix
|
||||
@@ -435,6 +441,7 @@ function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPr
|
||||
self.SpawnInitRadio = nil -- No radio comms setting.
|
||||
self.SpawnInitModex = nil
|
||||
self.SpawnInitAirbase = nil
|
||||
self.TweakedTemplate = true -- Check if the user is using self made template.
|
||||
|
||||
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
|
||||
else
|
||||
@@ -1239,13 +1246,18 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
||||
if self:_GetSpawnIndex( SpawnIndex ) then
|
||||
|
||||
if self.SpawnGroups[self.SpawnIndex].Visible then
|
||||
env.info("FF visible ==> activate")
|
||||
self.SpawnGroups[self.SpawnIndex].Group:Activate()
|
||||
else
|
||||
|
||||
env.info("FF get template")
|
||||
|
||||
local SpawnTemplate = self.SpawnGroups[self.SpawnIndex].SpawnTemplate
|
||||
self:T( SpawnTemplate.name )
|
||||
|
||||
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 )
|
||||
self:T( { "Current point of ", self.SpawnTemplatePrefix, PointVec3 } )
|
||||
@@ -1416,6 +1428,14 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
||||
|
||||
SpawnGroup:SetAIOnOff( self.AIOnOff )
|
||||
end
|
||||
|
||||
env.info("FF Returning spawn group")
|
||||
if SpawnGroup then
|
||||
|
||||
else
|
||||
|
||||
end
|
||||
|
||||
|
||||
self:T3( SpawnTemplate.name )
|
||||
|
||||
@@ -1428,12 +1448,16 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
||||
--if self.Repeat then
|
||||
-- _DATABASE:SetStatusGroup( SpawnTemplate.name, "ReSpawn" )
|
||||
--end
|
||||
|
||||
--else
|
||||
-- self:E("ERROR: No spawn template.")
|
||||
end
|
||||
|
||||
|
||||
self.SpawnGroups[self.SpawnIndex].Spawned = true
|
||||
return self.SpawnGroups[self.SpawnIndex].Group
|
||||
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
|
||||
|
||||
return nil
|
||||
@@ -1934,8 +1958,19 @@ function SPAWN:SpawnAtAirbase( SpawnAirbase, Takeoff, TakeoffAltitude, TerminalT
|
||||
|
||||
SpawnTemplate.uncontrolled = self.SpawnUnControlled
|
||||
|
||||
env.info("FF spawning group with index "..self.SpawnIndex)
|
||||
|
||||
-- Spawn group.
|
||||
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.
|
||||
if Takeoff == GROUP.Takeoff.Air then
|
||||
@@ -2977,9 +3012,14 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) --R2.2
|
||||
-- self.SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix )
|
||||
-- end
|
||||
|
||||
local SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix )
|
||||
--local SpawnTemplate = self.SpawnTemplate
|
||||
SpawnTemplate.name = self:SpawnGroupName( SpawnIndex )
|
||||
local SpawnTemplate
|
||||
if self.TweakedTemplate ~= nil and self.TweakedTemplate == true then
|
||||
BASE:I("WARNING: You are using a tweaked template.")
|
||||
SpawnTemplate = self.SpawnTemplate
|
||||
else
|
||||
SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix )
|
||||
end
|
||||
|
||||
|
||||
SpawnTemplate.groupId = nil
|
||||
--SpawnTemplate.lateActivation = false
|
||||
|
||||
Reference in New Issue
Block a user