mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Ops
This commit is contained in:
@@ -244,6 +244,19 @@ function TARGET:AddObject(Object)
|
||||
|
||||
end
|
||||
|
||||
--- Check if TARGET is alive.
|
||||
-- @param #TARGET self
|
||||
-- @param #boolean If true, target is alive.
|
||||
function TARGET:IsAlive()
|
||||
return self:Is("Alive")
|
||||
end
|
||||
|
||||
--- Check if TARGET is dead.
|
||||
-- @param #TARGET self
|
||||
-- @param #boolean If true, target is dead.
|
||||
function TARGET:IsDead()
|
||||
return self:Is("Dead")
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Start & Status
|
||||
@@ -302,7 +315,7 @@ function TARGET:onafterStatus(From, Event, To)
|
||||
end
|
||||
|
||||
-- Log output verbose=1.
|
||||
if self.verbose>=1 then
|
||||
if self.verbose>=0 then
|
||||
local text=string.format("%s: Targets=%d/%d Life=%.1f/%.1f Damage=%.1f", fsmstate, self:CountTargets(), self.Ntargets0, self:GetLife(), self:GetLife0(), self:GetDamage())
|
||||
if damaged then
|
||||
text=text.." Damaged!"
|
||||
@@ -311,7 +324,7 @@ function TARGET:onafterStatus(From, Event, To)
|
||||
end
|
||||
|
||||
-- Log output verbose=2.
|
||||
if self.verbose>=2 then
|
||||
if self.verbose>=0 then
|
||||
local text="Target:"
|
||||
for i,_target in pairs(self.targets) do
|
||||
local target=_target --#TARGET.Object
|
||||
@@ -349,7 +362,8 @@ end
|
||||
-- @param #TARGET.Object Target Target object.
|
||||
function TARGET:onafterObjectDestroyed(From, Event, To, Target)
|
||||
|
||||
self:T(self.lid..string.format("Object %s destroyed", Target.Name))
|
||||
-- Debug message.
|
||||
self:I(self.lid..string.format("Object %s destroyed", Target.Name))
|
||||
|
||||
-- Set target status.
|
||||
Target.Status=TARGET.ObjectStatus.DEAD
|
||||
@@ -405,16 +419,20 @@ function TARGET:OnEventUnitDeadOrLost(EventData)
|
||||
if EventData and EventData.IniUnitName then
|
||||
|
||||
-- Debug info.
|
||||
--self:T3(self.lid..string.format("EVENT: Unit %s dead or lost!", EventData.IniUnitName))
|
||||
self:I(self.lid..string.format("EVENT: Unit %s dead or lost!", EventData.IniUnitName))
|
||||
|
||||
-- Get target.
|
||||
local target=self:GetTargetByName(EventData.IniUnitName)
|
||||
|
||||
if not target then
|
||||
target=self:GetTargetByName(EventData.IniGroupName)
|
||||
end
|
||||
|
||||
-- Check if this is one of ours.
|
||||
if target and target.Status==TARGET.ObjectStatus.ALIVE then
|
||||
|
||||
-- Debug message.
|
||||
self:T3(self.lid..string.format("EVENT: target unit %s dead or lost ==> destroyed", target.Name))
|
||||
self:I(self.lid..string.format("EVENT: target unit %s dead or lost ==> destroyed", target.Name))
|
||||
|
||||
-- Trigger object destroyed event.
|
||||
self:ObjectDestroyed(target)
|
||||
@@ -684,7 +702,11 @@ function TARGET:GetTargetVec3(Target)
|
||||
|
||||
if object and object:IsAlive() then
|
||||
|
||||
return object:GetVec3()
|
||||
return object:GetVec3()
|
||||
|
||||
else
|
||||
|
||||
return nil
|
||||
|
||||
end
|
||||
|
||||
@@ -1007,7 +1029,7 @@ function TARGET:CountTargets()
|
||||
-- No target we can check!
|
||||
|
||||
else
|
||||
self:E(self.lid.."ERROR unknown target type")
|
||||
self:E(self.lid.."ERROR: Unknown target type! Cannot count targets")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user