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