This commit is contained in:
Chris Forbes
2009-11-09 22:36:56 +13:00
parent 19e0ea970b
commit 7534492526

View File

@@ -27,17 +27,13 @@ namespace OpenRa.Game
{
const int RangeTolerance = 1; /* how far inside our maximum range we should try to sit */
var mobile = order.Subject.traits.GetOrDefault<Mobile>();
/* todo: choose the appropriate weapon, when only one works against this target */
var weapon = order.Subject.unitInfo.Primary ?? order.Subject.unitInfo.Secondary;
mobile.Cancel(order.Subject);
// TODO: this block should be a separate activity; "MoveNear", maybe?
{
/* todo: choose the appropriate weapon, when only one works against this target */
var range = Rules.WeaponInfo[weapon].Range;
mobile.QueueActivity(
new Traits.Activities.Follow(order.TargetActor, Math.Max(0, (int)range - RangeTolerance)));
}
mobile.QueueActivity(
new Traits.Activities.Follow(order.TargetActor,
Math.Max(0, (int)Rules.WeaponInfo[weapon].Range - RangeTolerance)));
order.Subject.traits.Get<AttackTurreted>().target = order.TargetActor;
break;