Merge pull request #11666 from abcdefg30/survFix
Add an IsDead check to prevent crashes in survival01
This commit is contained in:
@@ -66,45 +66,38 @@ SovietBuildings = { Barrack1, SubPen, RadarDome, AdvancedPowerPlant1, AdvancedPo
|
|||||||
IdleTrigger = function(units, dest)
|
IdleTrigger = function(units, dest)
|
||||||
Utils.Do(units, function(unit)
|
Utils.Do(units, function(unit)
|
||||||
|
|
||||||
Trigger.OnIdle(unit, function()
|
if not unit.IsDead then
|
||||||
local bool = Utils.All(units, function(unit) return unit.IsIdle end)
|
Trigger.OnIdle(unit, function()
|
||||||
if bool then
|
local bool = Utils.All(units, function(unit) return unit.IsIdle end)
|
||||||
Utils.Do(units, function(unit)
|
if bool then
|
||||||
if not unit.IsDead then
|
SetupHuntTrigger(units)
|
||||||
Trigger.ClearAll(unit)
|
end
|
||||||
Trigger.AfterDelay(0, function()
|
end)
|
||||||
if not unit.IsDead then
|
|
||||||
if dest then unit.AttackMove(dest, 3) end
|
|
||||||
Trigger.OnIdle(unit, unit.Hunt)
|
|
||||||
Trigger.OnCapture(unit, function()
|
|
||||||
Trigger.ClearAll(unit)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
Trigger.OnDamaged(unit, function()
|
Trigger.OnDamaged(unit, function()
|
||||||
Utils.Do(units, function(unit)
|
SetupHuntTrigger(units)
|
||||||
|
end)
|
||||||
|
|
||||||
|
Trigger.OnCapture(unit, function()
|
||||||
|
Trigger.ClearAll(unit)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
SetupHuntTrigger = function(units)
|
||||||
|
Utils.Do(units, function(unit)
|
||||||
|
if not unit.IsDead then
|
||||||
|
Trigger.ClearAll(unit)
|
||||||
|
Trigger.AfterDelay(0, function()
|
||||||
if not unit.IsDead then
|
if not unit.IsDead then
|
||||||
Trigger.ClearAll(unit)
|
Trigger.OnIdle(unit, unit.Hunt)
|
||||||
Trigger.AfterDelay(0, function()
|
Trigger.OnCapture(unit, function()
|
||||||
if not unit.IsDead then
|
Trigger.ClearAll(unit)
|
||||||
Trigger.OnIdle(unit, unit.Hunt)
|
|
||||||
Trigger.OnCapture(unit, function()
|
|
||||||
Trigger.ClearAll(unit)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end
|
||||||
|
|
||||||
Trigger.OnCapture(unit, function()
|
|
||||||
Trigger.ClearAll(unit)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user