changed default log levels and added nil and exist checks to birth object
This commit is contained in:
@@ -25,7 +25,7 @@ function StageConfig:new()
|
|||||||
local maxMissionsPerStage = SpearheadConfig.StageConfig.maxMissionStage
|
local maxMissionsPerStage = SpearheadConfig.StageConfig.maxMissionStage
|
||||||
o.getMaxMissionsPerStage = function(self) return maxMissionsPerStage end
|
o.getMaxMissionsPerStage = function(self) return maxMissionsPerStage end
|
||||||
|
|
||||||
o.logLevel = Spearhead.LoggerTemplate.LogLevelOptions.DEBUG
|
o.logLevel = Spearhead.LoggerTemplate.LogLevelOptions.INFO
|
||||||
|
|
||||||
o.toString = function()
|
o.toString = function()
|
||||||
return Spearhead.Util.toString({
|
return Spearhead.Util.toString({
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ local fleetGroups = {}
|
|||||||
|
|
||||||
GlobalFleetManager.start = function(database)
|
GlobalFleetManager.start = function(database)
|
||||||
|
|
||||||
local logger = Spearhead.LoggerTemplate:new("CARRIERFLEET", Spearhead.LoggerTemplate.LogLevelOptions.DEBUG)
|
local logger = Spearhead.LoggerTemplate:new("CARRIERFLEET", Spearhead.LoggerTemplate.LogLevelOptions.INFO)
|
||||||
|
|
||||||
local all_groups = Spearhead.DcsUtil.getAllGroupNames()
|
local all_groups = Spearhead.DcsUtil.getAllGroupNames()
|
||||||
for _, groupName in pairs(all_groups) do
|
for _, groupName in pairs(all_groups) do
|
||||||
|
|||||||
@@ -300,26 +300,27 @@ do
|
|||||||
|
|
||||||
local AI_GROUPS = {}
|
local AI_GROUPS = {}
|
||||||
|
|
||||||
if event.id == world.event.S_EVENT_BIRTH then
|
local function CheckAndTriggerSpawnAsync(unit, time)
|
||||||
|
|
||||||
local function isPlayer(unit)
|
local function isPlayer(unit)
|
||||||
if Spearhead.DcsUtil.IsGroupStatic(unit:getName()) == true then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
if AI_GROUPS[unit:getGroup():getName()] == true then
|
if unit and unit:isExist() then
|
||||||
return false
|
if Spearhead.DcsUtil.IsGroupStatic(unit:getName()) == true then
|
||||||
end
|
return false
|
||||||
|
|
||||||
local players = Spearhead.DcsUtil.getAllPlayerUnits()
|
|
||||||
local unitName = unit:getName()
|
|
||||||
for i, unit in (players) do
|
|
||||||
if unit:getName() == unitName then
|
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
AI_GROUPS[unit:getGroup():getName()] = true
|
if AI_GROUPS[unit:getGroup():getName()] == true then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local players = Spearhead.DcsUtil.getAllPlayerUnits()
|
||||||
|
local unitName = unit:getName()
|
||||||
|
for i, unit in (players) do
|
||||||
|
if unit:getName() == unitName then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
AI_GROUPS[unit:getGroup():getName()] = true
|
||||||
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -328,6 +329,12 @@ do
|
|||||||
SpearheadEvents.AddCommandsToGroup(groupId)
|
SpearheadEvents.AddCommandsToGroup(groupId)
|
||||||
SpearheadEvents.TriggerPlayerEntersUnit(event.initiator)
|
SpearheadEvents.TriggerPlayerEntersUnit(event.initiator)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if event.id == world.event.S_EVENT_BIRTH then
|
||||||
|
timer.scheduleFunction(CheckAndTriggerSpawnAsync, event.initiator, timer.getTime() + 3)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user