Fix/v5.0 (#46)
* fixed for static train carts having no category? * fixed issues with v5.0.0 --------- Co-authored-by: dutchie032 <dutchie032>
This commit is contained in:
committed by
GitHub
co-authored by
dutchie032 <dutchie032>
parent
d6178bcdd7
commit
ab8d667504
Binary file not shown.
@@ -34,6 +34,23 @@ do -- INIT UTIL
|
|||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param orig table
|
||||||
|
---@return table copy
|
||||||
|
function UTIL.copyTable(orig)
|
||||||
|
local orig_type = type(orig)
|
||||||
|
local copy
|
||||||
|
if orig_type == 'table' then
|
||||||
|
copy = {}
|
||||||
|
for orig_key, orig_value in next, orig, nil do
|
||||||
|
copy[UTIL.copyTable(orig_key)] = UTIL.copyTable(orig_value)
|
||||||
|
end
|
||||||
|
setmetatable(copy, UTIL.copyTable(getmetatable(orig)))
|
||||||
|
else -- number, string, boolean, etc
|
||||||
|
copy = orig
|
||||||
|
end
|
||||||
|
return copy
|
||||||
|
end
|
||||||
|
|
||||||
---Gets a random from the list
|
---Gets a random from the list
|
||||||
---@param list Array
|
---@param list Array
|
||||||
---@return any @random element from the list
|
---@return any @random element from the list
|
||||||
@@ -900,6 +917,17 @@ do -- INIT DCS_UTIL
|
|||||||
return nil;
|
return nil;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@type table<string, CoordType>
|
||||||
|
local config =
|
||||||
|
{
|
||||||
|
["ah-64d_blk_ii"] = "MGRS",
|
||||||
|
["fa-18c_hornet"] = "DMS",
|
||||||
|
["av8bna"] = "DMS",
|
||||||
|
["f-14b"] = "DMS",
|
||||||
|
["f-14a-135-gr"] = "DMS"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
---@param location Vec2
|
---@param location Vec2
|
||||||
---@param unitType string
|
---@param unitType string
|
||||||
function DCS_UTIL.convertVec2ToUnitUsableType(location, unitType)
|
function DCS_UTIL.convertVec2ToUnitUsableType(location, unitType)
|
||||||
@@ -907,17 +935,19 @@ do -- INIT DCS_UTIL
|
|||||||
local height = land.getHeight(location)
|
local height = land.getHeight(location)
|
||||||
local vec3 = { x = location.x, y = height, z = location.y }
|
local vec3 = { x = location.x, y = height, z = location.y }
|
||||||
|
|
||||||
if unitType == "AH-64D_BLK_II" then
|
local unitType = string.lower(unitType or "")
|
||||||
return DCS_UTIL.convertToDisplayCoord(vec3, "MGRS")
|
local conversionType = config[unitType]
|
||||||
end
|
|
||||||
|
|
||||||
return DCS_UTIL.convertToDisplayCoord(vec3, "DDM")
|
if not conversionType then conversionType = "DDM" end
|
||||||
|
return DCS_UTIL.convertToDisplayCoord(vec3, conversionType)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@alias CoordType
|
---@alias CoordType
|
||||||
---| "MGRS"
|
---| "MGRS" MGRS
|
||||||
---| "DDM"
|
---| "DMS" DECIMAL SECONDS
|
||||||
|
---| "DDM" DECIMAL MINUTES
|
||||||
|
|
||||||
|
---@private
|
||||||
---@param location Vec3
|
---@param location Vec3
|
||||||
---@param coordType CoordType
|
---@param coordType CoordType
|
||||||
function DCS_UTIL.convertToDisplayCoord(location, coordType)
|
function DCS_UTIL.convertToDisplayCoord(location, coordType)
|
||||||
@@ -942,12 +972,29 @@ do -- INIT DCS_UTIL
|
|||||||
local lat_hemisphere = lattitude >= 0 and "N" or "S"
|
local lat_hemisphere = lattitude >= 0 and "N" or "S"
|
||||||
local lon_hemisphere = longitude >= 0 and "E" or "W"
|
local lon_hemisphere = longitude >= 0 and "E" or "W"
|
||||||
|
|
||||||
return string.format("%d° %.3f' %s %d° %.3f' %s %d ft",
|
if coordType == "DDM" then
|
||||||
math.abs(lat_deg), lat_min, lat_hemisphere,
|
return string.format("%s%02d°%06.3f' %s%03d°%06.3f' %dft",
|
||||||
math.abs(lon_deg), lon_min, lon_hemisphere,
|
lat_hemisphere, math.abs(lat_deg), lat_min,
|
||||||
|
lon_hemisphere, math.abs(lon_deg), lon_min,
|
||||||
altitude * 3,28084)
|
altitude * 3,28084)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if coordType == "DMS" then
|
||||||
|
|
||||||
|
local lat_min_display = math.floor(lat_min)
|
||||||
|
local lon_min_display = math.floor(lon_min)
|
||||||
|
|
||||||
|
local lat_sec_display = math.floor((lat_min - lat_min_display) * 60)
|
||||||
|
local lon_sec_display = math.floor((lon_min - lon_min_display) * 60)
|
||||||
|
|
||||||
|
return string.format("%s%02d°%02d'%02d %s%03d°%02d'%02d %dft",
|
||||||
|
lat_hemisphere, math.abs(lat_deg), lat_min_display, lat_sec_display,
|
||||||
|
lon_hemisphere, math.abs(lon_deg), lon_min_display, lon_sec_display,
|
||||||
|
altitude * 3,28084)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
---@param group Group
|
---@param group Group
|
||||||
function DCS_UTIL.getUnitTypeFromGroup(group)
|
function DCS_UTIL.getUnitTypeFromGroup(group)
|
||||||
for _, unit in pairs(group:getUnits()) do
|
for _, unit in pairs(group:getUnits()) do
|
||||||
|
|||||||
@@ -217,15 +217,17 @@ GlobalStageManager.printFullOverview = function ()
|
|||||||
local totalbai = 0
|
local totalbai = 0
|
||||||
local totaldead = 0
|
local totaldead = 0
|
||||||
local totalMissions = 0
|
local totalMissions = 0
|
||||||
|
local totalCas = 0
|
||||||
|
|
||||||
for _, stage in pairs(stages) do
|
for _, stage in pairs(stages) do
|
||||||
|
|
||||||
local strike, dead, bai = stage:GetStageStats()
|
local strike, dead, bai, cas = stage:GetStageStats()
|
||||||
|
|
||||||
totalStrike = totalStrike + strike
|
totalStrike = totalStrike + strike
|
||||||
totalbai = totalbai + bai
|
totalbai = totalbai + bai
|
||||||
totaldead = totaldead + dead
|
totaldead = totaldead + dead
|
||||||
totalMissions = totalMissions + strike + dead + bai
|
totalCas = totalCas + cas
|
||||||
|
totalMissions = totalMissions + strike + dead + bai + cas
|
||||||
end
|
end
|
||||||
|
|
||||||
local index = tonumber(stageIndex)
|
local index = tonumber(stageIndex)
|
||||||
@@ -233,7 +235,7 @@ GlobalStageManager.printFullOverview = function ()
|
|||||||
if index > max then
|
if index > max then
|
||||||
max = index
|
max = index
|
||||||
end
|
end
|
||||||
lines[index] ="Stage# " .. tostring(stageIndex).. " | " .. totalStrike .. " strikes | " .. totaldead .. " dead | " .. totalbai .. " BAI | Total:" .. totalMissions
|
lines[index] ="Stage# " .. tostring(stageIndex).. " | " .. totalStrike .. " strikes | " .. totaldead .. " dead | " .. totalbai .. " BAI | " .. totalCas .. " CAS | Total:" .. totalMissions
|
||||||
else
|
else
|
||||||
logger:warn("Stage index is not a number: " .. stageIndex)
|
logger:warn("Stage index is not a number: " .. stageIndex)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -503,19 +503,23 @@ end
|
|||||||
---@return number strike
|
---@return number strike
|
||||||
---@return number dead
|
---@return number dead
|
||||||
---@return number bai
|
---@return number bai
|
||||||
|
---@return number cas
|
||||||
function Stage:GetStageStats()
|
function Stage:GetStageStats()
|
||||||
|
|
||||||
local strike = 0
|
local strike = 0
|
||||||
local dead = 0
|
local dead = 0
|
||||||
local bai = 0
|
local bai = 0
|
||||||
|
local cas = 0
|
||||||
|
|
||||||
for _, mission in pairs(self._db.missions) do
|
for _, mission in pairs(self._db.missions) do
|
||||||
if mission.missionType == "STRIKE" then
|
if mission.missionType == "STRIKE" then
|
||||||
strike = strike + 1
|
strike = strike + 1
|
||||||
elseif mission.missionType == "DEAD" then
|
elseif mission.missionType == "DEAD" or mission.missionType == "SAM" then
|
||||||
dead = dead + 1
|
dead = dead + 1
|
||||||
elseif mission.missionType == "BAI" then
|
elseif mission.missionType == "BAI" then
|
||||||
bai = bai + 1
|
bai = bai + 1
|
||||||
|
elseif mission.missionType == "CAS" then
|
||||||
|
cas = cas + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -523,7 +527,7 @@ function Stage:GetStageStats()
|
|||||||
dead = dead + 1
|
dead = dead + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
return strike, dead, bai
|
return strike, dead, bai, cas
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -245,14 +245,7 @@ function MissionCommandsHelper:updateCommandsForGroup(groupID)
|
|||||||
|
|
||||||
self:ResetFolders(groupID)
|
self:ResetFolders(groupID)
|
||||||
|
|
||||||
for code, enabled in pairs(self.enabledByCode) do
|
self:AddAllMissionCommandsToGroup(groupID)
|
||||||
if enabled == true then
|
|
||||||
local mission = self.missionsByCode[code]
|
|
||||||
if mission then
|
|
||||||
self:addMissionCommands(groupID, mission)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self:AddSupplyHubCommandsIfApplicable(groupID)
|
self:AddSupplyHubCommandsIfApplicable(groupID)
|
||||||
self:AddCargoCommands(groupID)
|
self:AddCargoCommands(groupID)
|
||||||
@@ -283,18 +276,60 @@ function MissionCommandsHelper:PinMission(mission, groupID)
|
|||||||
self:updateCommandsForGroup(groupID)
|
self:updateCommandsForGroup(groupID)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function MissionCommandsHelper:AddAllMissionCommandsToGroup(groupID)
|
||||||
|
|
||||||
|
local perFolder = 9
|
||||||
|
|
||||||
|
do --- primary missions
|
||||||
|
local count = 0
|
||||||
|
local path = { [1] = folderNames.primary }
|
||||||
|
for code, enabled in pairs(self.enabledByCode) do
|
||||||
|
if enabled == true then
|
||||||
|
local mission = self.missionsByCode[code]
|
||||||
|
if mission and mission.priority == "primary" then
|
||||||
|
count = count + 1
|
||||||
|
if count <= perFolder then
|
||||||
|
local copied = Spearhead.Util.copyTable(path)
|
||||||
|
self:addMissionCommands(groupID, copied, mission)
|
||||||
|
else
|
||||||
|
local name = "Next Menu ..."
|
||||||
|
missionCommands.addSubMenuForGroup(groupID, name, path)
|
||||||
|
path[#path+1] = name
|
||||||
|
count = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
do --- secondary missions
|
||||||
|
local count = 0
|
||||||
|
local path = { [1] = folderNames.secondary }
|
||||||
|
for code, enabled in pairs(self.enabledByCode) do
|
||||||
|
if enabled == true then
|
||||||
|
local mission = self.missionsByCode[code]
|
||||||
|
if mission and mission.priority == "secondary" then
|
||||||
|
count = count + 1
|
||||||
|
if count <= perFolder then
|
||||||
|
local copied = Spearhead.Util.copyTable(path)
|
||||||
|
self:addMissionCommands(groupID, copied, mission)
|
||||||
|
else
|
||||||
|
local name = "Next Menu ..."
|
||||||
|
missionCommands.addSubMenuForGroup(groupID, name, path)
|
||||||
|
path[#path+1] = "more missions ..."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
---comment
|
---comment
|
||||||
---@private
|
---@private
|
||||||
---@param groupId integer
|
---@param groupId integer
|
||||||
|
---@param path Array<string>
|
||||||
---@param mission Mission
|
---@param mission Mission
|
||||||
function MissionCommandsHelper:addMissionCommands(groupId, mission)
|
function MissionCommandsHelper:addMissionCommands(groupId, path, mission)
|
||||||
local path = nil
|
|
||||||
|
|
||||||
if mission.priority == "primary" then
|
|
||||||
path = { [1] = folderNames.primary }
|
|
||||||
elseif mission.priority == "secondary" then
|
|
||||||
path = { [1] = folderNames.secondary }
|
|
||||||
end
|
|
||||||
|
|
||||||
if path then
|
if path then
|
||||||
local missionFolderName = "[" .. mission.code .. "]" .. mission.name
|
local missionFolderName = "[" .. mission.code .. "]" .. mission.name
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ env.info("Spearhead SupplyUnitsTracker loaded")
|
|||||||
---@field private _commandsHelper MissionCommandsHelper
|
---@field private _commandsHelper MissionCommandsHelper
|
||||||
---@field private _droppedCrates table<string, StaticObject>
|
---@field private _droppedCrates table<string, StaticObject>
|
||||||
---@field private _registeredHubs table<SupplyHub, boolean>
|
---@field private _registeredHubs table<SupplyHub, boolean>
|
||||||
|
---@field private _supplyUnitSpawnedListener Array<SupplyUnitSpawnedListener>
|
||||||
local SupplyUnitsTracker = {}
|
local SupplyUnitsTracker = {}
|
||||||
SupplyUnitsTracker.__index = SupplyUnitsTracker
|
SupplyUnitsTracker.__index = SupplyUnitsTracker
|
||||||
|
|
||||||
@@ -67,7 +68,30 @@ function SupplyUnitsTracker:OnPlayerEntersUnit(unit)
|
|||||||
|
|
||||||
if self:IsSupplyUnit(unit) == true then
|
if self:IsSupplyUnit(unit) == true then
|
||||||
self._supplyUnitsByName[unit:getName()] = unit
|
self._supplyUnitsByName[unit:getName()] = unit
|
||||||
|
self._cargoInUnits[tostring(unit:getID())] = nil
|
||||||
|
self._unitPositions[tostring(unit:getID())] = unit:getPoint()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for _, listener in pairs(self._supplyUnitSpawnedListener) do
|
||||||
|
pcall(function()
|
||||||
|
listener:SupplyUnitSpawned(unit)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
---@class SupplyUnitSpawnedListener
|
||||||
|
---@field SupplyUnitSpawned fun(self:SupplyUnitSpawnedListener, unit:Unit)
|
||||||
|
|
||||||
|
---@param listener SupplyUnitSpawnedListener
|
||||||
|
function SupplyUnitsTracker:AddOnSupplyUnitSpawnedListener(listener)
|
||||||
|
if listener == nil then return end
|
||||||
|
|
||||||
|
if self._supplyUnitSpawnedListener == nil then
|
||||||
|
self._supplyUnitSpawnedListener = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(self._supplyUnitSpawnedListener, listener)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SupplyUnitsTracker:Update()
|
function SupplyUnitsTracker:Update()
|
||||||
@@ -143,6 +167,20 @@ function SupplyUnitsTracker:RemoveCargoFromUnit(unitID, crateType)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function SupplyUnitsTracker:UpdateWeightForUnit(unitID)
|
||||||
|
|
||||||
|
local weight = 0
|
||||||
|
if self._cargoInUnits[tostring(unitID)] then
|
||||||
|
for crateType, count in pairs(self._cargoInUnits[tostring(unitID)]) do
|
||||||
|
local crateConfig = Spearhead.classes.stageClasses.helpers.supplies.SupplyConfigHelper.getSupplyConfig(crateType)
|
||||||
|
if crateConfig and count then
|
||||||
|
weight = weight + (crateConfig.weight * count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
trigger.action.setUnitInternalCargo(unitID, weight)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function SupplyUnitsTracker:CheckUnitsInZones()
|
function SupplyUnitsTracker:CheckUnitsInZones()
|
||||||
|
|
||||||
@@ -209,6 +247,7 @@ function SupplyUnitsTracker:UnloadRequested(unitID, crateType)
|
|||||||
end
|
end
|
||||||
|
|
||||||
self:RemoveCargoFromUnit(unitID, crateType)
|
self:RemoveCargoFromUnit(unitID, crateType)
|
||||||
|
self:UpdateWeightForUnit(unitID)
|
||||||
|
|
||||||
local cargoConfig = Spearhead.classes.stageClasses.helpers.supplies.SupplyConfigHelper.getSupplyConfig(crateType)
|
local cargoConfig = Spearhead.classes.stageClasses.helpers.supplies.SupplyConfigHelper.getSupplyConfig(crateType)
|
||||||
|
|
||||||
@@ -228,7 +267,6 @@ function SupplyUnitsTracker:UnloadRequested(unitID, crateType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
local spawned = coalition.addStaticObject(unit:getCoalition(), cargoSpawnObject)
|
local spawned = coalition.addStaticObject(unit:getCoalition(), cargoSpawnObject)
|
||||||
|
|
||||||
self._droppedCrates[cargoSpawnObject.name] = spawned
|
self._droppedCrates[cargoSpawnObject.name] = spawned
|
||||||
self._commandsHelper:updateCommandsForGroup(group:getID())
|
self._commandsHelper:updateCommandsForGroup(group:getID())
|
||||||
end
|
end
|
||||||
@@ -303,7 +341,7 @@ function SupplyUnitsTracker:TryLoadCrateInUnit(unit, crateType)
|
|||||||
|
|
||||||
local crateConfigA = Spearhead.classes.stageClasses.helpers.supplies.SupplyConfigHelper.getSupplyConfig(crateType)
|
local crateConfigA = Spearhead.classes.stageClasses.helpers.supplies.SupplyConfigHelper.getSupplyConfig(crateType)
|
||||||
if crateConfigA == nil then
|
if crateConfigA == nil then
|
||||||
trigger.action.outText("Invalid crate type: " .. crateType, 5)
|
trigger.action.outTextForUnit(unit:getID(), "Invalid crate type: " .. crateType, 5)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -316,19 +354,19 @@ function SupplyUnitsTracker:TryLoadCrateInUnit(unit, crateType)
|
|||||||
|
|
||||||
local unitConfig = Spearhead.classes.stageClasses.helpers.supplies.MaxLoadConfig[unit:getTypeName()]
|
local unitConfig = Spearhead.classes.stageClasses.helpers.supplies.MaxLoadConfig[unit:getTypeName()]
|
||||||
if unitConfig == nil then
|
if unitConfig == nil then
|
||||||
trigger.action.outText("Your unit type is not configured for logistics: " .. crateType, 5)
|
trigger.action.outTextForUnit(unit:getID(), "Your unit type is not configured for logistics: " .. crateType, 5)
|
||||||
self._logger:error("Invalid unit type: " .. unit:getTypeName())
|
self._logger:error("Invalid unit type: " .. unit:getTypeName())
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
local maxWeight = unitConfig.maxInternalLoad
|
local maxWeight = unitConfig.maxInternalLoad
|
||||||
|
|
||||||
if currentWeight + crateConfigA.weight > maxWeight then
|
if currentWeight + crateConfigA.weight > maxWeight then
|
||||||
trigger.action.outText("Failed to load crate due to it overloading your max weight of: " .. maxWeight .. "kg", 5)
|
trigger.action.outTextForUnit(unit:getID(), "Failed to load crate due to it overloading your max weight of: " .. maxWeight .. "kg", 5)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
trigger.action.setUnitInternalCargo(unit:getName(), crateConfigA.weight)
|
|
||||||
self:AddCargoToUnit(unit:getID(), crateType)
|
self:AddCargoToUnit(unit:getID(), crateType)
|
||||||
|
self:UpdateWeightForUnit(unit:getID())
|
||||||
|
|
||||||
local group = unit:getGroup()
|
local group = unit:getGroup()
|
||||||
if group == nil then return false end
|
if group == nil then return false end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
---@class BuildableMission : Mission
|
---@class BuildableMission : Mission, SupplyUnitSpawnedListener
|
||||||
---@field private _requiredKilos number
|
---@field private _requiredKilos number
|
||||||
---@field private _droppedKilos number
|
---@field private _droppedKilos number
|
||||||
---@field private _crateType SupplyType
|
---@field private _crateType SupplyType
|
||||||
@@ -124,6 +124,10 @@ end
|
|||||||
|
|
||||||
function BuildableMission:MarkMissionAreaToGroup(groupID)
|
function BuildableMission:MarkMissionAreaToGroup(groupID)
|
||||||
|
|
||||||
|
if self._markIDsPerGroup[groupID] then
|
||||||
|
Spearhead.DcsUtil.RemoveMark(self._markIDsPerGroup[groupID])
|
||||||
|
end
|
||||||
|
|
||||||
local text = "[" .. self.code .. "] " .. self.name
|
local text = "[" .. self.code .. "] " .. self.name
|
||||||
local location = { x= self.location.x, y=land.getHeight(self.location), z=self.location.y }
|
local location = { x= self.location.x, y=land.getHeight(self.location), z=self.location.y }
|
||||||
local markID = Spearhead.DcsUtil.AddMarkToGroup(groupID, text, location)
|
local markID = Spearhead.DcsUtil.AddMarkToGroup(groupID, text, location)
|
||||||
@@ -188,13 +192,37 @@ function BuildableMission:SpawnActive()
|
|||||||
self._state = "ACTIVE"
|
self._state = "ACTIVE"
|
||||||
|
|
||||||
self._missionCommandsHelper:AddMissionToCommands(self)
|
self._missionCommandsHelper:AddMissionToCommands(self)
|
||||||
|
self._supplyUnitsTracker:AddOnSupplyUnitSpawnedListener(self)
|
||||||
|
|
||||||
|
local units = self._supplyUnitsTracker:GetUnits()
|
||||||
|
if units then
|
||||||
|
for _, unit in pairs(units) do
|
||||||
|
if unit and unit:isExist() then
|
||||||
|
local group = unit:getGroup()
|
||||||
|
if group then
|
||||||
|
self:MarkMissionAreaToGroup(group:getID())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BuildableMission:SpawnForwardUnits()
|
function BuildableMission:SpawnForwardUnits()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param unit Unit
|
||||||
|
function BuildableMission:SupplyUnitSpawned(unit)
|
||||||
|
|
||||||
|
if self._state ~= "ACTIVE" then return end
|
||||||
|
|
||||||
|
local group = unit:getGroup()
|
||||||
|
if group == nil then return end
|
||||||
|
|
||||||
|
self:MarkMissionAreaToGroup(unit:getGroup():getID())
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function BuildableMission:CheckCratesInZone()
|
function BuildableMission:CheckCratesInZone()
|
||||||
|
|
||||||
---@type Array<Object>
|
---@type Array<Object>
|
||||||
@@ -227,6 +255,15 @@ function BuildableMission:CheckCratesInZone()
|
|||||||
self._state = "COMPLETED"
|
self._state = "COMPLETED"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self._state == "COMPLETED" then
|
||||||
|
for groupID, markID in pairs(self._markIDsPerGroup) do
|
||||||
|
if markID then
|
||||||
|
Spearhead.DcsUtil.RemoveMark(markID)
|
||||||
|
self._markIDsPerGroup[groupID] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ function ZoneMission:UpdateState(checkHealth, messageIfDone)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self._state == "COMPLETED" and self._lastContactMarkerID then
|
if self._state == "COMPLETED" and self._lastContactMarkerID then
|
||||||
Spearhead.DcsUtil.RemoveMarker(self._lastContactMarkerID)
|
Spearhead.DcsUtil.RemoveMark(self._lastContactMarkerID)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self._state == "COMPLETED" and self._battleManager then
|
if self._state == "COMPLETED" and self._battleManager then
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ SpearheadConfig = {
|
|||||||
autoStages = true, --default true
|
autoStages = true, --default true
|
||||||
|
|
||||||
--Maximum missions per stage (includes all types of missions)
|
--Maximum missions per stage (includes all types of missions)
|
||||||
maxMissionStage = 10,
|
maxMissionStage = 100,
|
||||||
|
|
||||||
--Stage starting number
|
--Stage starting number
|
||||||
startingStage = 1,
|
startingStage = 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user