Fix unarmed units idling on the ts shellmap

This commit is contained in:
abcdefg30
2019-09-22 13:49:21 +02:00
committed by teinarss
parent 72bff74ca5
commit 9356c8afd0

View File

@@ -25,8 +25,8 @@ VGForceInterval = 15
ProducedUnitTypes = ProducedUnitTypes =
{ {
{ nodhand1, { "e1", "e3" } }, { nodhand1, { "e1", "e3" }, GDIBase.Location },
{ gdibar1, { "e1", "e2" } } { gdibar1, { "e1", "e2" }, NodBase.Location }
} }
ProduceUnits = function(t) ProduceUnits = function(t)
@@ -41,7 +41,7 @@ end
SetupFactories = function() SetupFactories = function()
Utils.Do(ProducedUnitTypes, function(pair) Utils.Do(ProducedUnitTypes, function(pair)
Trigger.OnProduction(pair[1], function(_, a) BindActorTriggers(a) end) Trigger.OnProduction(pair[1], function(_, a) BindActorTriggers(a, pair[3]) end)
end) end)
end end
@@ -56,13 +56,7 @@ end
SendNodInfantry = function() SendNodInfantry = function()
local units = Reinforcements.Reinforce(nod, NForce, NForcePath, NForceInterval) local units = Reinforcements.Reinforce(nod, NForce, NForcePath, NForceInterval)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
BindActorTriggers(unit) BindActorTriggers(unit, GDIBase.Location)
if unit.HasProperty("AttackMove") then
unit.AttackMove(GDIBase.Location)
else
unit.Move(GDIBase.Location)
end
end) end)
Trigger.AfterDelay(DateTime.Seconds(60), SendNodInfantry) Trigger.AfterDelay(DateTime.Seconds(60), SendNodInfantry)
end end
@@ -70,13 +64,7 @@ end
SendNodVehicles = function() SendNodVehicles = function()
local units = Reinforcements.Reinforce(nod, VNForce, VNForcePath, VNForceInterval) local units = Reinforcements.Reinforce(nod, VNForce, VNForcePath, VNForceInterval)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
BindActorTriggers(unit) BindActorTriggers(unit, GDIBase.Location)
if unit.HasProperty("AttackMove") then
unit.AttackMove(GDIBase.Location)
else
unit.Move(GDIBase.Location)
end
end) end)
Trigger.AfterDelay(DateTime.Seconds(110), SendNodVehicles) Trigger.AfterDelay(DateTime.Seconds(110), SendNodVehicles)
end end
@@ -84,13 +72,7 @@ end
SendGDIInfantry = function() SendGDIInfantry = function()
local units = Reinforcements.Reinforce(gdi, GForce, GForcePath, GForceInterval) local units = Reinforcements.Reinforce(gdi, GForce, GForcePath, GForceInterval)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
BindActorTriggers(unit) BindActorTriggers(unit, NodBase.Location)
if unit.HasProperty("AttackMove") then
unit.AttackMove(NodBase.Location)
else
unit.Move(NodBase.Location)
end
end) end)
Trigger.AfterDelay(DateTime.Seconds(60), SendGDIInfantry) Trigger.AfterDelay(DateTime.Seconds(60), SendGDIInfantry)
end end
@@ -98,20 +80,24 @@ end
SendGDIVehicles = function() SendGDIVehicles = function()
local units = Reinforcements.Reinforce(gdi, VGForce, VGForcePath, VGForceInterval) local units = Reinforcements.Reinforce(gdi, VGForce, VGForcePath, VGForceInterval)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
BindActorTriggers(unit) BindActorTriggers(unit, NodBase.Location)
if unit.HasProperty("AttackMove") then
unit.AttackMove(NodBase.Location)
else
unit.Move(NodBase.Location)
end
end) end)
Trigger.AfterDelay(DateTime.Seconds(110), SendGDIVehicles) Trigger.AfterDelay(DateTime.Seconds(110), SendGDIVehicles)
end end
BindActorTriggers = function(a) BindActorTriggers = function(a, loc)
if a.HasProperty("AttackMove") then
a.AttackMove(loc)
else
a.Move(loc)
end
if a.HasProperty("Hunt") then if a.HasProperty("Hunt") then
Trigger.OnIdle(a, a.Hunt) Trigger.OnIdle(a, a.Hunt)
else
Trigger.OnIdle(a, function()
a.Move(loc)
end)
end end
if a.HasProperty("HasPassengers") then if a.HasProperty("HasPassengers") then
@@ -123,7 +109,7 @@ BindActorTriggers = function(a)
end) end)
Trigger.OnPassengerExited(a, function(_, p) Trigger.OnPassengerExited(a, function(_, p)
BindActorTriggers(p) BindActorTriggers(p, loc)
end) end)
end end
end end