Skip to content

Commit

Permalink
Add RemoveOrders into RejectOrders trait
Browse files Browse the repository at this point in the history
  • Loading branch information
Porenutak authored and PunkPun committed Dec 27, 2023
1 parent a0b1bdd commit d83a871
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions OpenRA.Mods.Common/Traits/RejectsOrders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class RejectsOrdersInfo : ConditionalTraitInfo
"Also overrides other instances of this trait's Reject fields.")]
public readonly HashSet<string> Except = new();

[Desc("Remove current and all queued orders from the actor when this trait is enabled.")]
public readonly bool RemoveOrders = false;

public override object Create(ActorInitializer init) { return new RejectsOrders(this); }
}

Expand All @@ -34,6 +37,12 @@ public class RejectsOrders : ConditionalTrait<RejectsOrdersInfo>

public RejectsOrders(RejectsOrdersInfo info)
: base(info) { }

protected override void TraitEnabled(Actor self)
{
if (Info.RemoveOrders)
self.CancelActivity();
}
}

public static class RejectsOrdersExts
Expand Down

0 comments on commit d83a871

Please sign in to comment.