diff --git a/_miz/SPEARHEADDEV.miz b/_miz/SPEARHEADDEV.miz index e655aa5..2bcf5b0 100644 Binary files a/_miz/SPEARHEADDEV.miz and b/_miz/SPEARHEADDEV.miz differ diff --git a/classes/spearhead_base.lua b/classes/spearhead_base.lua index 7ab860d..d61b9f2 100644 --- a/classes/spearhead_base.lua +++ b/classes/spearhead_base.lua @@ -622,16 +622,9 @@ do -- INIT DCS_UTIL ---destroy the given unit ---@param unitName string function DCS_UTIL.DestroyUnit(unitName) - if DCS_UTIL.IsGroupStatic(unitName) == true then - local object = StaticObject.getByName(unitName) - if object ~= nil then - object:destroy() - end - else - local unit = Unit.getByName(unitName) - if unit and unit:isExist() then - unit:destroy() - end + local unit = Unit.getByName(unitName) + if unit and unit:isExist() then + unit:destroy() end end diff --git a/classes/stageClasses/Groups/SpearheadGroup.lua b/classes/stageClasses/Groups/SpearheadGroup.lua index 50edd3d..a964353 100644 --- a/classes/stageClasses/Groups/SpearheadGroup.lua +++ b/classes/stageClasses/Groups/SpearheadGroup.lua @@ -26,13 +26,22 @@ function SpearheadGroup:SpawnCorpsesOnly() if self._isSpawned == true then return end - local group = Spearhead.DcsUtil.SpawnGroupTemplate(self.groupName) - if group then - for _, unit in pairs(group:getUnits()) do - local deathState = Spearhead.classes.persistence.Persistence.UnitDeadState(unit:getName()) - Spearhead.DcsUtil.DestroyUnit(self.groupName, unit:getName()) - if deathState and deathState.isDead == true then - Spearhead.DcsUtil.SpawnCorpse(deathState.country_id, unit:getName(), deathState.type, deathState.pos, deathState.heading) + local group, isStatic = Spearhead.DcsUtil.SpawnGroupTemplate(self.groupName) + if isStatic == true then + self._isStatic = true + local deathState = Spearhead.classes.persistence.Persistence.UnitDeadState(self.groupName) + if deathState and deathState.isDead == true then + Spearhead.DcsUtil.DestroyGroup(self.groupName) + Spearhead.DcsUtil.SpawnCorpse(deathState.country_id, self.groupName, deathState.type, deathState.pos, deathState.heading) + end + else + if group then + for _, unit in pairs(group:getUnits()) do + local deathState = Spearhead.classes.persistence.Persistence.UnitDeadState(unit:getName()) + Spearhead.DcsUtil.DestroyUnit(unit:getName()) + if deathState and deathState.isDead == true then + Spearhead.DcsUtil.SpawnCorpse(deathState.country_id, unit:getName(), deathState.type, deathState.pos, deathState.heading) + end end end end diff --git a/classes/stageClasses/helpers/BattleManager.lua b/classes/stageClasses/helpers/BattleManager.lua index 0163068..144977b 100644 --- a/classes/stageClasses/helpers/BattleManager.lua +++ b/classes/stageClasses/helpers/BattleManager.lua @@ -184,10 +184,6 @@ end ---@return number function BattleManager:getBestAmmo(unit) - if unit:getName() == "Ground-32-1" then - env.info(Spearhead.Util.toString(unit:getAmmo())) - end - local ammo = unit:getAmmo() if not ammo then return 3221225470, 1 end -- Default ammo if no ammo is found diff --git a/dev/dev_config.lua b/dev/dev_config.lua index ca5287f..c20c115 100644 --- a/dev/dev_config.lua +++ b/dev/dev_config.lua @@ -53,7 +53,7 @@ SpearheadConfig = { maxMissionStage = 10, --Stage starting number - startingStage = 1, + startingStage = 2, ---DEBUG logging. Consider keeping this disabled debugEnabled = true