Remove TargetActor and TargetLocation from order issuing.

This commit is contained in:
Paul Chote
2017-10-15 16:45:16 +00:00
committed by reaperrr
parent 4896a90b8d
commit d967c564a2
45 changed files with 104 additions and 144 deletions

View File

@@ -223,7 +223,7 @@ namespace OpenRA.Mods.Common.AI
}
if (CanAttackTarget(a, owner.TargetActor))
owner.Bot.QueueOrder(new Order("Attack", a, false) { TargetActor = owner.TargetActor });
owner.Bot.QueueOrder(new Order("Attack", a, Target.FromActor(owner.TargetActor), false));
}
}
@@ -250,7 +250,7 @@ namespace OpenRA.Mods.Common.AI
continue;
}
owner.Bot.QueueOrder(new Order("Move", a, false) { TargetLocation = RandomBuildingLocation(owner) });
owner.Bot.QueueOrder(new Order("Move", a, Target.FromCell(owner.World, RandomBuildingLocation(owner)), false));
}
owner.FuzzyStateMachine.ChangeState(owner, new AirIdleState(), true);

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.AI
if (AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemyUnits))
{
foreach (var u in owner.Units)
owner.Bot.QueueOrder(new Order("AttackMove", u, false) { TargetLocation = owner.TargetActor.Location });
owner.Bot.QueueOrder(new Order("AttackMove", u, Target.FromCell(owner.World, owner.TargetActor.Location), false));
// We have gathered sufficient units. Attack the nearest enemy unit.
owner.FuzzyStateMachine.ChangeState(owner, new GroundUnitsAttackMoveState(), true);
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.AI
// 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, false) { TargetLocation = leader.Location });
owner.Bot.QueueOrder(new Order("AttackMove", unit, Target.FromCell(owner.World, leader.Location), false));
}
else
{
@@ -114,7 +114,7 @@ namespace OpenRA.Mods.Common.AI
}
else
foreach (var a in owner.Units)
owner.Bot.QueueOrder(new Order("AttackMove", a, false) { TargetLocation = owner.TargetActor.Location });
owner.Bot.QueueOrder(new Order("AttackMove", a, Target.FromCell(owner.World, owner.TargetActor.Location), false));
}
if (ShouldFlee(owner))
@@ -147,7 +147,7 @@ namespace OpenRA.Mods.Common.AI
foreach (var a in owner.Units)
if (!BusyAttack(a))
owner.Bot.QueueOrder(new Order("Attack", a, false) { TargetActor = owner.TargetActor });
owner.Bot.QueueOrder(new Order("Attack", a, Target.FromActor(owner.TargetActor), false));
if (ShouldFlee(owner))
owner.FuzzyStateMachine.ChangeState(owner, new GroundUnitsFleeState(), true);

View File

@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.AI
if (AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemyUnits))
{
foreach (var u in owner.Units)
owner.Bot.QueueOrder(new Order("AttackMove", u, false) { TargetLocation = owner.TargetActor.Location });
owner.Bot.QueueOrder(new Order("AttackMove", u, Target.FromCell(owner.World, owner.TargetActor.Location), false));
// We have gathered sufficient units. Attack the nearest enemy unit.
owner.FuzzyStateMachine.ChangeState(owner, new NavyUnitsAttackMoveState(), true);
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.AI
// 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, false) { TargetLocation = leader.Location });
owner.Bot.QueueOrder(new Order("AttackMove", unit, Target.FromCell(owner.World, leader.Location), false));
}
else
{
@@ -141,7 +141,7 @@ namespace OpenRA.Mods.Common.AI
}
else
foreach (var a in owner.Units)
owner.Bot.QueueOrder(new Order("AttackMove", a, false) { TargetLocation = owner.TargetActor.Location });
owner.Bot.QueueOrder(new Order("AttackMove", a, Target.FromCell(owner.World, owner.TargetActor.Location), false));
}
if (ShouldFlee(owner))
@@ -174,7 +174,7 @@ namespace OpenRA.Mods.Common.AI
foreach (var a in owner.Units)
if (!BusyAttack(a))
owner.Bot.QueueOrder(new Order("Attack", a, false) { TargetActor = owner.TargetActor });
owner.Bot.QueueOrder(new Order("Attack", a, Target.FromActor(owner.TargetActor), false));
if (ShouldFlee(owner))
owner.FuzzyStateMachine.ChangeState(owner, new NavyUnitsFleeState(), true);

View File

@@ -9,6 +9,8 @@
*/
#endregion
using OpenRA.Traits;
namespace OpenRA.Mods.Common.AI
{
class UnitsForProtectionIdleState : GroundStateBase, IState
@@ -55,7 +57,7 @@ namespace OpenRA.Mods.Common.AI
else
{
foreach (var a in owner.Units)
owner.Bot.QueueOrder(new Order("AttackMove", a, false) { TargetLocation = owner.TargetActor.Location });
owner.Bot.QueueOrder(new Order("AttackMove", a, Target.FromCell(owner.World, owner.TargetActor.Location), false));
}
}

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.AI
{
var loc = RandomBuildingLocation(squad);
foreach (var a in squad.Units)
squad.Bot.QueueOrder(new Order("Move", a, false) { TargetLocation = loc });
squad.Bot.QueueOrder(new Order("Move", a, Target.FromCell(squad.World, loc), false));
}
protected static CPos RandomBuildingLocation(Squad squad)