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
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
---@class BuildableMission : Mission
|
||||
---@class BuildableMission : Mission, SupplyUnitSpawnedListener
|
||||
---@field private _requiredKilos number
|
||||
---@field private _droppedKilos number
|
||||
---@field private _crateType SupplyType
|
||||
@@ -124,6 +124,10 @@ end
|
||||
|
||||
function BuildableMission:MarkMissionAreaToGroup(groupID)
|
||||
|
||||
if self._markIDsPerGroup[groupID] then
|
||||
Spearhead.DcsUtil.RemoveMark(self._markIDsPerGroup[groupID])
|
||||
end
|
||||
|
||||
local text = "[" .. self.code .. "] " .. self.name
|
||||
local location = { x= self.location.x, y=land.getHeight(self.location), z=self.location.y }
|
||||
local markID = Spearhead.DcsUtil.AddMarkToGroup(groupID, text, location)
|
||||
@@ -188,13 +192,37 @@ function BuildableMission:SpawnActive()
|
||||
self._state = "ACTIVE"
|
||||
|
||||
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
|
||||
|
||||
function BuildableMission:SpawnForwardUnits()
|
||||
|
||||
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()
|
||||
|
||||
---@type Array<Object>
|
||||
@@ -226,6 +254,15 @@ function BuildableMission:CheckCratesInZone()
|
||||
self:NotifyMissionComplete()
|
||||
self._state = "COMPLETED"
|
||||
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
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ function ZoneMission:UpdateState(checkHealth, messageIfDone)
|
||||
end
|
||||
|
||||
if self._state == "COMPLETED" and self._lastContactMarkerID then
|
||||
Spearhead.DcsUtil.RemoveMarker(self._lastContactMarkerID)
|
||||
Spearhead.DcsUtil.RemoveMark(self._lastContactMarkerID)
|
||||
end
|
||||
|
||||
if self._state == "COMPLETED" and self._battleManager then
|
||||
|
||||
Reference in New Issue
Block a user