From 6281fa481fe0f0859cf6859896a0eff942fc6046 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 13 Feb 2011 16:22:34 +1300 Subject: [PATCH] add hook for stance change notifications --- OpenRA.Game/Network/UnitOrders.cs | 5 ++++- OpenRA.Game/Traits/TraitsInterfaces.cs | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/Network/UnitOrders.cs b/OpenRA.Game/Network/UnitOrders.cs index 53ae574771..a2cb7e39b2 100755 --- a/OpenRA.Game/Network/UnitOrders.cs +++ b/OpenRA.Game/Network/UnitOrders.cs @@ -188,7 +188,10 @@ namespace OpenRA.Network var oldStance = p.Stances[target]; p.Stances[target] = s; if (target == w.LocalPlayer) - w.WorldActor.Trait().UpdatePlayerStance(w, p, oldStance, s); + w.WorldActor.Trait().UpdatePlayerStance(w, p, oldStance, s); + + foreach (var nsc in w.Queries.WithTrait()) + nsc.Trait.StanceChanged(p, target, oldStance, s); } } } diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index e80d6071d3..731c87cc91 100755 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -228,5 +228,6 @@ namespace OpenRA.Traits bool TargetableBy(Actor self, Actor byActor); } - public interface INotifyKeyPress { bool KeyPressed(Actor self, KeyInput e); } + public interface INotifyKeyPress { bool KeyPressed(Actor self, KeyInput e); } + public interface INotifyStanceChanged { void StanceChanged(Player a, Player b, Stance oldStance, Stance newStance); } }