fix
This commit is contained in:
Binary file not shown.
@@ -622,16 +622,9 @@ do -- INIT DCS_UTIL
|
|||||||
---destroy the given unit
|
---destroy the given unit
|
||||||
---@param unitName string
|
---@param unitName string
|
||||||
function DCS_UTIL.DestroyUnit(unitName)
|
function DCS_UTIL.DestroyUnit(unitName)
|
||||||
if DCS_UTIL.IsGroupStatic(unitName) == true then
|
local unit = Unit.getByName(unitName)
|
||||||
local object = StaticObject.getByName(unitName)
|
if unit and unit:isExist() then
|
||||||
if object ~= nil then
|
unit:destroy()
|
||||||
object:destroy()
|
|
||||||
end
|
|
||||||
else
|
|
||||||
local unit = Unit.getByName(unitName)
|
|
||||||
if unit and unit:isExist() then
|
|
||||||
unit:destroy()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -26,13 +26,22 @@ function SpearheadGroup:SpawnCorpsesOnly()
|
|||||||
|
|
||||||
if self._isSpawned == true then return end
|
if self._isSpawned == true then return end
|
||||||
|
|
||||||
local group = Spearhead.DcsUtil.SpawnGroupTemplate(self.groupName)
|
local group, isStatic = Spearhead.DcsUtil.SpawnGroupTemplate(self.groupName)
|
||||||
if group then
|
if isStatic == true then
|
||||||
for _, unit in pairs(group:getUnits()) do
|
self._isStatic = true
|
||||||
local deathState = Spearhead.classes.persistence.Persistence.UnitDeadState(unit:getName())
|
local deathState = Spearhead.classes.persistence.Persistence.UnitDeadState(self.groupName)
|
||||||
Spearhead.DcsUtil.DestroyUnit(self.groupName, unit:getName())
|
if deathState and deathState.isDead == true then
|
||||||
if deathState and deathState.isDead == true then
|
Spearhead.DcsUtil.DestroyGroup(self.groupName)
|
||||||
Spearhead.DcsUtil.SpawnCorpse(deathState.country_id, unit:getName(), deathState.type, deathState.pos, deathState.heading)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -184,10 +184,6 @@ end
|
|||||||
---@return number
|
---@return number
|
||||||
function BattleManager:getBestAmmo(unit)
|
function BattleManager:getBestAmmo(unit)
|
||||||
|
|
||||||
if unit:getName() == "Ground-32-1" then
|
|
||||||
env.info(Spearhead.Util.toString(unit:getAmmo()))
|
|
||||||
end
|
|
||||||
|
|
||||||
local ammo = unit:getAmmo()
|
local ammo = unit:getAmmo()
|
||||||
|
|
||||||
if not ammo then return 3221225470, 1 end -- Default ammo if no ammo is found
|
if not ammo then return 3221225470, 1 end -- Default ammo if no ammo is found
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ SpearheadConfig = {
|
|||||||
maxMissionStage = 10,
|
maxMissionStage = 10,
|
||||||
|
|
||||||
--Stage starting number
|
--Stage starting number
|
||||||
startingStage = 1,
|
startingStage = 2,
|
||||||
|
|
||||||
---DEBUG logging. Consider keeping this disabled
|
---DEBUG logging. Consider keeping this disabled
|
||||||
debugEnabled = true
|
debugEnabled = true
|
||||||
|
|||||||
Reference in New Issue
Block a user