mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#STATIC
* Added GetLife() GetLife0() #TARGET * Added usesage of Life functions to TARGET
This commit is contained in:
commit
11ef7c6a00
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user