From bed6b264287988202f4d2cc1879fe09bb0c7e951 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Fri, 9 Feb 2018 15:00:48 +0100 Subject: [PATCH] Fix FallsToEarth not accounting for effective ownership --- OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs b/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs index 29144e2e50..1137882dc7 100644 --- a/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs +++ b/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits 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) { 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() ? init.Get() : 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; } } } }