diff --git a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs index 91ba850e9c..feeb08ce51 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs @@ -72,20 +72,22 @@ namespace OpenRA.Mods.Common.Traits.Render protected WithSpriteBody(ActorInitializer init, WithSpriteBodyInfo info, Func baseFacing) : base(info) { - var rs = init.Self.Trait(); + var self = init.Self; + + var rs = self.Trait(); bool Paused() => IsTraitPaused && - DefaultAnimation.CurrentSequence.Name == NormalizeSequence(init.Self, Info.Sequence); + DefaultAnimation.CurrentSequence.Name == NormalizeSequence(self, Info.Sequence); Func subtractDAT = null; if (info.ForceToGround) - subtractDAT = () => new WVec(0, 0, -init.Self.World.Map.DistanceAboveTerrain(init.Self.CenterPosition).Length); + subtractDAT = () => new WVec(0, 0, -self.World.Map.DistanceAboveTerrain(self.CenterPosition).Length); - DefaultAnimation = new Animation(init.World, rs.GetImage(init.Self), baseFacing, Paused); + DefaultAnimation = new Animation(init.World, rs.GetImage(self), baseFacing, Paused); rs.Add(new AnimationWithOffset(DefaultAnimation, subtractDAT, () => IsTraitDisabled), info.Palette, info.IsPlayerPalette); // Cache the bounds from the default sequence to avoid flickering when the animation changes - boundsAnimation = new Animation(init.World, rs.GetImage(init.Self), baseFacing, Paused); + boundsAnimation = new Animation(init.World, rs.GetImage(self), baseFacing, Paused); boundsAnimation.PlayRepeating(info.Sequence); } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs index 19e46b7a11..2ee754ebd9 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits Self = init.Self; DevMode = Self.Trait(); TechTree = Self.Trait(); - RadarPings = Exts.Lazy(() => init.World.WorldActor.TraitOrDefault()); + RadarPings = Exts.Lazy(() => Self.World.WorldActor.TraitOrDefault()); init.World.ActorAdded += ActorAdded; init.World.ActorRemoved += ActorRemoved;