WAREHOUSE

- Added runway destroyed check.
This commit is contained in:
Frank
2020-11-17 00:25:37 +01:00
parent 9cac2674c4
commit 0c07a660ee
5 changed files with 122 additions and 12 deletions

View File

@@ -2846,7 +2846,7 @@ function AUFTRAG:_TargetFromObject(Object)
end
-- Debug info.
self:T(self.lid..string.format("Mission Target %s Type=%s, Ntargets=%d, Lifepoints=%d", self.engageTarget.lid, self.engageTarget.lid, self.engageTarget.Ntargets0, self.engageTarget:GetLife()))
self:I(self.lid..string.format("Mission Target %s Type=%s, Ntargets=%d, Lifepoints=%d", self.engageTarget.lid, self.engageTarget.lid, self.engageTarget.Ntargets0, self.engageTarget:GetLife()))
return self
end

View File

@@ -2781,6 +2781,10 @@ function OPSGROUP:RouteToMission(mission, delay)
-- Delayed call.
self:ScheduleOnce(delay, OPSGROUP.RouteToMission, self, mission)
else
if self:IsDead() then
return
end
-- ID of current waypoint.
local uid=self:GetWaypointCurrent().uid

View File

@@ -549,11 +549,21 @@ end
function SQUADRON:AddTacanChannel(ChannelMin, ChannelMax)
ChannelMax=ChannelMax or ChannelMin
if ChannelMin>126 then
self:E(self.lid.."ERROR: TACAN Channel must be <= 126! Will not add to available channels")
return self
end
if ChannelMax>126 then
self:E(self.lid.."WARNING: TACAN Channel must be <= 126! Adjusting ChannelMax to 126")
ChannelMax=126
end
for i=ChannelMin,ChannelMax do
self.tacanChannel[i]=true
end
return self
end
--- Get an unused TACAN channel.

View File

@@ -425,7 +425,7 @@ function TARGET:OnEventUnitDeadOrLost(EventData)
if EventData and EventData.IniUnitName then
-- Debug info.
self:I(self.lid..string.format("EVENT: Unit %s dead or lost!", EventData.IniUnitName))
self:T(self.lid..string.format("EVENT: Unit %s dead or lost!", tostring(EventData.IniUnitName)))
-- Get target.
local target=self:GetTargetByName(EventData.IniUnitName)
@@ -438,7 +438,7 @@ function TARGET:OnEventUnitDeadOrLost(EventData)
if target and target.Status==TARGET.ObjectStatus.ALIVE then
-- Debug message.
self:I(self.lid..string.format("EVENT: target unit %s dead or lost ==> destroyed", target.Name))
self:T(self.lid..string.format("EVENT: target unit %s dead or lost ==> destroyed", tostring(target.Name)))
-- Trigger object destroyed event.
self:ObjectDestroyed(target)
@@ -1008,7 +1008,7 @@ function TARGET:CountTargets()
for _,_unit in pairs(units or {}) do
local unit=_unit --Wrapper.Unit#UNIT
if unit and unit:IsAlive() and unit:GetLife()>1 then
if unit and unit:IsAlive()~=nil and unit:GetLife()>1 then
N=N+1
end
end