Fix ProximityExternalCondition ignoring the owner change event
This commit is contained in:
committed by
Matthias Mailänder
parent
e22d7b31f9
commit
ae45707c84
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public override object Create(ActorInitializer init) { return new ExternalCondition(this); }
|
||||
}
|
||||
|
||||
public class ExternalCondition : ITick, INotifyCreated
|
||||
public class ExternalCondition : ITick, INotifyCreated, INotifyOwnerChanged
|
||||
{
|
||||
readonly struct TimedToken
|
||||
{
|
||||
@@ -222,6 +222,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
bool Notifies(IConditionTimerWatcher watcher) { return watcher.Condition == Info.Condition; }
|
||||
|
||||
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
||||
{
|
||||
foreach (var pair in self.World.ActorsWithTrait<INotifyProximityOwnerChanged>())
|
||||
pair.Trait.OnProximityOwnerChanged(self, oldOwner, newOwner);
|
||||
}
|
||||
|
||||
void INotifyCreated.Created(Actor self)
|
||||
{
|
||||
watchers = self.TraitsImplementing<IConditionTimerWatcher>().Where(Notifies).ToArray();
|
||||
|
||||
Reference in New Issue
Block a user