mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Fix possible DCS Unit not existing in OPSGROUP:onafterElementDamaged(From, Event, To, Element)
This commit is contained in:
parent
7157836eb1
commit
b1e233421e
@ -7236,7 +7236,7 @@ function OPSGROUP:onafterElementDamaged(From, Event, To, Element)
|
||||
|
||||
local lifepoints=0
|
||||
|
||||
if Element.DCSunit then --and Element.DCSunit:isExist() then
|
||||
if Element.DCSunit and Element.DCSunit:isExist() then
|
||||
|
||||
-- Get life of unit
|
||||
lifepoints=Element.DCSunit:getLife()
|
||||
@ -7244,6 +7244,10 @@ function OPSGROUP:onafterElementDamaged(From, Event, To, Element)
|
||||
-- Debug output.
|
||||
self:T(self.lid..string.format("Element life %s: %.2f/%.2f", Element.name, lifepoints, Element.life0))
|
||||
|
||||
else
|
||||
|
||||
self:T(self.lid..string.format("Element.DCSunit %s does not exist!", Element.name))
|
||||
|
||||
end
|
||||
|
||||
if lifepoints<=1.0 then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user