Add INotifyOwnerChanged interface
This commit is contained in:
@@ -254,10 +254,15 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
World.AddFrameEndTask(w =>
|
World.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
|
var oldOwner = Owner;
|
||||||
|
|
||||||
// momentarily remove from world so the ownership queries don't get confused
|
// momentarily remove from world so the ownership queries don't get confused
|
||||||
w.Remove(this);
|
w.Remove(this);
|
||||||
Owner = newOwner;
|
Owner = newOwner;
|
||||||
w.Add(this);
|
w.Add(this);
|
||||||
|
|
||||||
|
foreach (var t in this.TraitsImplementing<INotifyOwnerChanged>())
|
||||||
|
t.OnOwnerChanged(this, oldOwner, newOwner);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ namespace OpenRA.Traits
|
|||||||
public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); }
|
public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); }
|
||||||
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
|
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
|
||||||
public interface INotifyProduction { void UnitProduced(Actor self, Actor other, CPos exit); }
|
public interface INotifyProduction { void UnitProduced(Actor self, Actor other, CPos exit); }
|
||||||
|
public interface INotifyOwnerChanged { void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner); }
|
||||||
public interface INotifyCapture { void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner); }
|
public interface INotifyCapture { void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner); }
|
||||||
public interface INotifyOtherCaptured { void OnActorCaptured(Actor self, Actor captured, Actor captor, Player oldOwner, Player newOwner); }
|
public interface INotifyOtherCaptured { void OnActorCaptured(Actor self, Actor captured, Actor captor, Player oldOwner, Player newOwner); }
|
||||||
public interface IAcceptSpy { void OnInfiltrate(Actor self, Actor spy); }
|
public interface IAcceptSpy { void OnInfiltrate(Actor self, Actor spy); }
|
||||||
|
|||||||
Reference in New Issue
Block a user