moved files and added compile script

This commit is contained in:
2024-09-28 17:10:07 +02:00
parent bb5d150f94
commit 9bc6e4890d
5 changed files with 11 additions and 49 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ do
function GlobalCapManager.start(database, capConfig, stageConfig)
if initiated == true then return end
local logger = Spearhead.LoggerTemplate:new("AirbaseManager", Spearhead.config.logLevel)
local logger = Spearhead.LoggerTemplate:new("AirbaseManager", capConfig.logLevel)
local zones = database:getStagezoneNames()
if zones then
@@ -24,7 +24,7 @@ do
for _, id in pairs(airbaseIds) do
local airbaseName = Spearhead.DcsUtil.getAirbaseName(id)
if airbaseName then
local airbaseSpecificLogger = Spearhead.LoggerTemplate:new("CAP_" .. airbaseName, Spearhead.config.logLevel)
local airbaseSpecificLogger = Spearhead.LoggerTemplate:new("CAP_" .. airbaseName, capConfig.logLevel)
local airbase = Spearhead.internal.CapAirbase:new(id, database, airbaseSpecificLogger, capConfig, stageConfig)
if airbase then
table.insert(airbasesPerStage[stageName], airbase)
+1 -37
View File
@@ -2,35 +2,6 @@
--- DEFAULT Values
if Spearhead == nil then Spearhead = {} end
Spearhead.config = {}
Spearhead.config.logLevel = 0
--Set SpearheadConfig if nil without values
if not SpearheadConfig then SpearheadConfig = {} end
if not SpearheadConfig.CAP then SpearheadConfig.CAP = {} end
Spearhead.config.CAP = {
--- Enables or disables the cap altogether.
enable = SpearheadConfig.CAP.enable or true,
--- Sets the AI cap units
engageHelos = SpearheadConfig.CAP.engageHelos or false,
--- sets the tech type. { 0 = custom, 1 = Modern , 2 = WW2 }
technologyType = SpearheadConfig.CAP.technologyType or 1,
bingoRatio = SpearheadConfig.CAP.bingoRatio or 0.20,
}
if not SpearheadConfig.Stages then SpearheadConfig.Stages = {} end
Spearhead.config.Stages = {
preActivatedStages = SpearheadConfig.Stages.maxPreActivated or 3,
capActiveStages = SpearheadConfig.Stages.capActiveStages or 4,
}
local UTIL = {}
do -- INIT UTIL
---splits a string in sub parts by seperator
@@ -784,18 +755,11 @@ do -- INIT DCS_UTIL
function DCS_UTIL.IsBingoFuel(groupName, offset)
if offset == nil then offset = 0 end
local bingoSetting = 0.20
if Spearhead.config and Spearhead.config.CAP then
bingoSetting = Spearhead.config.CAP.bingoRatio or 0.20
end
bingoSetting = bingoSetting + offset
local group = Group.getByName(groupName)
for _, unit in pairs(group:getUnits()) do
if unit and unit:isExist() == true and unit:inAir() == true and unit:getFuel() < bingoSetting then
if Spearhead.config.logLevel == Spearhead.LoggerTemplate.LogLevelOptions.DEBUG then
env.info("[Spearhead][DcsUtil][DEBUG] " .. groupName .. " is bingo fuel: " .. unit:getFuel())
end
return true
end
end
@@ -1298,7 +1262,7 @@ Spearhead.RouteUtil = ROUTE_UTIL
local SpearheadEvents = {}
do
local SpearheadLogger = Spearhead.LoggerTemplate:new("Spearhead Events", Spearhead.config.logLevel)
local SpearheadLogger = Spearhead.LoggerTemplate:new("Spearhead Events", Spearhead.LoggerTemplate.LogLevelOptions.INFO)
do -- STAGE NUMBER CHANGED
local OnStageNumberChangedListeners = {}
+3 -3
View File
@@ -4,16 +4,16 @@ local StagesByName = {}
GlobalStageManager = {}
GlobalStageManager.start = function (database)
GlobalStageManager.start = function (database, stageConfig)
for _, stageName in pairs(database:getStagezoneNames()) do
local logger = Spearhead.LoggerTemplate:new(stageName, Spearhead.config.logLevel)
local logger = Spearhead.LoggerTemplate:new(stageName, stageConfig.logLevel)
local stage = Spearhead.internal.Stage:new(stageName, database, logger)
StagesByName[stageName] = stage
local logger = Spearhead.LoggerTemplate:new("StageManager", Spearhead.config.logLevel)
local logger = Spearhead.LoggerTemplate:new("StageManager", stageConfig.logLevel)
logger:info("Initiated " .. Spearhead.Util.tableLength(StagesByName) .. " airbases for cap")
end