* Added GetLife() GetLife0()
#TARGET
* Added usesage of Life functions to TARGET
This commit is contained in:
Applevangelist 2022-10-12 09:36:36 +02:00
commit 11ef7c6a00
2 changed files with 27 additions and 3 deletions

View File

@ -147,7 +147,7 @@ _TARGETID=0
--- TARGET class version.
-- @field #string version
TARGET.version="0.5.3"
TARGET.version="0.5.4"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
@ -830,8 +830,8 @@ function TARGET:_AddObject(Object)
if static and static:IsAlive() then
target.Life0=1
target.Life=1
target.Life0=static:GetLife0()
target.Life=static:GetLife()
target.N0=target.N0+1
table.insert(self.elements, target.Name)

View File

@ -55,9 +55,33 @@ STATIC = {
function STATIC:Register( StaticName )
local self = BASE:Inherit( self, POSITIONABLE:New( StaticName ) )
self.StaticName = StaticName
local DCSStatic = StaticObject.getByName( self.StaticName )
if DCSStatic then
local Life0 = DCSStatic:getLife() or 1
self.Life0 = Life0
end
return self
end
--- Get initial life points
-- @param #STATIC self
-- @return #number lifepoints
function STATIC:GetLife0()
return self.Life0 or 1
end
--- Get current life points
-- @param #STATIC self
-- @return #number lifepoints or nil
function STATIC:GetLife()
local DCSStatic = StaticObject.getByName( self.StaticName )
if DCSStatic then
return DCSStatic:getLife() or 1
end
return nil
end
--- Finds a STATIC from the _DATABASE using a DCSStatic object.
-- @param #STATIC self