Fix scripted paradrops

A recent PR changed ParaDrop from an Effect to an Activity. Idle triggers in the mission scripts however have already queued activities for the paradropped units, so the ParaDrop activity would only run once the first activity had finished (which could never happen).
This commit is contained in:
Oliver Brakmann
2015-07-18 21:13:33 +02:00
committed by abcdefg30
parent 3e7134ae6b
commit d5c65b59b0
6 changed files with 41 additions and 7 deletions

View File

@@ -16,7 +16,13 @@ else
ChangeStance = true
end
IdleHunt = function(actor) Trigger.OnIdle(actor, actor.Hunt) end
IdleHunt = function(actor)
Trigger.OnIdle(actor, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
end
ProduceUnits = function(factory, count)
if ussr.IsProducing("e1") then

View File

@@ -27,7 +27,13 @@ else
ChangeStance = true
end
IdleHunt = function(actor) Trigger.OnIdle(actor, actor.Hunt) end
IdleHunt = function(actor)
Trigger.OnIdle(actor, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
end
Tick = function()
if TeleportJeepCamera and Jeep.IsInWorld then

View File

@@ -36,9 +36,17 @@ ParadropWaypoints = { Paradrop1, Paradrop2, Paradrop3, Paradrop4, Paradrop5, Par
BindActorTriggers = function(a)
if a.HasProperty("Hunt") then
if a.Owner == allies then
Trigger.OnIdle(a, a.Hunt)
Trigger.OnIdle(a, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
else
Trigger.OnIdle(a, function(a) a.AttackMove(AlliedTechnologyCenter.Location) end)
Trigger.OnIdle(a, function(a)
if a.IsInWorld then
a.AttackMove(AlliedTechnologyCenter.Location)
end
end)
end
end

View File

@@ -60,7 +60,11 @@ ParadropSovietUnits = function()
local units = powerproxy.SendParatroopers(MCVDeployLocation.CenterPosition, false, 256 - 53)
Utils.Do(units, function(a)
Trigger.OnIdle(a, a.Hunt)
Trigger.OnIdle(a, function(actor)
if actor.IsInWorld then
actor.Hunt()
end
end)
end)
powerproxy.Destroy()

View File

@@ -185,7 +185,11 @@ SendSovietParadrops = function(table)
local units = powerproxy.SendParatroopers(table[2].CenterPosition, false, table[1])
Utils.Do(units, function(unit)
Trigger.OnIdle(unit, unit.Hunt)
Trigger.OnIdle(unit, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
end)
end

View File

@@ -35,7 +35,13 @@ ParaWaves =
{ AttackTicks * 3, { "SovietSquad", SovietParaDrop1 } }
}
IdleHunt = function(unit) Trigger.OnIdle(unit, unit.Hunt) end
IdleHunt = function(unit)
Trigger.OnIdle(unit, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
end
GuardHarvester = function(unit, harvester)
if not unit.IsDead then