added lua check CI step #49
@@ -2,7 +2,6 @@ local Util = require("classes.util.Util")
|
|||||||
local CapGroup = require("classes.capClasses.airGroups.CapGroup")
|
local CapGroup = require("classes.capClasses.airGroups.CapGroup")
|
||||||
local SweepGroup = require("classes.capClasses.airGroups.SweepGroup")
|
local SweepGroup = require("classes.capClasses.airGroups.SweepGroup")
|
||||||
local InterceptGroup = require("classes.capClasses.airGroups.InterceptGroup")
|
local InterceptGroup = require("classes.capClasses.airGroups.InterceptGroup")
|
||||||
local RunwayBombingTracker = require("classes.capClasses.runwayBombing.RunwayBombingTracker")
|
|
||||||
local SpearheadEvents = require("classes.spearhead_events")
|
local SpearheadEvents = require("classes.spearhead_events")
|
||||||
local RunwayStrikeMission = require("classes.stageClasses.missions.RunwayStrikeMission")
|
local RunwayStrikeMission = require("classes.stageClasses.missions.RunwayStrikeMission")
|
||||||
|
|
||||||
@@ -37,12 +36,11 @@ end
|
|||||||
---@param database Database
|
---@param database Database
|
||||||
---@param logger table
|
---@param logger table
|
||||||
---@param capConfig table
|
---@param capConfig table
|
||||||
---@param stageConfig table
|
|
||||||
---@param runwayBombingTracker RunwayBombingTracker
|
---@param runwayBombingTracker RunwayBombingTracker
|
||||||
---@param detectionManager DetectionManager
|
---@param detectionManager DetectionManager
|
||||||
---@param spawnManager SpawnManager
|
---@param spawnManager SpawnManager
|
||||||
---@return CapBase
|
---@return CapBase
|
||||||
function CapBase.new(airbaseName, database, logger, capConfig, stageConfig, runwayBombingTracker, detectionManager, spawnManager)
|
function CapBase.new(airbaseName, database, logger, capConfig, runwayBombingTracker, detectionManager, spawnManager)
|
||||||
CapBase.__index = CapBase
|
CapBase.__index = CapBase
|
||||||
local self = setmetatable({}, { __index = CapBase }) --[[@as CapBase]]
|
local self = setmetatable({}, { __index = CapBase }) --[[@as CapBase]]
|
||||||
|
|
||||||
@@ -61,7 +59,7 @@ function CapBase.new(airbaseName, database, logger, capConfig, stageConfig, runw
|
|||||||
|
|
||||||
local baseData = database:getAirbaseDataForZone(airbaseName)
|
local baseData = database:getAirbaseDataForZone(airbaseName)
|
||||||
if baseData and baseData.CapGroups then
|
if baseData and baseData.CapGroups then
|
||||||
for key, name in pairs(baseData.CapGroups) do
|
for _, name in pairs(baseData.CapGroups) do
|
||||||
local capGroup = CapGroup.New(name, capConfig, logger, spawnManager)
|
local capGroup = CapGroup.New(name, capConfig, logger, spawnManager)
|
||||||
if capGroup then
|
if capGroup then
|
||||||
self.capGroupsByName[name] = capGroup
|
self.capGroupsByName[name] = capGroup
|
||||||
@@ -70,7 +68,7 @@ function CapBase.new(airbaseName, database, logger, capConfig, stageConfig, runw
|
|||||||
end
|
end
|
||||||
|
|
||||||
if baseData and baseData.SweepGroups then
|
if baseData and baseData.SweepGroups then
|
||||||
for key, name in pairs(baseData.SweepGroups) do
|
for _, name in pairs(baseData.SweepGroups) do
|
||||||
local sweepGroup = SweepGroup.New(name, capConfig, logger, spawnManager)
|
local sweepGroup = SweepGroup.New(name, capConfig, logger, spawnManager)
|
||||||
if sweepGroup then
|
if sweepGroup then
|
||||||
self.sweepGroupsByName[name] = sweepGroup
|
self.sweepGroupsByName[name] = sweepGroup
|
||||||
@@ -79,7 +77,7 @@ function CapBase.new(airbaseName, database, logger, capConfig, stageConfig, runw
|
|||||||
end
|
end
|
||||||
|
|
||||||
if baseData and baseData.InterceptGroups then
|
if baseData and baseData.InterceptGroups then
|
||||||
for key, name in pairs(baseData.InterceptGroups) do
|
for _, name in pairs(baseData.InterceptGroups) do
|
||||||
local interceptGroup = InterceptGroup.New(name, capConfig, logger, detectionManager, spawnManager)
|
local interceptGroup = InterceptGroup.New(name, capConfig, logger, detectionManager, spawnManager)
|
||||||
if interceptGroup then
|
if interceptGroup then
|
||||||
self.interceptGroupsByName[name] = interceptGroup
|
self.interceptGroupsByName[name] = interceptGroup
|
||||||
@@ -127,7 +125,7 @@ end
|
|||||||
|
|
||||||
function CapBase:SpawnIfApplicable()
|
function CapBase:SpawnIfApplicable()
|
||||||
self.logger:debug("Check spawns for airbase " .. self.airbaseName)
|
self.logger:debug("Check spawns for airbase " .. self.airbaseName)
|
||||||
for groupName, capGroup in pairs(self.capGroupsByName) do
|
for _, capGroup in pairs(self.capGroupsByName) do
|
||||||
local targetStage = capGroup:GetZoneIDWhenStageID(tostring(self.activeStage))
|
local targetStage = capGroup:GetZoneIDWhenStageID(tostring(self.activeStage))
|
||||||
|
|
||||||
if targetStage ~= nil and capGroup:GetState() == "UnSpawned" then
|
if targetStage ~= nil and capGroup:GetState() == "UnSpawned" then
|
||||||
@@ -135,7 +133,7 @@ function CapBase:SpawnIfApplicable()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for groupName, sweepGroup in pairs(self.sweepGroupsByName) do
|
for _, sweepGroup in pairs(self.sweepGroupsByName) do
|
||||||
local targetStage = sweepGroup:GetZoneIDWhenStageID(tostring(self.activeStage))
|
local targetStage = sweepGroup:GetZoneIDWhenStageID(tostring(self.activeStage))
|
||||||
|
|
||||||
if targetStage ~= nil and sweepGroup:GetState() == "UnSpawned" then
|
if targetStage ~= nil and sweepGroup:GetState() == "UnSpawned" then
|
||||||
@@ -143,7 +141,7 @@ function CapBase:SpawnIfApplicable()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for groupName, interceptGroup in pairs(self.interceptGroupsByName) do
|
for _, interceptGroup in pairs(self.interceptGroupsByName) do
|
||||||
local targetStage = interceptGroup:GetZoneIDWhenStageID(tostring(self.activeStage))
|
local targetStage = interceptGroup:GetZoneIDWhenStageID(tostring(self.activeStage))
|
||||||
|
|
||||||
if targetStage ~= nil and interceptGroup:GetState() == "UnSpawned" then
|
if targetStage ~= nil and interceptGroup:GetState() == "UnSpawned" then
|
||||||
@@ -314,14 +312,12 @@ function CapBase:CheckAndScheduleIntercept()
|
|||||||
|
|
||||||
local interceptZoneIDs = {}
|
local interceptZoneIDs = {}
|
||||||
|
|
||||||
local interceptZoneIDs = {}
|
|
||||||
|
|
||||||
local airbase = Airbase.getByName(self.airbaseName)
|
local airbase = Airbase.getByName(self.airbaseName)
|
||||||
if not airbase then
|
if not airbase then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
for name, group in pairs(self.interceptGroupsByName) do
|
for _, group in pairs(self.interceptGroupsByName) do
|
||||||
local targetZoneID = group:GetZoneIDWhenStageID(tostring(self.activeStage))
|
local targetZoneID = group:GetZoneIDWhenStageID(tostring(self.activeStage))
|
||||||
if targetZoneID then
|
if targetZoneID then
|
||||||
interceptZoneIDs[targetZoneID] = true
|
interceptZoneIDs[targetZoneID] = true
|
||||||
@@ -379,7 +375,6 @@ function CapBase:CheckAndScheduleIntercept()
|
|||||||
if total < required then
|
if total < required then
|
||||||
for _, group in pairs(self.interceptGroupsByName) do
|
for _, group in pairs(self.interceptGroupsByName) do
|
||||||
if total < required then
|
if total < required then
|
||||||
local zoneID = group:GetZoneIDWhenStageID(tostring(self.activeStage))
|
|
||||||
if group:GetState() == "ReadyOnTheRamp" then
|
if group:GetState() == "ReadyOnTheRamp" then
|
||||||
group:SendToInterceptUnits(targets, name, airbase)
|
group:SendToInterceptUnits(targets, name, airbase)
|
||||||
total = total + 1
|
total = total + 1
|
||||||
|
|||||||
@@ -8,19 +8,15 @@ local GlobalCapManager = {}
|
|||||||
do
|
do
|
||||||
local airbasesPerStage = {}
|
local airbasesPerStage = {}
|
||||||
local allAirbasesByName = {}
|
local allAirbasesByName = {}
|
||||||
local activeAirbasesPerActiveStage = {}
|
|
||||||
local unitsPerzonePerStage = {}
|
|
||||||
|
|
||||||
local initiated = false
|
local initiated = false
|
||||||
|
|
||||||
---comment
|
---comment
|
||||||
---@param database Database
|
---@param database Database
|
||||||
---@param capConfig table
|
---@param capConfig table
|
||||||
---@param stageConfig StageConfig
|
|
||||||
---@param detectionManager DetectionManager
|
---@param detectionManager DetectionManager
|
||||||
---@param logLevel LogLevel
|
---@param logLevel LogLevel
|
||||||
---@param spawnManager SpawnManager
|
---@param spawnManager SpawnManager
|
||||||
function GlobalCapManager.start(database, capConfig, detectionManager, stageConfig, logLevel, spawnManager)
|
function GlobalCapManager.start(database, capConfig, detectionManager, logLevel, spawnManager)
|
||||||
if initiated == true then return end
|
if initiated == true then return end
|
||||||
|
|
||||||
local logger = Logger.new("AirbaseManager", logLevel)
|
local logger = Logger.new("AirbaseManager", logLevel)
|
||||||
@@ -29,7 +25,7 @@ do
|
|||||||
|
|
||||||
local zones = database:getStagezoneNames()
|
local zones = database:getStagezoneNames()
|
||||||
if zones then
|
if zones then
|
||||||
for key, stageName in pairs(zones) do
|
for _, stageName in pairs(zones) do
|
||||||
if airbasesPerStage[stageName] == nil then
|
if airbasesPerStage[stageName] == nil then
|
||||||
airbasesPerStage[stageName] = {}
|
airbasesPerStage[stageName] = {}
|
||||||
end
|
end
|
||||||
@@ -40,7 +36,7 @@ do
|
|||||||
if airbaseName then
|
if airbaseName then
|
||||||
local airbaseSpecificLogger = Logger.new("CAP_" .. airbaseName, logLevel)
|
local airbaseSpecificLogger = Logger.new("CAP_" .. airbaseName, logLevel)
|
||||||
|
|
||||||
local airbase = CapAirbase.new(airbaseName, database, airbaseSpecificLogger, capConfig, stageConfig, runwayBombingTracker, detectionManager, spawnManager)
|
local airbase = CapAirbase.new(airbaseName, database, airbaseSpecificLogger, capConfig, runwayBombingTracker, detectionManager, spawnManager)
|
||||||
|
|
||||||
if airbase then
|
if airbase then
|
||||||
table.insert(airbasesPerStage[stageName], airbase)
|
table.insert(airbasesPerStage[stageName], airbase)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
local SpearheadEvents = require("classes.spearhead_events")
|
local SpearheadEvents = require("classes.spearhead_events")
|
||||||
local RTBMission = require("classes.capClasses.taskings.RTB")
|
local RTBMission = require("classes.capClasses.taskings.RTB")
|
||||||
local Util = require("classes.util.Util")
|
local Util = require("classes.util.Util")
|
||||||
local DcsUtil = require("classes.util.DcsUtil")
|
|
||||||
local GlobalConfig = require("classes.configuration.GlobalConfig")
|
local GlobalConfig = require("classes.configuration.GlobalConfig")
|
||||||
local CustomDrawing = require("classes.stageClasses.drawings.CustomDrawing")
|
local CustomDrawing = require("classes.stageClasses.drawings.CustomDrawing")
|
||||||
local DrawingHelper = require("classes.stageClasses.drawings.helper.DrawingHelper")
|
local DrawingHelper = require("classes.stageClasses.drawings.helper.DrawingHelper")
|
||||||
@@ -81,7 +80,7 @@ function AirGroup:SetMission(mission)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local setMissionDelayed = function(data, time)
|
local setMissionDelayed = function(data, _)
|
||||||
data.self:SetMissionPrivate(data.mission)
|
data.self:SetMissionPrivate(data.mission)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -357,7 +356,7 @@ do --- RESPAWN FUNCTIONS
|
|||||||
self:SetState("Dead")
|
self:SetState("Dead")
|
||||||
|
|
||||||
---@param selfA AirGroup
|
---@param selfA AirGroup
|
||||||
local respawnTask = function(selfA, time)
|
local respawnTask = function(selfA, _)
|
||||||
selfA:StartRepair()
|
selfA:StartRepair()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -376,8 +375,7 @@ do --- RESPAWN FUNCTIONS
|
|||||||
end
|
end
|
||||||
|
|
||||||
---comment
|
---comment
|
||||||
---@param selfA AirGroup
|
local rearmTask = function(_, _)
|
||||||
local rearmTask = function(selfA, time)
|
|
||||||
self:StartRearm()
|
self:StartRearm()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -402,7 +400,7 @@ do --- RESPAWN FUNCTIONS
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@param selfA AirGroup
|
---@param selfA AirGroup
|
||||||
local rearmTask = function(selfA, time)
|
local rearmTask = function(selfA, _)
|
||||||
selfA:MarkRearmComplete()
|
selfA:MarkRearmComplete()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -415,6 +413,7 @@ end
|
|||||||
do --EVENT LISTENERS
|
do --EVENT LISTENERS
|
||||||
---@param unit Unit
|
---@param unit Unit
|
||||||
function AirGroup:OnUnitLost(unit)
|
function AirGroup:OnUnitLost(unit)
|
||||||
|
if unit == nil then return end
|
||||||
self:CheckLiveness()
|
self:CheckLiveness()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -434,7 +433,7 @@ do --EVENT LISTENERS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function AirGroup:OnUnitLanded(unit, airbase)
|
function AirGroup:OnUnitLanded(_, _)
|
||||||
local anyInAir = false
|
local anyInAir = false
|
||||||
local group = Group.getByName(self._groupName)
|
local group = Group.getByName(self._groupName)
|
||||||
if group then
|
if group then
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ function CapGroup:InitWithName(groupName)
|
|||||||
|
|
||||||
local subsplit = Util.split_string(configPart, "|")
|
local subsplit = Util.split_string(configPart, "|")
|
||||||
if subsplit then
|
if subsplit then
|
||||||
for key, value in pairs(subsplit) do
|
for _, value in pairs(subsplit) do
|
||||||
local keySplit = Util.split_string(value, "]")
|
local keySplit = Util.split_string(value, "]")
|
||||||
local targetZone = keySplit[2]
|
local targetZone = keySplit[2]
|
||||||
local allActives = string.sub(keySplit[1], 2, #keySplit[1])
|
local allActives = string.sub(keySplit[1], 2, #keySplit[1])
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ function InterceptGroup:InitWithName(groupName)
|
|||||||
configPart = string.sub(configPart, 2, #configPart)
|
configPart = string.sub(configPart, 2, #configPart)
|
||||||
local subsplit = Util.split_string(configPart, "|")
|
local subsplit = Util.split_string(configPart, "|")
|
||||||
if subsplit then
|
if subsplit then
|
||||||
for key, value in pairs(subsplit) do
|
for _, value in pairs(subsplit) do
|
||||||
local keySplit = Util.split_string(value, "]")
|
local keySplit = Util.split_string(value, "]")
|
||||||
local targetZone = keySplit[2]
|
local targetZone = keySplit[2]
|
||||||
local allActives = string.sub(keySplit[1], 2, #keySplit[1])
|
local allActives = string.sub(keySplit[1], 2, #keySplit[1])
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ end
|
|||||||
---@field self SweepGroup
|
---@field self SweepGroup
|
||||||
|
|
||||||
---@param params SetTaskParams
|
---@param params SetTaskParams
|
||||||
local setMissionDelayedTask = function(params, time)
|
local setMissionDelayedTask = function(params, _)
|
||||||
params.self:SetMissionPrivate(params.task)
|
params.self:SetMissionPrivate(params.task)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -50,8 +50,6 @@ function SweepGroup:SendToZone(zone, targetZoneID, airbase)
|
|||||||
|
|
||||||
self._currentTargetZoneID = targetZoneID
|
self._currentTargetZoneID = targetZoneID
|
||||||
|
|
||||||
local group = Group.getByName(self._groupName)
|
|
||||||
|
|
||||||
local mission = SWEEP.getAsMissionFromAirbase(self._groupName, airbase, zone, self._config)
|
local mission = SWEEP.getAsMissionFromAirbase(self._groupName, airbase, zone, self._config)
|
||||||
if mission then
|
if mission then
|
||||||
---@type SetTaskParams
|
---@type SetTaskParams
|
||||||
@@ -82,7 +80,7 @@ function SweepGroup:InitWithName(groupName)
|
|||||||
|
|
||||||
local subsplit = Util.split_string(configPart, "|")
|
local subsplit = Util.split_string(configPart, "|")
|
||||||
if subsplit then
|
if subsplit then
|
||||||
for key, value in pairs(subsplit) do
|
for _, value in pairs(subsplit) do
|
||||||
local keySplit = Util.split_string(value, "]")
|
local keySplit = Util.split_string(value, "]")
|
||||||
local targetZone = keySplit[2]
|
local targetZone = keySplit[2]
|
||||||
local allActives = string.sub(keySplit[1], 2, #keySplit[1])
|
local allActives = string.sub(keySplit[1], 2, #keySplit[1])
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ end
|
|||||||
|
|
||||||
---comment
|
---comment
|
||||||
---@param weapon Weapon
|
---@param weapon Weapon
|
||||||
function RunwayBombingTracker:OnWeaponFired(unit, weapon, target)
|
function RunwayBombingTracker:OnWeaponFired(_, weapon, _)
|
||||||
|
|
||||||
if weapon == nil then
|
if weapon == nil then
|
||||||
return
|
return
|
||||||
@@ -109,7 +109,7 @@ function RunwayBombingTracker:OnWeaponImpact(weaponDesc, impactPoint)
|
|||||||
local warhead = weaponDesc.warhead
|
local warhead = weaponDesc.warhead
|
||||||
local explosiveMass = warhead.explosiveMass or warhead.shapedExplosiveMass
|
local explosiveMass = warhead.explosiveMass or warhead.shapedExplosiveMass
|
||||||
|
|
||||||
for runway, strikeMission in pairs(self.trackedRunways) do
|
for _, strikeMission in pairs(self.trackedRunways) do
|
||||||
|
|
||||||
local zone= strikeMission:GetRunwayZone()
|
local zone= strikeMission:GetRunwayZone()
|
||||||
|
|
||||||
|
|||||||
@@ -33,9 +33,6 @@ local function GetCAPPointFromTriggerZone(airBase, capZone)
|
|||||||
local furthestA = nil
|
local furthestA = nil
|
||||||
local furthestB = nil
|
local furthestB = nil
|
||||||
|
|
||||||
local furthestFromBase = nil
|
|
||||||
local furthestFromBaseDistance = 0
|
|
||||||
|
|
||||||
local furthestDistance = 0
|
local furthestDistance = 0
|
||||||
|
|
||||||
for indexA, pointA in ipairs(capZone.verts) do
|
for indexA, pointA in ipairs(capZone.verts) do
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
local briefingMessageTime = nil
|
|
||||||
|
|
||||||
---@class GlobalConfig
|
---@class GlobalConfig
|
||||||
---@field private _briefingTime number
|
---@field private _briefingTime number
|
||||||
---@field private _debugEnabled boolean
|
---@field private _debugEnabled boolean
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
local Logger = require("classes.util.Logger")
|
local Logger = require("classes.util.Logger")
|
||||||
local Util = require("classes.util.Util")
|
|
||||||
local StageRepository = require("classes.stageClasses.StageRepository")
|
local StageRepository = require("classes.stageClasses.StageRepository")
|
||||||
|
|
||||||
---@class DebugMenu
|
---@class DebugMenu
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ function FleetGroup:new(fleetGroupName, database, logger)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local SetTaskAsync = function(input, time)
|
local SetTaskAsync = function(input, _)
|
||||||
local targetZone = input.targetZone
|
local targetZone = input.targetZone
|
||||||
local task = input.task
|
local task = input.task
|
||||||
local groupName = input.groupName
|
local groupName = input.groupName
|
||||||
|
|||||||
@@ -15,14 +15,13 @@ MizGroupsManager._groupNames = {}
|
|||||||
MizGroupsManager._spawnTemplateData = {}
|
MizGroupsManager._spawnTemplateData = {}
|
||||||
|
|
||||||
do --init
|
do --init
|
||||||
for coalition_name, coalition_data in pairs(env.mission.coalition) do
|
for _, coalition_data in pairs(env.mission.coalition) do
|
||||||
local coalition_nr = DcsUtil.stringToCoalition(coalition_name)
|
|
||||||
if coalition_data.country then
|
if coalition_data.country then
|
||||||
for country_index, country_data in pairs(coalition_data.country) do
|
for _, country_data in pairs(coalition_data.country) do
|
||||||
for category_name, categorydata in pairs(country_data) do
|
for category_name, categorydata in pairs(country_data) do
|
||||||
local category_id = DcsUtil.stringToGroupCategory(category_name)
|
local category_id = DcsUtil.stringToGroupCategory(category_name)
|
||||||
if category_id ~= nil and type(categorydata) == "table" and categorydata.group ~= nil and type(categorydata.group) == "table" then
|
if category_id ~= nil and type(categorydata) == "table" and categorydata.group ~= nil and type(categorydata.group) == "table" then
|
||||||
for group_index, group in pairs(categorydata.group) do
|
for _, group in pairs(categorydata.group) do
|
||||||
local name = group.name
|
local name = group.name
|
||||||
local skippable = false
|
local skippable = false
|
||||||
local isStatic = false
|
local isStatic = false
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ function SpawnManager:SpawnGroup(groupName, overrides, isGroupPersistant)
|
|||||||
if spawnData.isStatic == true then
|
if spawnData.isStatic == true then
|
||||||
return self:SpawnStaticInternal(groupName, spawnData, overrides, isGroupPersistant), true
|
return self:SpawnStaticInternal(groupName, spawnData, overrides, isGroupPersistant), true
|
||||||
else
|
else
|
||||||
return self:SpawnGroupInternal(groupName, spawnData, overrides, isGroupPersistant), false
|
return self:SpawnGroupInternal(spawnData, overrides, isGroupPersistant), false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -103,20 +103,20 @@ function SpawnManager:OnUnitLost(object)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param groupName string
|
||||||
function SpawnManager:SpawnCorpsesOnly(groupName)
|
function SpawnManager:SpawnCorpsesOnly(groupName)
|
||||||
|
if groupName == nil then return end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
do --- privates
|
do --- privates
|
||||||
|
|
||||||
---@private
|
---@private
|
||||||
---@param groupName string
|
|
||||||
---@param spawnData SpawnData
|
---@param spawnData SpawnData
|
||||||
---@param override SpawnOverrides?
|
---@param override SpawnOverrides?
|
||||||
---@param isPersistent boolean?
|
---@param isPersistent boolean?
|
||||||
---@return Group|nil
|
---@return Group|nil
|
||||||
function SpawnManager:SpawnGroupInternal(groupName, spawnData, override, isPersistent)
|
function SpawnManager:SpawnGroupInternal(spawnData, override, isPersistent)
|
||||||
|
|
||||||
if not spawnData then return end
|
if not spawnData then return end
|
||||||
|
|
||||||
local country = spawnData.country
|
local country = spawnData.country
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ do
|
|||||||
logger:info("Wrote persistence data to file")
|
logger:info("Wrote persistence data to file")
|
||||||
end
|
end
|
||||||
|
|
||||||
local UpdateContinuous = function(null, time)
|
local UpdateContinuous = function(_, time)
|
||||||
env.info("[Spearhead][Persistence] Checking up on persistence state...")
|
env.info("[Spearhead][Persistence] Checking up on persistence state...")
|
||||||
if Persistence._updateRequired == true then
|
if Persistence._updateRequired == true then
|
||||||
local status, result = pcall(writeToFile)
|
local status, result = pcall(writeToFile)
|
||||||
@@ -135,7 +135,7 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local warnForNonPersistenceContinous = function(null, time)
|
local warnForNonPersistenceContinous = function(_, time)
|
||||||
trigger.action.outText("Persistence was enabeld, however, io and lfs are not available and no persistence will be done. Make sure to either disable persistence or fix the issues before continuing.", 10)
|
trigger.action.outText("Persistence was enabeld, however, io and lfs are not available and no persistence will be done. Make sure to either disable persistence or fix the issues before continuing.", 10)
|
||||||
return time + 9
|
return time + 9
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ function Database.New(Logger)
|
|||||||
self._logger:debug("Initiating tables")
|
self._logger:debug("Initiating tables")
|
||||||
|
|
||||||
do -- INIT ZONE TABLES
|
do -- INIT ZONE TABLES
|
||||||
for zone_ind, zone_data in pairs(DcsUtil.__trigger_zones) do
|
for _, zone_data in pairs(DcsUtil.__trigger_zones) do
|
||||||
local zone_name = zone_data.name
|
local zone_name = zone_data.name
|
||||||
|
|
||||||
---@type Vec2
|
---@type Vec2
|
||||||
@@ -208,9 +208,9 @@ function Database.New(Logger)
|
|||||||
self._logger:debug("initiated zone tables, continuing with descriptions")
|
self._logger:debug("initiated zone tables, continuing with descriptions")
|
||||||
do --load markers
|
do --load markers
|
||||||
if env.mission.drawings and env.mission.drawings.layers then
|
if env.mission.drawings and env.mission.drawings.layers then
|
||||||
for i, layer in pairs(env.mission.drawings.layers) do
|
for _, layer in pairs(env.mission.drawings.layers) do
|
||||||
if string.lower(layer.name) == "author" then
|
if string.lower(layer.name) == "author" then
|
||||||
for key, layer_object in pairs(layer.objects) do
|
for _, layer_object in pairs(layer.objects) do
|
||||||
if Util.startswith(string.lower(layer_object.name), "buildable", true) == true then
|
if Util.startswith(string.lower(layer_object.name), "buildable", true) == true then
|
||||||
local airbaseData = self:getAirbaseDataForDrawLayer(layer_object)
|
local airbaseData = self:getAirbaseDataForDrawLayer(layer_object)
|
||||||
if airbaseData then
|
if airbaseData then
|
||||||
@@ -228,9 +228,9 @@ function Database.New(Logger)
|
|||||||
---@type table<integer, boolean>
|
---@type table<integer, boolean>
|
||||||
do -- custom drawings
|
do -- custom drawings
|
||||||
if env.mission.drawings and env.mission.drawings.layers then
|
if env.mission.drawings and env.mission.drawings.layers then
|
||||||
for i, layer in pairs(env.mission.drawings.layers) do
|
for _, layer in pairs(env.mission.drawings.layers) do
|
||||||
if string.lower(layer.name) == "author" then
|
if string.lower(layer.name) == "author" then
|
||||||
for key, layer_object in pairs(layer.objects) do
|
for _, layer_object in pairs(layer.objects) do
|
||||||
if Util.startswith(layer_object.name, "drawing_", true) then
|
if Util.startswith(layer_object.name, "drawing_", true) then
|
||||||
local object = layer_object --[[@as DrawingObject]]
|
local object = layer_object --[[@as DrawingObject]]
|
||||||
local stageDrawing = StageDrawing.New(object)
|
local stageDrawing = StageDrawing.New(object)
|
||||||
@@ -256,7 +256,7 @@ function Database.New(Logger)
|
|||||||
|
|
||||||
-- Find and add Briefing
|
-- Find and add Briefing
|
||||||
if env.mission.drawings and env.mission.drawings.layers then
|
if env.mission.drawings and env.mission.drawings.layers then
|
||||||
for i, layer in pairs(env.mission.drawings.layers) do
|
for _, layer in pairs(env.mission.drawings.layers) do
|
||||||
if string.lower(layer.name) == "author" then
|
if string.lower(layer.name) == "author" then
|
||||||
for key, layer_object in pairs(layer.objects) do
|
for key, layer_object in pairs(layer.objects) do
|
||||||
if Util.startswith(string.lower(layer_object.name), "stagebriefing_", true) == true then
|
if Util.startswith(string.lower(layer_object.name), "stagebriefing_", true) == true then
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ function SpearheadGroup:Spawn(lateStart)
|
|||||||
uncontrolled = lateStart,
|
uncontrolled = lateStart,
|
||||||
}
|
}
|
||||||
|
|
||||||
local spawnedObject, isStatic = self._spawnManager:SpawnGroup(self._groupName, overrides, self._isPersistent)
|
local _, isStatic = self._spawnManager:SpawnGroup(self._groupName, overrides, self._isPersistent)
|
||||||
self._isStatic = isStatic
|
self._isStatic = isStatic
|
||||||
self._isSpawned = true
|
self._isSpawned = true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
local DrawingHelper = require("classes.stageClasses.drawings.helper.DrawingHelper")
|
local DrawingHelper = require("classes.stageClasses.drawings.helper.DrawingHelper")
|
||||||
local Util = require("classes.util.Util")
|
|
||||||
local Logger = require("classes.util.Logger")
|
local Logger = require("classes.util.Logger")
|
||||||
local MissionEditorWarnings = require("classes.util.MissionEditorWarnings")
|
|
||||||
local drawingLogger = Logger.new("CustomDrawing")
|
local drawingLogger = Logger.new("CustomDrawing")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
local Util = require("classes.util.Util")
|
|
||||||
local DcsUtil = require("classes.util.DcsUtil")
|
local DcsUtil = require("classes.util.DcsUtil")
|
||||||
local Logger = require("classes.util.Logger")
|
local Logger = require("classes.util.Logger")
|
||||||
local GlobalConfig = require("classes.configuration.GlobalConfig")
|
local GlobalConfig = require("classes.configuration.GlobalConfig")
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
local Logger = require("classes.util.Logger")
|
local Logger = require("classes.util.Logger")
|
||||||
local Util = require("classes.util.Util")
|
local Util = require("classes.util.Util")
|
||||||
local DcsUtil = require("classes.util.DcsUtil")
|
|
||||||
|
|
||||||
---@class BattleManager
|
---@class BattleManager
|
||||||
---@field private _name string
|
---@field private _name string
|
||||||
@@ -13,8 +12,6 @@ local DcsUtil = require("classes.util.DcsUtil")
|
|||||||
local BattleManager = {}
|
local BattleManager = {}
|
||||||
BattleManager.__index = BattleManager
|
BattleManager.__index = BattleManager
|
||||||
|
|
||||||
local debugDrawing = false
|
|
||||||
|
|
||||||
---@param redGroups Array<SpearheadGroup>
|
---@param redGroups Array<SpearheadGroup>
|
||||||
---@param blueGroups Array<SpearheadGroup>
|
---@param blueGroups Array<SpearheadGroup>
|
||||||
---@param name string
|
---@param name string
|
||||||
@@ -90,8 +87,6 @@ function BattleManager:Update()
|
|||||||
|
|
||||||
self._logger:debug("BattleManager Update called for " .. self._name)
|
self._logger:debug("BattleManager Update called for " .. self._name)
|
||||||
|
|
||||||
local shootChance = 1 -- Adjust this value to control the shooting probability (0.0 to 1.0)
|
|
||||||
|
|
||||||
self:LetUnitsShoot(self._redGroups, self._blueGroups)
|
self:LetUnitsShoot(self._redGroups, self._blueGroups)
|
||||||
self:LetUnitsShoot(self._blueGroups, self._redGroups)
|
self:LetUnitsShoot(self._blueGroups, self._redGroups)
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ local function sortMissions(list, groupPos)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
local id = 0
|
|
||||||
|
|
||||||
local instance = nil
|
local instance = nil
|
||||||
|
|
||||||
---@return MissionCommandsHelper
|
---@return MissionCommandsHelper
|
||||||
@@ -57,16 +55,16 @@ function MissionCommandsHelper.getOrCreate()
|
|||||||
|
|
||||||
instance._supplyUnitsTracker:AddOnSupplyUnitEventListener(
|
instance._supplyUnitsTracker:AddOnSupplyUnitEventListener(
|
||||||
{
|
{
|
||||||
enteredSupplyHub = function(self, unit)
|
enteredSupplyHub = function(_, unit)
|
||||||
if unit == nil then return end
|
if unit == nil then return end
|
||||||
instance.updateNeeded = true
|
instance.updateNeeded = true
|
||||||
instance:updateCommandsForGroup(unit:getGroup():getID())
|
instance:updateCommandsForGroup(unit:getGroup():getID())
|
||||||
end,
|
end,
|
||||||
exitedSupplyHub = function(self, unit)
|
exitedSupplyHub = function(_, unit)
|
||||||
instance.updateNeeded = true
|
instance.updateNeeded = true
|
||||||
instance:updateCommandsForGroup(unit:getGroup():getID())
|
instance:updateCommandsForGroup(unit:getGroup():getID())
|
||||||
end,
|
end,
|
||||||
supplyUnitSpawned = function(self, unit)
|
supplyUnitSpawned = function(_, unit)
|
||||||
instance.updateNeeded = true
|
instance.updateNeeded = true
|
||||||
instance:updateCommandsForGroup(unit:getGroup():getID())
|
instance:updateCommandsForGroup(unit:getGroup():getID())
|
||||||
end
|
end
|
||||||
@@ -509,7 +507,6 @@ function MissionCommandsHelper:AddCargoCommands(groupID)
|
|||||||
local unloadCargoCommand = function(params)
|
local unloadCargoCommand = function(params)
|
||||||
local unitID = params.unitID
|
local unitID = params.unitID
|
||||||
local crateType = params.crateType
|
local crateType = params.crateType
|
||||||
local supplyUnitsTracker = params.supplyUnitsTracker
|
|
||||||
params.supplyUnitsTracker:UnloadRequested(unitID, crateType, params.commandHelper)
|
params.supplyUnitsTracker:UnloadRequested(unitID, crateType, params.commandHelper)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -518,7 +515,7 @@ function MissionCommandsHelper:AddCargoCommands(groupID)
|
|||||||
for cargoType, amount in pairs(cargo) do
|
for cargoType, amount in pairs(cargo) do
|
||||||
local cargoConfig = SupplyConfigHelper.getSupplyConfig(cargoType)
|
local cargoConfig = SupplyConfigHelper.getSupplyConfig(cargoType)
|
||||||
if cargoConfig then
|
if cargoConfig then
|
||||||
for i = 1, amount do
|
for _ = 1, amount do
|
||||||
local path = { [1] = folderNames.cargo }
|
local path = { [1] = folderNames.cargo }
|
||||||
---@type UnloadCargoCommandParams
|
---@type UnloadCargoCommandParams
|
||||||
local params = { unitID = unit:getID(), crateType = cargoType, supplyUnitsTracker = self
|
local params = { unitID = unit:getID(), crateType = cargoType, supplyUnitsTracker = self
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ function SupplyUnitsTracker:RemoveCargoFromUnit(unitID, crateType)
|
|||||||
self._cargoInUnits[unitIDStr][crateType] = self._cargoInUnits[unitIDStr][crateType] - 1
|
self._cargoInUnits[unitIDStr][crateType] = self._cargoInUnits[unitIDStr][crateType] - 1
|
||||||
|
|
||||||
local hasCargo = false
|
local hasCargo = false
|
||||||
for type, count in pairs(self._cargoInUnits[unitIDStr]) do
|
for _, count in pairs(self._cargoInUnits[unitIDStr]) do
|
||||||
if count > 0 then
|
if count > 0 then
|
||||||
hasCargo = true
|
hasCargo = true
|
||||||
break
|
break
|
||||||
@@ -216,13 +216,11 @@ end
|
|||||||
|
|
||||||
function SupplyUnitsTracker:CheckUnitsInZones()
|
function SupplyUnitsTracker:CheckUnitsInZones()
|
||||||
|
|
||||||
for name, unit in pairs(self._supplyUnitsByName) do
|
for _, unit in pairs(self._supplyUnitsByName) do
|
||||||
if unit ~= nil and unit:isExist() == true then
|
if unit ~= nil and unit:isExist() == true then
|
||||||
self._logger:debug("Checking unit: " .. unit:getName())
|
self._logger:debug("Checking unit: " .. unit:getName())
|
||||||
local pos = unit:getPoint()
|
local pos = unit:getPoint()
|
||||||
|
|
||||||
local group = unit:getGroup()
|
|
||||||
|
|
||||||
for hub, enabled in pairs(self._registeredHubs) do
|
for hub, enabled in pairs(self._registeredHubs) do
|
||||||
if enabled == true then
|
if enabled == true then
|
||||||
local zone = hub:GetZone()
|
local zone = hub:GetZone()
|
||||||
@@ -614,7 +612,7 @@ function SupplyUnitsTracker:GetCargoPlacePosition(unit, crateTypeName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
local occupiedObjects = {}
|
local occupiedObjects = {}
|
||||||
local found = function(foundItem, val)
|
local found = function(foundItem, _)
|
||||||
local bbox = self:GetBoundingBoxes(foundItem)
|
local bbox = self:GetBoundingBoxes(foundItem)
|
||||||
if bbox then
|
if bbox then
|
||||||
self._logger:debug("Found object: " .. foundItem:getTypeName() .. " at (" .. foundItem:getPoint().x .. ", " .. foundItem:getPoint().z .. ")")
|
self._logger:debug("Found object: " .. foundItem:getTypeName() .. " at (" .. foundItem:getPoint().x .. ", " .. foundItem:getPoint().z .. ")")
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ function Mission:SpawnActive() end
|
|||||||
---comment
|
---comment
|
||||||
---@param checkHealth boolean
|
---@param checkHealth boolean
|
||||||
---@param messageIfDone boolean
|
---@param messageIfDone boolean
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
function Mission:UpdateState(checkHealth, messageIfDone) end
|
function Mission:UpdateState(checkHealth, messageIfDone) end
|
||||||
function Mission:StartCheckingContinuous() end
|
function Mission:StartCheckingContinuous() end
|
||||||
|
|
||||||
@@ -120,7 +121,7 @@ function Mission:NotifyMissionComplete()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
local succ, err = pcall(function()
|
local _, _ = pcall(function()
|
||||||
SpearheadAPI.Internal.notifyMissionComplete(self.zoneName)
|
SpearheadAPI.Internal.notifyMissionComplete(self.zoneName)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -131,6 +132,8 @@ function Mission:ForceMissionComplete()
|
|||||||
self:NotifyMissionComplete()
|
self:NotifyMissionComplete()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param groupId number
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
function Mission:MarkMissionAreaToGroup(groupId) end
|
function Mission:MarkMissionAreaToGroup(groupId) end
|
||||||
|
|
||||||
---endregion
|
---endregion
|
||||||
|
|||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
--Single player purpose
|
--Single player purpose
|
||||||
|
|
||||||
local Logger = require("classes.util.Logger")
|
local Logger = require("classes.util.Logger")
|
||||||
local DcsUtil = require("classes.util.DcsUtil")
|
|
||||||
local Database = require("classes.spearhead_db")
|
local Database = require("classes.spearhead_db")
|
||||||
local SpearheadEvents = require("classes.spearhead_events")
|
local SpearheadEvents = require("classes.spearhead_events")
|
||||||
local MissionCommandsHelper = require("classes.stageClasses.helpers.MissionCommandsHelper")
|
local MissionCommandsHelper = require("classes.stageClasses.helpers.MissionCommandsHelper")
|
||||||
@@ -47,7 +46,7 @@ local spawnManager = SpawnManager.new(spawnLogger)
|
|||||||
local detectionLogger = Logger.new("DetectionManager", defaultLogLevel)
|
local detectionLogger = Logger.new("DetectionManager", defaultLogLevel)
|
||||||
local detectionManager = DetectionManager.New(detectionLogger)
|
local detectionManager = DetectionManager.New(detectionLogger)
|
||||||
|
|
||||||
GlobalCapManager.start(databaseManager, capConfig, detectionManager, stageConfig, defaultLogLevel, spawnManager)
|
GlobalCapManager.start(databaseManager, capConfig, detectionManager, defaultLogLevel, spawnManager)
|
||||||
local globalStageManager = GlobalStageManager.new(databaseManager, stageConfig, defaultLogLevel, spawnManager)
|
local globalStageManager = GlobalStageManager.new(databaseManager, stageConfig, defaultLogLevel, spawnManager)
|
||||||
GlobalFleetManager.start(databaseManager)
|
GlobalFleetManager.start(databaseManager)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user