Sweep cap (#54)
* Added initial implementation of Sweep groups * Added initial implementation of Sweep groups * Added initial implementation of Sweep groups * Added initial implementation of Sweep groups * fixed issues when testing * Intercept cap (#55) * First intial WIP for intercept units * First intial WIP for intercept units * major updates --------- Co-authored-by: ex61wi <tim.rorije@ing.com> Co-authored-by: dutchie032 <dutchie032> --------- Co-authored-by: ex61wi <tim.rorije@ing.com> Co-authored-by: dutchie032 <dutchie032>
This commit is contained in:
committed by
GitHub
co-authored by
ex61wi
dutchie032 <dutchie032>
parent
bdf7154333
commit
ef65f5a353
@@ -80,63 +80,62 @@ end
|
||||
---@private
|
||||
function CapGroup:InitWithName(groupName)
|
||||
local split_string = Spearhead.Util.split_string(groupName, "_")
|
||||
local partCount = Spearhead.Util.tableLength(split_string)
|
||||
if partCount >= 3 then
|
||||
local partCount = Spearhead.Util.tableLength(split_string)
|
||||
if partCount >= 3 then
|
||||
|
||||
local configPart = split_string[2]
|
||||
local first = configPart:sub(1, 1)
|
||||
if first == "A" then
|
||||
self._isBackup = false
|
||||
configPart = string.sub(configPart, 2, #configPart)
|
||||
elseif first == "B" then
|
||||
configPart = string.sub(configPart, 2, #configPart)
|
||||
self._isBackup = true
|
||||
elseif first == "[" then
|
||||
self._isBackup = false
|
||||
else
|
||||
Spearhead.AddMissionEditorWarning("Could not parse the CAP config for group: " .. groupName)
|
||||
return
|
||||
end
|
||||
local configPart = split_string[2]
|
||||
local first = configPart:sub(1, 1)
|
||||
if first == "A" then
|
||||
self._isBackup = false
|
||||
configPart = string.sub(configPart, 2, #configPart)
|
||||
elseif first == "B" then
|
||||
configPart = string.sub(configPart, 2, #configPart)
|
||||
self._isBackup = true
|
||||
elseif first == "[" then
|
||||
self._isBackup = false
|
||||
else
|
||||
Spearhead.AddMissionEditorWarning("Could not parse the CAP config for group: " .. groupName)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
local subsplit = Spearhead.Util.split_string(configPart, "|")
|
||||
if subsplit then
|
||||
for key, value in pairs(subsplit) do
|
||||
local keySplit = Spearhead.Util.split_string(value, "]")
|
||||
local targetZone = keySplit[2]
|
||||
local allActives = string.sub(keySplit[1], 2, #keySplit[1])
|
||||
local commaSeperated = Spearhead.Util.split_string(allActives, ",")
|
||||
for _, value in pairs(commaSeperated) do
|
||||
local dashSeperated = Spearhead.Util.split_string(value, "-")
|
||||
if Spearhead.Util.tableLength(dashSeperated) > 1 then
|
||||
local from = tonumber(dashSeperated[1])
|
||||
local till = tonumber(dashSeperated[2])
|
||||
local subsplit = Spearhead.Util.split_string(configPart, "|")
|
||||
if subsplit then
|
||||
for key, value in pairs(subsplit) do
|
||||
local keySplit = Spearhead.Util.split_string(value, "]")
|
||||
local targetZone = keySplit[2]
|
||||
local allActives = string.sub(keySplit[1], 2, #keySplit[1])
|
||||
local commaSeperated = Spearhead.Util.split_string(allActives, ",")
|
||||
for _, value in pairs(commaSeperated) do
|
||||
local dashSeperated = Spearhead.Util.split_string(value, "-")
|
||||
if Spearhead.Util.tableLength(dashSeperated) > 1 then
|
||||
local from = tonumber(dashSeperated[1])
|
||||
local till = tonumber(dashSeperated[2])
|
||||
|
||||
for i = from, till do
|
||||
if Spearhead.Util.strContains(targetZone, "A") == true then
|
||||
self._targetZoneIdPerStage[tostring(i)] = string.gsub(targetZone, "A", tostring(i))
|
||||
else
|
||||
self._targetZoneIdPerStage[tostring(i)] = targetZone
|
||||
end
|
||||
end
|
||||
else
|
||||
for i = from, till do
|
||||
if Spearhead.Util.strContains(targetZone, "A") == true then
|
||||
self._targetZoneIdPerStage[tostring(dashSeperated[1])] = string.gsub(targetZone, "A", tostring(dashSeperated[1]))
|
||||
self._targetZoneIdPerStage[tostring(i)] = string.gsub(targetZone, "A", tostring(i))
|
||||
else
|
||||
self._targetZoneIdPerStage[tostring(dashSeperated[1])] = targetZone
|
||||
self._targetZoneIdPerStage[tostring(i)] = targetZone
|
||||
end
|
||||
end
|
||||
else
|
||||
if Spearhead.Util.strContains(targetZone, "A") == true then
|
||||
self._targetZoneIdPerStage[tostring(dashSeperated[1])] = string.gsub(targetZone, "A", tostring(dashSeperated[1]))
|
||||
else
|
||||
self._targetZoneIdPerStage[tostring(dashSeperated[1])] = targetZone
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
env.info("Capgroup parsed with table: " .. Spearhead.Util.toString(self._targetZoneIdPerStage))
|
||||
|
||||
else
|
||||
Spearhead.AddMissionEditorWarning("CAP Group with name: " .. groupName .. "should have at least 3 parts, but has " .. partCount)
|
||||
return nil
|
||||
end
|
||||
|
||||
env.info("Capgroup parsed with table: " .. Spearhead.Util.toString(self._targetZoneIdPerStage))
|
||||
|
||||
else
|
||||
Spearhead.AddMissionEditorWarning("CAP Group with name: " .. groupName .. "should have at least 3 parts, but has " .. partCount)
|
||||
end
|
||||
end
|
||||
|
||||
if not Spearhead then Spearhead = {} end
|
||||
|
||||
Reference in New Issue
Block a user