Fix blocked cursor for queued undeploy orders.

This commit is contained in:
Paul Chote
2019-06-20 20:19:23 +00:00
committed by reaperrr
parent 8f573568c8
commit 739f437c18
6 changed files with 55 additions and 22 deletions

View File

@@ -33,16 +33,20 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Require the force-move modifier to display the enter cursor.")]
public readonly bool RequiresForceMove = false;
public override object Create(ActorInitializer init) { return new TransformsIntoRepairable(this); }
public override object Create(ActorInitializer init) { return new TransformsIntoRepairable(init.Self, this); }
}
public class TransformsIntoRepairable : ConditionalTrait<TransformsIntoRepairableInfo>, IIssueOrder, IResolveOrder, IOrderVoice
{
readonly Actor self;
Transforms[] transforms;
IHealth health;
public TransformsIntoRepairable(TransformsIntoRepairableInfo info)
: base(info) { }
public TransformsIntoRepairable(Actor self, TransformsIntoRepairableInfo info)
: base(info)
{
this.self = self;
}
protected override void Created(Actor self)
{
@@ -62,7 +66,10 @@ namespace OpenRA.Mods.Common.Traits
bool CanRepair()
{
return health.DamageState > DamageState.Undamaged && transforms.Any(t => !t.IsTraitDisabled && !t.IsTraitPaused);
if (!(self.CurrentActivity is Transform || transforms.Any(t => !t.IsTraitDisabled && !t.IsTraitPaused)))
return false;
return health.DamageState > DamageState.Undamaged;
}
bool CanRepairAt(Actor target, TargetModifiers modifiers)