Fix FallsToEarth not accounting for effective ownership

This commit is contained in:
abcdefg30
2018-02-09 15:00:48 +01:00
committed by reaperrr
parent 5afa260d4e
commit bed6b26428

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
public WeaponInfo ExplosionWeapon { get; private set; } public WeaponInfo ExplosionWeapon { get; private set; }
public object Create(ActorInitializer init) { return new FallsToEarth(init.Self, this); } public object Create(ActorInitializer init) { return new FallsToEarth(init, this); }
public void RulesetLoaded(Ruleset rules, ActorInfo ai) public void RulesetLoaded(Ruleset rules, ActorInfo ai)
{ {
if (string.IsNullOrEmpty(Explosion)) if (string.IsNullOrEmpty(Explosion))
@@ -42,11 +42,18 @@ namespace OpenRA.Mods.Common.Traits
} }
} }
public class FallsToEarth public class FallsToEarth : IEffectiveOwner
{ {
public FallsToEarth(Actor self, FallsToEarthInfo info) readonly Player effectiveOwner;
public FallsToEarth(ActorInitializer init, FallsToEarthInfo info)
{ {
self.QueueActivity(false, new FallToEarth(self, info)); init.Self.QueueActivity(false, new FallToEarth(init.Self, 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; } }
} }
} }