added BLUESAM zone

This commit is contained in:
2024-10-23 07:44:34 +02:00
parent 2447092d05
commit 7d85e4f277
4 changed files with 64 additions and 3 deletions
Binary file not shown.
+50 -2
View File
@@ -29,6 +29,7 @@ do -- DB
o.tables.farp_zones = {}
o.tables.cap_route_zones = {}
o.tables.carrier_route_zones = {}
o.tables.blue_sams = {}
o.tables.stage_zonesByNumer = {}
o.tables.stage_numberPerzone = {}
@@ -70,6 +71,10 @@ do -- DB
if string.lower(split_string[1]) == "carrierroute" then
table.insert(o.tables.carrier_route_zones, zone_name)
end
if string.lower(split_string[1]) == "bluesam" then
table.insert(o.tables.blue_sams, zone_name)
end
end
end
@@ -103,6 +108,21 @@ do -- DB
end
end
o.tables.blueSamZonesPerStage = {}
for _, stageZoneName in pairs(o.tables.stage_zones) do
if o.tables.blueSamZonesPerStage[stageZoneName] == nil then
o.tables.blueSamZonesPerStage[stageZoneName] = {}
end
for _, blueSamStageName in pairs(o.tables.blue_sams) do
if Spearhead.DcsUtil.isZoneInZone(blueSamStageName, stageZoneName) == true then
table.insert(o.tables.blueSamZonesPerStage[stageZoneName], blueSamStageName)
end
end
end
o.tables.missionZonesPerStage = {}
for key, missionZone in pairs(o.tables.mission_zones) do
local found = false
@@ -258,6 +278,21 @@ do -- DB
end
end
o.tables.samUnitsPerSamZone = {}
local loadBlueSamUnits = function()
local all_groups = getAvailableGroups()
for _, blueSamZone in pairs(o.tables.blue_sams) do
o.tables.samUnitsPerSamZone[blueSamZone] = {}
local groups = Spearhead.DcsUtil.getGroupsInZone(all_groups, blueSamZone)
for _, groupName in pairs(groups) do
is_group_taken[groupName] = true
table.insert(o.tables.samUnitsPerSamZone[blueSamZone], groupName)
end
end
end
--- missionZoneName <> groupname[]
o.tables.groupsInMissionZone = {}
local loadMissionzoneUnits = function()
@@ -393,6 +428,7 @@ do -- DB
end
loadCapUnits()
loadBlueSamUnits()
loadMissionzoneUnits()
loadRandomMissionzoneUnits()
loadFarpGroups()
@@ -571,7 +607,6 @@ do -- DB
return self.tables.descriptions[missionZoneName] or ""
end
---comment
---@param self table
---@param stageName string
---@return table result airbase IDs. Use Spearhead.DcsUtil.getAirbaseById
@@ -583,7 +618,6 @@ do -- DB
return self.tables.farpZonesPerStage[stageName]
end
---comment
---@param self table
---@param airbaseId number
---@return table
@@ -591,6 +625,20 @@ do -- DB
return self.tables.capGroupsOnAirbase[airbaseId] or {}
end
---@param self table
---@param stageName string
---@return table
o.getBlueSamsInStage = function(self, stageName)
return self.tables.blueSamZonesPerStage[stageName] or {}
end
---@param self table
---@param samZone string
---@return table
o.getBlueSamGroupsInZone = function(self, samZone)
return self.tables.samUnitsPerSamZone[samZone] or {}
end
o.getRedGroupsAtAirbase = function(self, airbaseId)
local baseId = tostring(airbaseId)
return self.tables.redAirbaseGroupsPerAirbase[baseId] or {}
+13
View File
@@ -38,6 +38,7 @@ do --init STAGE DIRECTOR
o.db.sams = {}
o.db.redAirbasegroups = {}
o.db.blueAirbasegroups = {}
o.db.blueSamGroups = {}
o.db.airbaseIds = {}
o.db.farps = {}
o.activeStage = 0
@@ -105,6 +106,13 @@ do --init STAGE DIRECTOR
end
end
for _, samZoneName in pairs(database:getBlueSamsInStage(o.zoneName)) do
for _, samGroup in pairs(database:getBlueSamGroupsInZone(samZoneName)) do
table.insert(o.db.blueSamGroups, samGroup)
Spearhead.DcsUtil.DestroyGroup(samGroup)
end
end
local miscGroups = database:getMiscGroupsAtStage(o.zoneName)
for _, groupName in pairs(miscGroups) do
Spearhead.DcsUtil.DestroyGroup(groupName)
@@ -286,6 +294,10 @@ do --init STAGE DIRECTOR
self:MarkStage(true)
end)
for _, blueSamGroupName in pairs(self.db.blueSamGroups) do
Spearhead.DcsUtil.SpawnGroupTemplate(blueSamGroupName)
end
for key, airbaseId in pairs(self.db.airbaseIds) do
local airbase = Spearhead.DcsUtil.getAirbaseById(airbaseId)
@@ -301,6 +313,7 @@ do --init STAGE DIRECTOR
end
end
end
return nil
end
---Sets airfields to blue and spawns friendly farps
+1 -1
View File
@@ -22,7 +22,7 @@ local SetStageDelayed = function(number, time)
return nil
end
timer.scheduleFunction(SetStageDelayed, 1, timer.getTime() + 3)
timer.scheduleFunction(SetStageDelayed, 2, timer.getTime() + 3)
Spearhead.LoadingDone()
--Check lines of code in directory per file: