mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
#STATIC
* Add Life0 to STATIC Object * Added functions for STATIC:GetLife() and STATIC:GetLife0()
This commit is contained in:
parent
c5145a38e2
commit
3434ef47d9
@ -55,9 +55,33 @@ STATIC = {
|
|||||||
function STATIC:Register( StaticName )
|
function STATIC:Register( StaticName )
|
||||||
local self = BASE:Inherit( self, POSITIONABLE:New( StaticName ) )
|
local self = BASE:Inherit( self, POSITIONABLE:New( StaticName ) )
|
||||||
self.StaticName = 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
|
return self
|
||||||
end
|
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.
|
--- Finds a STATIC from the _DATABASE using a DCSStatic object.
|
||||||
-- @param #STATIC self
|
-- @param #STATIC self
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user