This commit is contained in:
Frank 2020-08-29 21:24:15 +02:00
parent 2d6092c114
commit a126906776
2 changed files with 3 additions and 42 deletions

View File

@ -2245,45 +2245,6 @@ function GROUP:GetDCSDesc(n)
return nil
end
--- Get health of the group.
-- @param #GROUP self
-- @return #number Health in percent.
function GROUP:GetHealth()
local lp=0
local lp0=0
local units=self:GetUnits()
for _,_unit in pairs(units or {}) do
local unit=_unit --Wrapper.Unit#UNIT
if unit and unit:IsAlive() then
local life=unit:GetLife()
local life0=unit:GetLife0()
life0=math.max(life0, life) --Issue with ships
lp=lp+life
lp0=lp0+life
end
end
if lp0>0 then
return lp/lp0*100
else
return 0
end
end
--- Get damage of the group.
-- @param #GROUP self
-- @return #number Damage in percent.
function GROUP:GetDamage()
return 100-self:GetHealth()
end
--- Get the generalized attribute of a self.
-- Note that for a heterogenious self, the attribute is determined from the attribute of the first unit!

View File

@ -304,8 +304,7 @@ function POSITIONABLE:GetPointVec3()
-- Get 3D vector.
local PositionableVec3 = self:GetPositionVec3()
if self.pointvec3 then
--env.info("FF GetCoordinate GOT for "..tostring(self.PositionableName))
if false and self.pointvec3 then
-- Update vector.
self.pointvec3.x=PositionableVec3.x
@ -313,9 +312,10 @@ function POSITIONABLE:GetPointVec3()
self.pointvec3.z=PositionableVec3.z
else
--env.info("FF GetCoordinate NEW for "..tostring(self.PositionableName))
-- Create a new POINT_VEC3 object.
self.pointvec3=POINT_VEC3:NewFromVec3(PositionableVec3)
end
return self.pointvec3