Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Applevangelist
2023-06-13 18:00:18 +02:00

View File

@@ -1812,7 +1812,7 @@ function OPSGROUP:GetVec3(UnitName)
local carrier=self:_GetMyCarrierElement() local carrier=self:_GetMyCarrierElement()
if carrier and carrier.status~=OPSGROUP.ElementStatus.DEAD and self:IsLoaded() then if carrier and carrier.status~=OPSGROUP.ElementStatus.DEAD and self:IsLoaded() then
local unit=carrier.unit local unit=carrier.unit
if unit and unit:IsAlive()~=nil then if unit and unit:IsExist() then
vec3=unit:GetVec3() vec3=unit:GetVec3()
return vec3 return vec3
end end
@@ -12813,7 +12813,7 @@ function OPSGROUP:GetAmmoTot()
for _,_unit in pairs(units or {}) do for _,_unit in pairs(units or {}) do
local unit=_unit --Wrapper.Unit#UNIT local unit=_unit --Wrapper.Unit#UNIT
if unit and unit:IsAlive()~=nil then if unit and unit:IsExist() then
-- Get ammo of the unit. -- Get ammo of the unit.
local ammo=self:GetAmmoUnit(unit) local ammo=self:GetAmmoUnit(unit)
@@ -12850,8 +12850,6 @@ function OPSGROUP:GetAmmoUnit(unit, display)
display=false display=false
end end
unit=unit or self.group:GetUnit(1)
-- Init counter. -- Init counter.
local nammo=0 local nammo=0
local nshells=0 local nshells=0
@@ -12866,6 +12864,10 @@ function OPSGROUP:GetAmmoUnit(unit, display)
local ntorps=0 local ntorps=0
local nbombs=0 local nbombs=0
unit=unit or self.group:GetUnit(1)
if unit and unit:IsExist() then
-- Output. -- Output.
local text=string.format("OPSGROUP group %s - unit %s:\n", self.groupname, unit:GetName()) local text=string.format("OPSGROUP group %s - unit %s:\n", self.groupname, unit:GetName())
@@ -12979,6 +12981,8 @@ function OPSGROUP:GetAmmoUnit(unit, display)
self:T3(self.lid..text) self:T3(self.lid..text)
end end
end
-- Total amount of ammunition. -- Total amount of ammunition.
nammo=nshells+nrockets+nmissiles+nbombs+ntorps nammo=nshells+nrockets+nmissiles+nbombs+ntorps