moved files and added compile script
This commit is contained in:
+1
-2
@@ -12,8 +12,7 @@ In the example we'll show how you can create a simple island hopping mission
|
||||
## Include Script
|
||||
|
||||
Firstly include the script.
|
||||
TODO: include link to release.
|
||||
|
||||
<a href="./speadhead.lua" target="_blank" rel="noopener noreferrer">Download Script</a>
|
||||
|
||||
## Stages
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 = {}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -120,8 +120,7 @@
|
||||
|
||||
]] --
|
||||
|
||||
|
||||
local dbLogger = Spearhead.LoggerTemplate:new("database", Spearhead.config.logLevel)
|
||||
local dbLogger = Spearhead.LoggerTemplate:new("database", Spearhead.LoggerTemplate.LogLevelOptions.INFO)
|
||||
local databaseManager = Spearhead.DB:new(dbLogger)
|
||||
|
||||
local capConfig = {
|
||||
@@ -133,12 +132,12 @@ local capConfig = {
|
||||
minDurationOnStation = 1800,
|
||||
maxDurationOnStation = 2700,
|
||||
rearmDelay = 600,
|
||||
deathDelay = 1800
|
||||
deathDelay = 1800,
|
||||
logLevel = Spearhead.LoggerTemplate.LogLevelOptions.INFO
|
||||
}
|
||||
|
||||
local stageConfig = {
|
||||
preActivatedStages = 3,
|
||||
capActiveStages = 4
|
||||
logLevel = Spearhead.LoggerTemplate.LogLevelOptions.INFO
|
||||
}
|
||||
|
||||
Spearhead.internal.GlobalCapManager.start(databaseManager, capConfig, stageConfig)
|
||||
|
||||
Reference in New Issue
Block a user