add INotifyOtherCaptured, for reacting to other units changing ownership

This commit is contained in:
Chris Forbes
2011-01-30 17:43:25 +13:00
parent a0926a49ec
commit c8a68659a0
2 changed files with 4 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ namespace OpenRA.Traits
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
public interface INotifyProduction { void UnitProduced(Actor self, Actor other, int2 exit); }
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 IAcceptSpy { void OnInfiltrate(Actor self, Actor spy); }
public interface IStoreOre { int Capacity { get; }}

View File

@@ -41,6 +41,9 @@ namespace OpenRA.Mods.RA.Activities
foreach (var t in target.TraitsImplementing<INotifyCapture>())
t.OnCapture(target, self, oldOwner, self.Owner);
foreach (var t in self.World.Queries.WithTrait<INotifyOtherCaptured>())
t.Trait.OnActorCaptured(t.Actor, target, self, oldOwner, self.Owner);
self.Destroy();
});
return this;