#BRIGADE Fixes to save/loadback assets for persistence

This commit is contained in:
Applevangelist 2024-02-27 18:13:41 +01:00
parent c36dbe1b09
commit 1e954de951
3 changed files with 8 additions and 5 deletions

View File

@ -313,8 +313,8 @@ end
-- --
-- local Path = FilePath or "C:\\Users\\<yourname>\\Saved Games\\DCS\\Missions\\" -- example path -- local Path = FilePath or "C:\\Users\\<yourname>\\Saved Games\\DCS\\Missions\\" -- example path
-- local BlueOpsFilename = BlueFileName or "ExamplePlatoonSave.csv" -- example filename -- local BlueOpsFilename = BlueFileName or "ExamplePlatoonSave.csv" -- example filename
-- local BlueSaveOps = SET_GROUP:New():FilterCoalitions("blue"):FilterPrefixes("AID"):FilterCategoryGround():FilterOnce() -- local BlueSaveOps = SET_OPSGROUP:New():FilterCoalitions("blue"):FilterCategoryGround():FilterOnce()
-- UTILS.SaveSetOfGroups(BlueSaveOps,Path,BlueOpsFilename) -- UTILS.SaveSetOfOpsGroups(BlueSaveOps,Path,BlueOpsFilename)
-- --
-- where Path and Filename are strings, as chosen by you. -- where Path and Filename are strings, as chosen by you.
-- You can then load back the assets at the start of your next mission run. Be aware that it takes a couple of seconds for the -- You can then load back the assets at the start of your next mission run. Be aware that it takes a couple of seconds for the
@ -324,7 +324,7 @@ end
-- local Path = FilePath or "C:\\Users\\<yourname>\\Saved Games\\DCS\\Missions\\" -- example path -- local Path = FilePath or "C:\\Users\\<yourname>\\Saved Games\\DCS\\Missions\\" -- example path
-- local BlueOpsFilename = BlueFileName or "ExamplePlatoonSave.csv" -- example filename -- local BlueOpsFilename = BlueFileName or "ExamplePlatoonSave.csv" -- example filename
-- if UTILS.CheckFileExists(Path,BlueOpsFilename) then -- if UTILS.CheckFileExists(Path,BlueOpsFilename) then
-- local loadback = UTILS.LoadSetOfGroups(Path,BlueOpsFilename,false) -- local loadback = UTILS.LoadSetOfOpsGroups(Path,BlueOpsFilename,false)
-- for _,_platoondata in pairs (loadback) do -- for _,_platoondata in pairs (loadback) do
-- local groupname = _platoondata.groupname -- #string -- local groupname = _platoondata.groupname -- #string
-- local coordinate = _platoondata.coordinate -- Core.Point#COORDINATE -- local coordinate = _platoondata.coordinate -- Core.Point#COORDINATE

View File

@ -3190,14 +3190,14 @@ function LEGION.CalculateAssetMissionScore(asset, MissionType, TargetVec2, Inclu
elseif (currmission.type==AUFTRAG.Type.ONGUARD or currmission.type==AUFTRAG.Type.PATROLZONE) and (MissionType==AUFTRAG.Type.ARTY or MissionType==AUFTRAG.Type.GROUNDATTACK) then elseif (currmission.type==AUFTRAG.Type.ONGUARD or currmission.type==AUFTRAG.Type.PATROLZONE) and (MissionType==AUFTRAG.Type.ARTY or MissionType==AUFTRAG.Type.GROUNDATTACK) then
score=score+25 score=score+25
elseif currmission.type==AUFTRAG.Type.NOTHING then elseif currmission.type==AUFTRAG.Type.NOTHING then
score=score+25 score=score+30
end end
end end
if MissionType==AUFTRAG.Type.OPSTRANSPORT or MissionType==AUFTRAG.Type.AMMOSUPPLY or MissionType==AUFTRAG.Type.AWACS or MissionType==AUFTRAG.Type.FUELSUPPLY or MissionType==AUFTRAG.Type.TANKER then if MissionType==AUFTRAG.Type.OPSTRANSPORT or MissionType==AUFTRAG.Type.AMMOSUPPLY or MissionType==AUFTRAG.Type.AWACS or MissionType==AUFTRAG.Type.FUELSUPPLY or MissionType==AUFTRAG.Type.TANKER then
-- TODO: need to check for missions that do not require ammo like transport, recon, awacs, tanker etc. -- TODO: need to check for missions that do not require ammo like transport, recon, awacs, tanker etc.
-- We better take a fresh asset. Sometimes spawned assets to something else, which is difficult to check. -- We better take a fresh asset. Sometimes spawned assets do something else, which is difficult to check.
score=score-10 score=score-10
else else
-- Combat mission. -- Combat mission.

View File

@ -2644,6 +2644,9 @@ function UTILS.SaveSetOfGroups(Set,Path,Filename,Structured)
if group and group:IsAlive() then if group and group:IsAlive() then
local name = group:GetName() local name = group:GetName()
local template = string.gsub(name,"-(.+)$","") local template = string.gsub(name,"-(.+)$","")
if string.find(name,"AID") then
template = string.gsub(name,"(.AID.%d+$","")
end
if string.find(template,"#") then if string.find(template,"#") then
template = string.gsub(name,"#(%d+)$","") template = string.gsub(name,"#(%d+)$","")
end end