Fix FallsToEarth queueing an activity in its ctor

This commit is contained in:
abcdefg30
2019-10-05 16:56:35 +02:00
committed by Paul Chote
parent 56726a0533
commit acea19312d

View File

@@ -42,18 +42,24 @@ namespace OpenRA.Mods.Common.Traits
}
}
public class FallsToEarth : IEffectiveOwner
public class FallsToEarth : IEffectiveOwner, INotifyCreated
{
readonly FallsToEarthInfo info;
readonly Player effectiveOwner;
public FallsToEarth(ActorInitializer init, FallsToEarthInfo info)
{
init.Self.QueueActivity(false, new FallToEarth(init.Self, info));
this.info = info;
effectiveOwner = init.Contains<EffectiveOwnerInit>() ? init.Get<EffectiveOwnerInit, Player>() : init.Self.Owner;
}
// We return init.Self.Owner if there's no effective owner
bool IEffectiveOwner.Disguised { get { return true; } }
Player IEffectiveOwner.Owner { get { return effectiveOwner; } }
void INotifyCreated.Created(Actor self)
{
self.QueueActivity(false, new FallToEarth(self, info));
}
}
}