This commit is contained in:
2025-05-25 23:39:34 +02:00
parent e1f392e8a3
commit 0d6809552d
5 changed files with 20 additions and 22 deletions
Binary file not shown.
-7
View File
@@ -622,18 +622,11 @@ 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
end
end
--- takes a list of units and returns all the units that are in any of the zones
---@param unit_names table unit names
+11 -2
View File
@@ -26,16 +26,25 @@ function SpearheadGroup:SpawnCorpsesOnly()
if self._isSpawned == true then return end
local group = Spearhead.DcsUtil.SpawnGroupTemplate(self.groupName)
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(self.groupName, 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
self._isSpawned = true
@@ -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
+1 -1
View File
@@ -53,7 +53,7 @@ SpearheadConfig = {
maxMissionStage = 10,
--Stage starting number
startingStage = 1,
startingStage = 2,
---DEBUG logging. Consider keeping this disabled
debugEnabled = true