mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
up
This commit is contained in:
parent
2d6092c114
commit
a126906776
@ -2245,45 +2245,6 @@ function GROUP:GetDCSDesc(n)
|
|||||||
return nil
|
return nil
|
||||||
end
|
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.
|
--- Get the generalized attribute of a self.
|
||||||
-- Note that for a heterogenious self, the attribute is determined from the attribute of the first unit!
|
-- Note that for a heterogenious self, the attribute is determined from the attribute of the first unit!
|
||||||
|
|||||||
@ -304,8 +304,7 @@ function POSITIONABLE:GetPointVec3()
|
|||||||
-- Get 3D vector.
|
-- Get 3D vector.
|
||||||
local PositionableVec3 = self:GetPositionVec3()
|
local PositionableVec3 = self:GetPositionVec3()
|
||||||
|
|
||||||
if self.pointvec3 then
|
if false and self.pointvec3 then
|
||||||
--env.info("FF GetCoordinate GOT for "..tostring(self.PositionableName))
|
|
||||||
|
|
||||||
-- Update vector.
|
-- Update vector.
|
||||||
self.pointvec3.x=PositionableVec3.x
|
self.pointvec3.x=PositionableVec3.x
|
||||||
@ -313,9 +312,10 @@ function POSITIONABLE:GetPointVec3()
|
|||||||
self.pointvec3.z=PositionableVec3.z
|
self.pointvec3.z=PositionableVec3.z
|
||||||
|
|
||||||
else
|
else
|
||||||
--env.info("FF GetCoordinate NEW for "..tostring(self.PositionableName))
|
|
||||||
|
|
||||||
|
-- Create a new POINT_VEC3 object.
|
||||||
self.pointvec3=POINT_VEC3:NewFromVec3(PositionableVec3)
|
self.pointvec3=POINT_VEC3:NewFromVec3(PositionableVec3)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.pointvec3
|
return self.pointvec3
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user