Group bot AttackMove orders.
This commit is contained in:
@@ -53,8 +53,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
|
||||
if (AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemyUnits))
|
||||
{
|
||||
foreach (var u in owner.Units)
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", u, Target.FromCell(owner.World, owner.TargetActor.Location), false));
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, owner.TargetActor.Location), false, groupedActors: owner.Units.ToArray()));
|
||||
|
||||
// We have gathered sufficient units. Attack the nearest enemy unit.
|
||||
owner.FuzzyStateMachine.ChangeState(owner, new GroundUnitsAttackMoveState(), true);
|
||||
@@ -124,8 +123,9 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
// Since units have different movement speeds, they get separated while approaching the target.
|
||||
// Let them regroup into tighter formation.
|
||||
owner.Bot.QueueOrder(new Order("Stop", leader, false));
|
||||
foreach (var unit in owner.Units.Where(a => !ownUnits.Contains(a)))
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", unit, Target.FromCell(owner.World, leader.Location), false));
|
||||
|
||||
var units = owner.Units.Where(a => !ownUnits.Contains(a)).ToArray();
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, leader.Location), false, groupedActors: units));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -138,8 +138,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
owner.FuzzyStateMachine.ChangeState(owner, new GroundUnitsAttackState(), true);
|
||||
}
|
||||
else
|
||||
foreach (var a in owner.Units)
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", a, Target.FromCell(owner.World, owner.TargetActor.Location), false));
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, owner.TargetActor.Location), false, groupedActors: owner.Units.ToArray()));
|
||||
}
|
||||
|
||||
if (ShouldFlee(owner))
|
||||
|
||||
@@ -78,8 +78,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
|
||||
if (AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemyUnits))
|
||||
{
|
||||
foreach (var u in owner.Units)
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", u, Target.FromCell(owner.World, owner.TargetActor.Location), false));
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, owner.TargetActor.Location), false, groupedActors: owner.Units.ToArray()));
|
||||
|
||||
// We have gathered sufficient units. Attack the nearest enemy unit.
|
||||
owner.FuzzyStateMachine.ChangeState(owner, new NavyUnitsAttackMoveState(), true);
|
||||
@@ -149,8 +148,9 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
// Since units have different movement speeds, they get separated while approaching the target.
|
||||
// Let them regroup into tighter formation.
|
||||
owner.Bot.QueueOrder(new Order("Stop", leader, false));
|
||||
foreach (var unit in owner.Units.Where(a => !ownUnits.Contains(a)))
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", unit, Target.FromCell(owner.World, leader.Location), false));
|
||||
|
||||
var units = owner.Units.Where(a => !ownUnits.Contains(a)).ToArray();
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, leader.Location), false, groupedActors: units));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -163,8 +163,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
owner.FuzzyStateMachine.ChangeState(owner, new NavyUnitsAttackState(), true);
|
||||
}
|
||||
else
|
||||
foreach (var a in owner.Units)
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", a, Target.FromCell(owner.World, owner.TargetActor.Location), false));
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, owner.TargetActor.Location), false, groupedActors: owner.Units.ToArray()));
|
||||
}
|
||||
|
||||
if (ShouldFlee(owner))
|
||||
|
||||
@@ -55,10 +55,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
Backoff--;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var a in owner.Units)
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", a, Target.FromCell(owner.World, owner.TargetActor.Location), false));
|
||||
}
|
||||
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, owner.TargetActor.Location), false, groupedActors: owner.Units.ToArray()));
|
||||
}
|
||||
|
||||
public void Deactivate(Squad owner) { }
|
||||
|
||||
Reference in New Issue
Block a user