diff --git a/OpenRA.Mods.Common/Traits/AffectsShroud.cs b/OpenRA.Mods.Common/Traits/AffectsShroud.cs index 6bf2f7e0e7..62559d9699 100644 --- a/OpenRA.Mods.Common/Traits/AffectsShroud.cs +++ b/OpenRA.Mods.Common/Traits/AffectsShroud.cs @@ -31,12 +31,10 @@ namespace OpenRA.Mods.Common.Traits static readonly PPos[] NoCells = { }; [Sync] CPos cachedLocation; - [Sync] bool cachedDisabled; [Sync] bool cachedTraitDisabled; protected abstract void AddCellsToPlayerShroud(Actor self, Player player, PPos[] uv); protected abstract void RemoveCellsFromPlayerShroud(Actor self, Player player); - protected virtual bool IsDisabled(Actor self) { return false; } public AffectsShroud(Actor self, AffectsShroudInfo info) : base(info) { } @@ -69,14 +67,12 @@ namespace OpenRA.Mods.Common.Traits var centerPosition = self.CenterPosition; var projectedPos = centerPosition - new WVec(0, centerPosition.Z, centerPosition.Z); var projectedLocation = self.World.Map.CellContaining(projectedPos); - var disabled = IsDisabled(self); var traitDisabled = IsTraitDisabled; - if (cachedLocation == projectedLocation && traitDisabled == cachedTraitDisabled && cachedDisabled == disabled) + if (cachedLocation == projectedLocation && traitDisabled == cachedTraitDisabled) return; cachedLocation = projectedLocation; - cachedDisabled = disabled; cachedTraitDisabled = traitDisabled; var cells = ProjectedCells(self); @@ -92,7 +88,6 @@ namespace OpenRA.Mods.Common.Traits var centerPosition = self.CenterPosition; var projectedPos = centerPosition - new WVec(0, centerPosition.Z, centerPosition.Z); cachedLocation = self.World.Map.CellContaining(projectedPos); - cachedDisabled = IsDisabled(self); cachedTraitDisabled = IsTraitDisabled; var cells = ProjectedCells(self); @@ -106,6 +101,6 @@ namespace OpenRA.Mods.Common.Traits RemoveCellsFromPlayerShroud(self, p); } - public WDist Range { get { return (cachedDisabled || cachedTraitDisabled) ? WDist.Zero : Info.Range; } } + public WDist Range { get { return cachedTraitDisabled ? WDist.Zero : Info.Range; } } } } diff --git a/OpenRA.Mods.Common/Traits/CreatesShroud.cs b/OpenRA.Mods.Common/Traits/CreatesShroud.cs index 4e78428703..0925173594 100644 --- a/OpenRA.Mods.Common/Traits/CreatesShroud.cs +++ b/OpenRA.Mods.Common/Traits/CreatesShroud.cs @@ -37,7 +37,5 @@ namespace OpenRA.Mods.Common.Traits } protected override void RemoveCellsFromPlayerShroud(Actor self, Player p) { p.Shroud.RemoveSource(this); } - - protected override bool IsDisabled(Actor self) { return self.IsDisabled(); } } } \ No newline at end of file