Added mission type deepstrike
This commit is contained in:
@@ -69,6 +69,7 @@ local StageDrawing = require("classes.stageClasses.drawings.StageDrawing")
|
||||
---@field descriptionLocation Vec2?
|
||||
---@field dependsOn Array<string>
|
||||
---@field completeAt number?
|
||||
---@field primaryOverwrite boolean?
|
||||
|
||||
---@class FarpZoneData
|
||||
---@field groups Array<string>
|
||||
@@ -211,7 +212,7 @@ function Database.New(Logger)
|
||||
for i, 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), "buildable", true) == true then
|
||||
if Util.startsWith(string.lower(layer_object.name), "buildable", true) == true then
|
||||
local airbaseData = self:getAirbaseDataForDrawLayer(layer_object)
|
||||
if airbaseData then
|
||||
self._logger:debug("found airbase data for " .. layer_object.name)
|
||||
@@ -231,7 +232,7 @@ function Database.New(Logger)
|
||||
for i, 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(layer_object.name, "drawing_", true) then
|
||||
if Util.startsWith(layer_object.name, "drawing_", true) then
|
||||
local object = layer_object --[[@as DrawingObject]]
|
||||
local stageDrawing = StageDrawing.New(object)
|
||||
if stageDrawing then
|
||||
@@ -259,7 +260,7 @@ function Database.New(Logger)
|
||||
for i, 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
|
||||
if Util.startsWith(string.lower(layer_object.name), "stagebriefing_", true) == true then
|
||||
local zone = DcsUtil.getZoneByName(stageZoneName)
|
||||
local vec2 = { x = layer_object.mapX, y = layer_object.mapY }
|
||||
if zone and Util.is2dPointInZone(vec2, zone) == true then
|
||||
@@ -484,7 +485,7 @@ end
|
||||
local getAvailableCAPGroups = function()
|
||||
local result = {}
|
||||
for name, value in pairs(is_group_taken) do
|
||||
if value == false and Util.startswith(name, "CAP") then
|
||||
if value == false and Util.startsWith(name, "CAP") then
|
||||
table.insert(result, name)
|
||||
end
|
||||
end
|
||||
@@ -587,11 +588,11 @@ function Database:loadCapUnits()
|
||||
for _, groupName in pairs(groups) do
|
||||
is_group_taken[groupName] = true
|
||||
|
||||
if Util.startswith(groupName, "CAP_A", true) or Util.startswith(groupName, "CAP_B", true) then
|
||||
if Util.startsWith(groupName, "CAP_A", true) or Util.startsWith(groupName, "CAP_B", true) then
|
||||
table.insert(baseData.CapGroups, groupName)
|
||||
elseif Util.startswith(groupName, "CAP_I", true) then
|
||||
elseif Util.startsWith(groupName, "CAP_I", true) then
|
||||
table.insert(baseData.InterceptGroups, groupName)
|
||||
elseif Util.startswith(groupName, "CAP_S", true) then
|
||||
elseif Util.startsWith(groupName, "CAP_S", true) then
|
||||
table.insert(baseData.SweepGroups, groupName)
|
||||
end
|
||||
end
|
||||
@@ -614,7 +615,7 @@ function Database:loadBlueSamUnits()
|
||||
local triggerZone = DcsUtil.getZoneByName(blueSamZone)
|
||||
if triggerZone then
|
||||
for _, kvPair in pairs(triggerZone.properties) do
|
||||
if kvPair.key and Util.startswith(kvPair.key, "buildable") then
|
||||
if kvPair.key and Util.startsWith(kvPair.key, "buildable") then
|
||||
local number = tonumber(kvPair.value)
|
||||
if number and number > 0 then
|
||||
samData.buildingKilos = number
|
||||
@@ -626,7 +627,7 @@ function Database:loadBlueSamUnits()
|
||||
|
||||
local vec2 = { x = layer_object.mapX, y = layer_object.mapY }
|
||||
if triggerZone and Util.is2dPointInZone(vec2, triggerZone) then
|
||||
if layer_object.name and Util.startswith(layer_object.name, "supplybriefing_", true) then
|
||||
if layer_object.name and Util.startsWith(layer_object.name, "supplybriefing_", true) then
|
||||
local description = layer_object.text
|
||||
if description and description ~= "" then
|
||||
samData.briefing = description
|
||||
@@ -702,9 +703,9 @@ function Database:LoadZoneData(missionZoneName)
|
||||
if triggerZone and triggerZone.properties then
|
||||
for _, kvPair in pairs(triggerZone.properties) do
|
||||
local key = kvPair.key
|
||||
if Util.startswith(key, "dependson", true) == true then
|
||||
if Util.startsWith(key, "dependson", true) == true then
|
||||
table.insert(self._tables.MissionZoneData[missionZoneName].dependsOn, kvPair.value)
|
||||
elseif Util.startswith(key, "completeat") == true then
|
||||
elseif Util.startsWith(key, "completeat") == true then
|
||||
local value = tonumber(kvPair.value)
|
||||
if value then
|
||||
if value > 1 and value <= 100 then
|
||||
@@ -714,6 +715,14 @@ function Database:LoadZoneData(missionZoneName)
|
||||
end
|
||||
self._tables.MissionZoneData[missionZoneName].completeAt = value
|
||||
end
|
||||
elseif Util.startsWith(key, "primary", true) == true then
|
||||
if type(kvPair.value) == "string" then
|
||||
if kvPair.value == "true" then
|
||||
self._tables.MissionZoneData[missionZoneName].primaryOverwrite = true
|
||||
elseif kvPair.value == "false" then
|
||||
self._tables.MissionZoneData[missionZoneName].primaryOverwrite = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -726,7 +735,7 @@ function Database:LoadZoneData(missionZoneName)
|
||||
|
||||
local vec2 = { x = layer_object.mapX, y = layer_object.mapY }
|
||||
if triggerZone and Util.is2dPointInZone(vec2, triggerZone) then
|
||||
if layer_object.name and Util.startswith(layer_object.name, "briefing_", true) then
|
||||
if layer_object.name and Util.startsWith(layer_object.name, "briefing_", true) then
|
||||
local description = layer_object.text
|
||||
if description and description ~= "" then
|
||||
self._tables.MissionZoneData[missionZoneName].description = description
|
||||
@@ -769,7 +778,7 @@ function Database:loadFarpData()
|
||||
local triggerZone = DcsUtil.getZoneByName(farpZone)
|
||||
if triggerZone then
|
||||
for _, kvPair in pairs(triggerZone.properties) do
|
||||
if kvPair.key and Util.startswith(kvPair.key, "buildable", true) == true then
|
||||
if kvPair.key and Util.startsWith(kvPair.key, "buildable", true) == true then
|
||||
local number = tonumber(kvPair.value)
|
||||
if number and number > 0 then
|
||||
farpzoneData.buildingKilos = number
|
||||
@@ -782,7 +791,7 @@ function Database:loadFarpData()
|
||||
|
||||
local vec2 = { x = layer_object.mapX, y = layer_object.mapY }
|
||||
if triggerZone and Util.is2dPointInZone(vec2, triggerZone) then
|
||||
if layer_object.name and Util.startswith(layer_object.name, "supplybriefing_", true) then
|
||||
if layer_object.name and Util.startsWith(layer_object.name, "supplybriefing_", true) then
|
||||
local description = layer_object.text
|
||||
if description and description ~= "" then
|
||||
farpzoneData.briefing = description
|
||||
|
||||
Reference in New Issue
Block a user