@@ -321,6 +321,15 @@
|
|||||||
Spearhead will pick one random mission from zones with the same name.
|
Spearhead will pick one random mission from zones with the same name.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<h2 id="in-stage-dependencies">In stage depencies</h2>
|
||||||
|
<p>
|
||||||
|
If you want to have missions inside of a stage depends on each other you can. <br/>
|
||||||
|
Add a text drawing box inside of the mission trigger zone with the name:
|
||||||
|
<span class="inline-lua"><span class="lua-variable">dependson_[freeform]</span></span> <br/>
|
||||||
|
And in the text add the "Name" of the mission zone you want the mission to depend on. <br/>
|
||||||
|
The mission will be "pre-activated" (spawned) but won't have a f10 mission menu until the mission(s) it depends on is completed. <br/>
|
||||||
|
</p>
|
||||||
|
|
||||||
<h2>Runway Bombing</h2>
|
<h2>Runway Bombing</h2>
|
||||||
<p>
|
<p>
|
||||||
Runway bombing can be a very effective OCA tactic. With Spearhead we've tried adding as much logic and detail to it so it will feel as engaging as possible. <br/>
|
Runway bombing can be a very effective OCA tactic. With Spearhead we've tried adding as much logic and detail to it so it will feel as engaging as possible. <br/>
|
||||||
@@ -332,9 +341,6 @@
|
|||||||
| Section 1 | Section 2 | Section 3 | Section 4 | Section 5 | <br/>
|
| Section 1 | Section 2 | Section 3 | Section 4 | Section 5 | <br/>
|
||||||
+-----------+-----------+-----------+-----------+-----------+ <br/>
|
+-----------+-----------+-----------+-----------+-----------+ <br/>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Binary file not shown.
@@ -64,7 +64,7 @@ function RunwayBombingTracker.trackWeaponTask(weaponTrackingArgs, time)
|
|||||||
local weapon = weaponTrackingArgs.weapon
|
local weapon = weaponTrackingArgs.weapon
|
||||||
local self = weaponTrackingArgs.self
|
local self = weaponTrackingArgs.self
|
||||||
|
|
||||||
if not weapon then return nil end
|
if not weapon or weapon:isExist() == false then return nil end
|
||||||
|
|
||||||
local pos = weapon:getPoint()
|
local pos = weapon:getPoint()
|
||||||
local velocity = weapon:getVelocity()
|
local velocity = weapon:getVelocity()
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ do -- INIT DCS_UTIL
|
|||||||
end
|
end
|
||||||
|
|
||||||
---checks if the groupname is a static group
|
---checks if the groupname is a static group
|
||||||
---@param groupName any
|
---@param groupName string
|
||||||
function DCS_UTIL.IsGroupStatic(groupName)
|
function DCS_UTIL.IsGroupStatic(groupName)
|
||||||
if DCS_UTIL.__miz_groups[groupName] then
|
if DCS_UTIL.__miz_groups[groupName] then
|
||||||
return DCS_UTIL.__miz_groups[groupName].category == 5;
|
return DCS_UTIL.__miz_groups[groupName].category == 5;
|
||||||
@@ -555,6 +555,7 @@ do -- INIT DCS_UTIL
|
|||||||
end
|
end
|
||||||
|
|
||||||
---destroy the given unit
|
---destroy the given unit
|
||||||
|
---@param unitName string
|
||||||
function DCS_UTIL.DestroyUnit(unitName)
|
function DCS_UTIL.DestroyUnit(unitName)
|
||||||
if DCS_UTIL.IsGroupStatic(unitName) == true then
|
if DCS_UTIL.IsGroupStatic(unitName) == true then
|
||||||
local object = StaticObject.getByName(unitName)
|
local object = StaticObject.getByName(unitName)
|
||||||
|
|||||||
+54
-25
@@ -11,7 +11,7 @@
|
|||||||
---@field CapDataPerStageNumber table<integer, CapData> table<StageNumber, table>
|
---@field CapDataPerStageNumber table<integer, CapData> table<StageNumber, table>
|
||||||
---@field CarrierRouteZones Array<string> All Carrier routes zones
|
---@field CarrierRouteZones Array<string> All Carrier routes zones
|
||||||
---@field BlueSams Array<string> All blue sam zones
|
---@field BlueSams Array<string> All blue sam zones
|
||||||
---@field DescriptionsByMission table<string,string> table<ZoneName, Description>
|
---@field MissionAnnotations table<string, MissionAnnotations> table<ZoneName, MissionAnnotations>
|
||||||
---@field AirbaseDataPerAirfield table<string, AirbaseData>
|
---@field AirbaseDataPerAirfield table<string, AirbaseData>
|
||||||
---@field BlueSamDataPerZone table<string, BlueSamData>
|
---@field BlueSamDataPerZone table<string, BlueSamData>
|
||||||
---@field MissionZoneData table<string, MissionZoneData>
|
---@field MissionZoneData table<string, MissionZoneData>
|
||||||
@@ -26,6 +26,10 @@
|
|||||||
---@field point1 Vec3
|
---@field point1 Vec3
|
||||||
---@field point2 Vec3?
|
---@field point2 Vec3?
|
||||||
|
|
||||||
|
---@class MissionAnnotations
|
||||||
|
---@field description string?
|
||||||
|
---@field dependsOn Array<string>
|
||||||
|
|
||||||
---@class StageZoneData
|
---@class StageZoneData
|
||||||
---@field StageZoneName string
|
---@field StageZoneName string
|
||||||
---@field AirbaseNames Array<string>
|
---@field AirbaseNames Array<string>
|
||||||
@@ -70,7 +74,6 @@ function Database.New(Logger)
|
|||||||
CapRoutes = {},
|
CapRoutes = {},
|
||||||
CapDataPerStageNumber = {},
|
CapDataPerStageNumber = {},
|
||||||
CarrierRouteZones = {},
|
CarrierRouteZones = {},
|
||||||
DescriptionsByMission = {},
|
|
||||||
MissionZones = {},
|
MissionZones = {},
|
||||||
MissionZonesLocations = {},
|
MissionZonesLocations = {},
|
||||||
StageZoneNames = {},
|
StageZoneNames = {},
|
||||||
@@ -82,7 +85,8 @@ function Database.New(Logger)
|
|||||||
BlueSamDataPerZone = {},
|
BlueSamDataPerZone = {},
|
||||||
MissionZoneData = {},
|
MissionZoneData = {},
|
||||||
FarpZoneData = {},
|
FarpZoneData = {},
|
||||||
missionCodes = {}
|
missionCodes = {},
|
||||||
|
MissionAnnotations = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Database.__index = Database
|
Database.__index = Database
|
||||||
@@ -165,26 +169,38 @@ function Database.New(Logger)
|
|||||||
for i, layer in pairs(env.mission.drawings.layers) do
|
for i, 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 Spearhead.Util.startswith(layer_object.name, "stagebriefing", true) then
|
if Spearhead.Util.startswith(string.lower(layer_object.name), "dependson", true) == true then
|
||||||
|
|
||||||
|
for _, zonename in pairs(self._tables.MissionZones) do
|
||||||
|
if Spearhead.DcsUtil.isPositionInZone(layer_object.mapX, layer_object.mapY, zonename) == true then
|
||||||
|
if self._tables.MissionAnnotations[zonename] == nil then
|
||||||
|
self._tables.MissionAnnotations[zonename] = {
|
||||||
|
description = nil,
|
||||||
|
dependsOn = {}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, splitDependency in pairs(Spearhead.Util.split_string(layer_object.text, ",")) do
|
||||||
|
table.insert(self._tables.MissionAnnotations[zonename].dependsOn, splitDependency)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif Spearhead.Util.startswith(layer_object.name, "stagebriefing", true) == true then
|
||||||
--[[
|
--[[
|
||||||
TODO: Stage Briefings
|
TODO: Stage Briefings
|
||||||
]]
|
]]
|
||||||
else
|
else
|
||||||
local inZone = Spearhead.DcsUtil.isPositionInZones(layer_object.mapX, layer_object.mapY,
|
for _, zonename in pairs(self._tables.MissionZones) do
|
||||||
self._tables.MissionZones)
|
if Spearhead.DcsUtil.isPositionInZone(layer_object.mapX, layer_object.mapY, zonename) == true then
|
||||||
if Spearhead.Util.tableLength(inZone) >= 1 then
|
if self._tables.MissionAnnotations[zonename] == nil then
|
||||||
local name = inZone[1]
|
self._tables.MissionAnnotations[zonename] = {
|
||||||
if name ~= nil then
|
description = "",
|
||||||
self._tables.DescriptionsByMission[name] = layer_object.text
|
dependsOn = {}
|
||||||
end
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local inZone = Spearhead.DcsUtil.isPositionInZones(layer_object.mapX, layer_object.mapY,
|
local missionAnnotation = self._tables.MissionAnnotations[zonename]
|
||||||
self._tables.RandomMissionZones)
|
missionAnnotation.description = layer_object.text
|
||||||
if Spearhead.Util.tableLength(inZone) >= 1 then
|
|
||||||
local name = inZone[1]
|
|
||||||
if name ~= nil then
|
|
||||||
self._tables.DescriptionsByMission[name] = layer_object.text
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -239,13 +255,13 @@ function Database.New(Logger)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _, missionZone in pairs(self._tables.MissionZones) do
|
for _, missionZone in pairs(self._tables.MissionZones) do
|
||||||
if self._tables.DescriptionsByMission[missionZone] == nil then
|
if self._tables.MissionAnnotations[missionZone] == nil or self._tables.MissionAnnotations[missionZone].description then
|
||||||
Spearhead.AddMissionEditorWarning("Mission with zonename: " .. missionZone .. " does not have a briefing")
|
Spearhead.AddMissionEditorWarning("Mission with zonename: " .. missionZone .. " does not have a briefing")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, missionZone in pairs(self._tables.RandomMissionZones) do
|
for _, missionZone in pairs(self._tables.RandomMissionZones) do
|
||||||
if self._tables.DescriptionsByMission[missionZone] == nil then
|
if self._tables.MissionAnnotations[missionZone] == nil or self._tables.MissionAnnotations[missionZone].description then
|
||||||
Spearhead.AddMissionEditorWarning("Mission with zonename: " .. missionZone .. " does not have a briefing")
|
Spearhead.AddMissionEditorWarning("Mission with zonename: " .. missionZone .. " does not have a briefing")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -584,8 +600,25 @@ function Database:loadMiscGroupsInStages()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Database:GetDescriptionForMission(missionZoneName)
|
|
||||||
return self._tables.DescriptionsByMission[missionZoneName]
|
---@return string?
|
||||||
|
function Database:getMissionBriefingForMissionZone(missionZoneName)
|
||||||
|
if not self._tables.MissionAnnotations[missionZoneName] then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return self._tables.MissionAnnotations[missionZoneName].description
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---@param missionZoneName string
|
||||||
|
---@return Array<string>
|
||||||
|
function Database:getMissionDependencies(missionZoneName)
|
||||||
|
if not self._tables.MissionAnnotations[missionZoneName] then
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
|
||||||
|
return self._tables.MissionAnnotations[missionZoneName].dependsOn
|
||||||
end
|
end
|
||||||
|
|
||||||
---comment
|
---comment
|
||||||
@@ -687,10 +720,6 @@ function Database:getGroupsForMissionZone(missionZoneName)
|
|||||||
return missionZoneData.Groups
|
return missionZoneData.Groups
|
||||||
end
|
end
|
||||||
|
|
||||||
---@return string?
|
|
||||||
function Database:getMissionBriefingForMissionZone(missionZoneName)
|
|
||||||
return self._tables.DescriptionsByMission[missionZoneName]
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param stageName string
|
---@param stageName string
|
||||||
---@return table result airbase Names
|
---@return table result airbase Names
|
||||||
|
|||||||
@@ -110,13 +110,16 @@ function StageBase:CleanRedUnits()
|
|||||||
value:SpawnCorpsesOnly()
|
value:SpawnCorpsesOnly()
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, unitName in pairs(self._cleanup_units) do
|
for unitName, shouldClean in pairs(self._cleanup_units) do
|
||||||
|
if shouldClean == true then
|
||||||
Spearhead.DcsUtil.DestroyUnit(unitName)
|
Spearhead.DcsUtil.DestroyUnit(unitName)
|
||||||
Spearhead.DcsUtil.CleanCorpse(unitName)
|
Spearhead.DcsUtil.CleanCorpse(unitName)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
---@private
|
---@private
|
||||||
function StageBase:SpawnBlueUnits()
|
function StageBase:SpawnBlueUnits()
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
--- @class StageData
|
--- @class StageData
|
||||||
--- @field missionsByCode table<string, Mission>
|
--- @field missionsByCode table<string, Mission>
|
||||||
|
--- @field missionsByName table<string, Mission>
|
||||||
--- @field missions Array<ZoneMission>
|
--- @field missions Array<ZoneMission>
|
||||||
--- @field sams Array<ZoneMission>
|
--- @field sams Array<ZoneMission>
|
||||||
--- @field blueSams Array<BlueSam>
|
--- @field blueSams Array<BlueSam>
|
||||||
@@ -88,6 +89,7 @@ function Stage:superNew(database, stageConfig, logger, initData, missionPriority
|
|||||||
miscGroups = {},
|
miscGroups = {},
|
||||||
maxMissions = stageConfig.maxMissionsPerStage,
|
maxMissions = stageConfig.maxMissionsPerStage,
|
||||||
farps = {},
|
farps = {},
|
||||||
|
missionsByName = {},
|
||||||
}
|
}
|
||||||
self._activeStage = -99
|
self._activeStage = -99
|
||||||
self._preActivated = false
|
self._preActivated = false
|
||||||
@@ -130,9 +132,17 @@ function Stage:superNew(database, stageConfig, logger, initData, missionPriority
|
|||||||
local missionZones = database:getMissionsForStage(self.zoneName)
|
local missionZones = database:getMissionsForStage(self.zoneName)
|
||||||
self._logger:debug("Found " .. Spearhead.Util.tableLength(missionZones) .. " mission zones for stage: " .. self.zoneName)
|
self._logger:debug("Found " .. Spearhead.Util.tableLength(missionZones) .. " mission zones for stage: " .. self.zoneName)
|
||||||
for _, missionZone in pairs(missionZones) do
|
for _, missionZone in pairs(missionZones) do
|
||||||
local mission = Spearhead.classes.stageClasses.missions.ZoneMission.new(missionZone, self._missionPriority, database, logger)
|
|
||||||
|
local mission = Spearhead.classes.stageClasses.missions.ZoneMission.new(missionZone, self._missionPriority, database, logger, self)
|
||||||
if mission then
|
if mission then
|
||||||
self._db.missionsByCode[mission.code] = mission
|
self._db.missionsByCode[mission.code] = mission
|
||||||
|
|
||||||
|
if mission.name and self._db.missionsByName[mission.name] == nil then
|
||||||
|
self._db.missionsByName[mission.name] = mission
|
||||||
|
else
|
||||||
|
Spearhead.AddMissionEditorWarning("DUPLICATE MISSION NAME ALERT: " .. mission.name .. " in zone: " .. self.zoneName)
|
||||||
|
end
|
||||||
|
|
||||||
if mission.missionType == "SAM" then
|
if mission.missionType == "SAM" then
|
||||||
table.insert(self._db.sams, mission)
|
table.insert(self._db.sams, mission)
|
||||||
else
|
else
|
||||||
@@ -146,7 +156,7 @@ function Stage:superNew(database, stageConfig, logger, initData, missionPriority
|
|||||||
---@type table<string, Array<Mission>>
|
---@type table<string, Array<Mission>>
|
||||||
local randomMissionByName = {}
|
local randomMissionByName = {}
|
||||||
for _, missionZoneName in pairs(randomMissionNames) do
|
for _, missionZoneName in pairs(randomMissionNames) do
|
||||||
local mission = Spearhead.classes.stageClasses.missions.ZoneMission.new(missionZoneName, self._missionPriority, database, logger)
|
local mission = Spearhead.classes.stageClasses.missions.ZoneMission.new(missionZoneName, self._missionPriority, database, logger, self)
|
||||||
if mission then
|
if mission then
|
||||||
if randomMissionByName[mission.name] == nil then
|
if randomMissionByName[mission.name] == nil then
|
||||||
randomMissionByName[mission.name] = {}
|
randomMissionByName[mission.name] = {}
|
||||||
@@ -164,6 +174,13 @@ function Stage:superNew(database, stageConfig, logger, initData, missionPriority
|
|||||||
Spearhead.classes.persistence.Persistence.RegisterPickedRandomMission(mission.name, mission.zoneName)
|
Spearhead.classes.persistence.Persistence.RegisterPickedRandomMission(mission.name, mission.zoneName)
|
||||||
|
|
||||||
self._db.missionsByCode[mission.code] = mission
|
self._db.missionsByCode[mission.code] = mission
|
||||||
|
|
||||||
|
if mission.name and self._db.missionsByName[mission.name] == nil then
|
||||||
|
self._db.missionsByName[mission.name] = mission
|
||||||
|
else
|
||||||
|
Spearhead.AddMissionEditorWarning("DUPLICATE MISSION NAME ALERT: " .. mission.name .. " in zone: " .. self.zoneName)
|
||||||
|
end
|
||||||
|
|
||||||
if mission.missionType == "SAM" then
|
if mission.missionType == "SAM" then
|
||||||
table.insert(self._db.sams, mission)
|
table.insert(self._db.sams, mission)
|
||||||
else
|
else
|
||||||
@@ -222,7 +239,7 @@ function Stage:IsComplete()
|
|||||||
|
|
||||||
for i, mission in pairs(self._db.sams) do
|
for i, mission in pairs(self._db.sams) do
|
||||||
local state = mission:getState()
|
local state = mission:getState()
|
||||||
if state == "ACTIVE" or state == "NEW" then
|
if state == "ACTIVE" or state == "NEW" or state =="WAITING" then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -293,6 +310,16 @@ function Stage:CheckAndUpdateSelf()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param missionName string
|
||||||
|
---@return boolean
|
||||||
|
function Stage:IsMissionComplete(missionName)
|
||||||
|
|
||||||
|
local mission = self._db.missionsByName[missionName]
|
||||||
|
if not mission then return true end
|
||||||
|
|
||||||
|
return mission:getState() == "COMPLETED"
|
||||||
|
end
|
||||||
|
|
||||||
---private use only
|
---private use only
|
||||||
function Stage:NotifyComplete()
|
function Stage:NotifyComplete()
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
---@class ZoneMission : Mission, OnUnitLostListener
|
---@class ZoneMission : Mission, OnUnitLostListener
|
||||||
---@field private _state MissionState
|
---@field private _state MissionState
|
||||||
---@field private _missionGroups MissionGroups
|
---@field private _missionGroups MissionGroups
|
||||||
|
---@field private _dependencies table<string, boolean>
|
||||||
|
---@field private _parentStage Stage
|
||||||
local ZoneMission = {}
|
local ZoneMission = {}
|
||||||
|
|
||||||
--- @class MissionGroups
|
--- @class MissionGroups
|
||||||
@@ -58,8 +60,9 @@ MINIMAL_UNITS_ALIVE_RATIO = 0.21
|
|||||||
---@param priority MissionPriority
|
---@param priority MissionPriority
|
||||||
---@param database Database
|
---@param database Database
|
||||||
---@param logger Logger
|
---@param logger Logger
|
||||||
|
---@param parentStage Stage
|
||||||
---@return ZoneMission?
|
---@return ZoneMission?
|
||||||
function ZoneMission.new(zoneName, priority, database, logger)
|
function ZoneMission.new(zoneName, priority, database, logger, parentStage)
|
||||||
local Mission = Spearhead.classes.stageClasses.missions.baseMissions.Mission
|
local Mission = Spearhead.classes.stageClasses.missions.baseMissions.Mission
|
||||||
ZoneMission.__index = ZoneMission
|
ZoneMission.__index = ZoneMission
|
||||||
setmetatable(ZoneMission, Mission)
|
setmetatable(ZoneMission, Mission)
|
||||||
@@ -80,6 +83,8 @@ function ZoneMission.new(zoneName, priority, database, logger)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- parent new done
|
||||||
|
|
||||||
if self.missionType == "SAM" then
|
if self.missionType == "SAM" then
|
||||||
self.missionTypeDisplay = "DEAD"
|
self.missionTypeDisplay = "DEAD"
|
||||||
end
|
end
|
||||||
@@ -92,6 +97,15 @@ function ZoneMission.new(zoneName, priority, database, logger)
|
|||||||
groupNamesPerunit = {}
|
groupNamesPerunit = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self._parentStage = parentStage
|
||||||
|
self._dependencies = {}
|
||||||
|
|
||||||
|
local dependencies = database:getMissionDependencies(zoneName)
|
||||||
|
for _, dependency in pairs(dependencies) do
|
||||||
|
self._dependencies[dependency] = false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local SpearheadGroup = Spearhead.classes.stageClasses.Groups.SpearheadGroup
|
local SpearheadGroup = Spearhead.classes.stageClasses.Groups.SpearheadGroup
|
||||||
local groupNames = database:getGroupsForMissionZone(zoneName)
|
local groupNames = database:getGroupsForMissionZone(zoneName)
|
||||||
for _, groupName in pairs(groupNames) do
|
for _, groupName in pairs(groupNames) do
|
||||||
@@ -131,6 +145,48 @@ function ZoneMission.new(zoneName, priority, database, logger)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@private
|
||||||
|
function ZoneMission:StartCheckingDependencies()
|
||||||
|
|
||||||
|
|
||||||
|
self._state = "WAITING"
|
||||||
|
|
||||||
|
---comment
|
||||||
|
---@param mission ZoneMission
|
||||||
|
---@param time any
|
||||||
|
---@return unknown
|
||||||
|
local function CheckDependencies(mission, time)
|
||||||
|
|
||||||
|
if mission:AllDependenciesMet() == true then
|
||||||
|
mission:SpawnActive()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return time + 15
|
||||||
|
end
|
||||||
|
|
||||||
|
timer.scheduleFunction(CheckDependencies, self, timer.getTime() + 15)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@return boolean
|
||||||
|
function ZoneMission:AllDependenciesMet()
|
||||||
|
local allDependenciesMet = true
|
||||||
|
for missionName, value in pairs(self._dependencies) do
|
||||||
|
if self._parentStage:IsMissionComplete(missionName) == false then
|
||||||
|
allDependenciesMet = false
|
||||||
|
self._dependencies[missionName] = false
|
||||||
|
else
|
||||||
|
self._dependencies[missionName] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if allDependenciesMet == true then
|
||||||
|
self._logger:info("All dependencies met for " .. self.name)
|
||||||
|
end
|
||||||
|
|
||||||
|
return allDependenciesMet
|
||||||
|
end
|
||||||
|
|
||||||
---@internal
|
---@internal
|
||||||
---@param checkHealth boolean
|
---@param checkHealth boolean
|
||||||
---@param messageIfDone boolean
|
---@param messageIfDone boolean
|
||||||
@@ -229,7 +285,6 @@ function ZoneMission:UpdateState(checkHealth, messageIfDone)
|
|||||||
self._state = "COMPLETED"
|
self._state = "COMPLETED"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ZoneMission:SpawnPersistedState()
|
function ZoneMission:SpawnPersistedState()
|
||||||
@@ -242,7 +297,6 @@ end
|
|||||||
function ZoneMission:SpawnInactive()
|
function ZoneMission:SpawnInactive()
|
||||||
self._logger:info("PreActivating " .. self.name)
|
self._logger:info("PreActivating " .. self.name)
|
||||||
|
|
||||||
self._state = "ACTIVE"
|
|
||||||
for _, group in pairs(self._missionGroups.groups) do
|
for _, group in pairs(self._missionGroups.groups) do
|
||||||
group:Spawn()
|
group:Spawn()
|
||||||
end
|
end
|
||||||
@@ -250,6 +304,12 @@ end
|
|||||||
|
|
||||||
function ZoneMission:SpawnActive()
|
function ZoneMission:SpawnActive()
|
||||||
|
|
||||||
|
if self:AllDependenciesMet() == false then
|
||||||
|
self:SpawnInactive()
|
||||||
|
self:StartCheckingDependencies()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
self._logger:info("Activating " .. self.name)
|
self._logger:info("Activating " .. self.name)
|
||||||
|
|
||||||
if self._state == "COMPLETED" or self._state == "ACTIVE" then
|
if self._state == "COMPLETED" or self._state == "ACTIVE" then
|
||||||
@@ -270,6 +330,7 @@ end
|
|||||||
|
|
||||||
---@private
|
---@private
|
||||||
function ZoneMission:StartCheckingContinuous()
|
function ZoneMission:StartCheckingContinuous()
|
||||||
|
|
||||||
---comment
|
---comment
|
||||||
---@param mission Mission
|
---@param mission Mission
|
||||||
---@param time any
|
---@param time any
|
||||||
@@ -278,6 +339,7 @@ function ZoneMission:StartCheckingContinuous()
|
|||||||
mission:UpdateState(true, true)
|
mission:UpdateState(true, true)
|
||||||
|
|
||||||
if mission:getState() == "COMPLETED" then
|
if mission:getState() == "COMPLETED" then
|
||||||
|
mission:NotifyMissionComplete()
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
return time + 30
|
return time + 30
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ do --aliases
|
|||||||
|
|
||||||
--- @alias MissionState
|
--- @alias MissionState
|
||||||
--- | "NEW"
|
--- | "NEW"
|
||||||
|
--- | "WAITING"
|
||||||
--- | "ACTIVE"
|
--- | "ACTIVE"
|
||||||
--- | "COMPLETED"
|
--- | "COMPLETED"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user