fix attack crashing game
This commit is contained in:
@@ -26,10 +26,13 @@ namespace OpenRa.Game.Traits
|
||||
|
||||
protected override void QueueAttack( Actor self, Order order )
|
||||
{
|
||||
var b = self.traits.Get<Building>();
|
||||
if (b != null && b.InsuffientPower())
|
||||
return;
|
||||
|
||||
if (self.traits.Contains<Building>())
|
||||
{
|
||||
var b = self.traits.Get<Building>();
|
||||
if (b != null && b.InsuffientPower())
|
||||
return;
|
||||
}
|
||||
|
||||
const int RangeTolerance = 1; /* how far inside our maximum range we should try to sit */
|
||||
/* todo: choose the appropriate weapon, when only one works against this target */
|
||||
var weapon = order.Subject.Info.Primary ?? order.Subject.Info.Secondary;
|
||||
@@ -39,6 +42,7 @@ namespace OpenRa.Game.Traits
|
||||
Math.Max( 0, (int)Rules.WeaponInfo[ weapon ].Range - RangeTolerance ) ) );
|
||||
|
||||
target = order.TargetActor;
|
||||
|
||||
}
|
||||
|
||||
bool buildComplete = false;
|
||||
|
||||
Reference in New Issue
Block a user