diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs index 396211958c..5263411e11 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs @@ -264,7 +264,6 @@ namespace OpenRA.Mods.Common.Traits readonly CPos topLeft; readonly Actor self; - readonly BuildingInfluence influence; (CPos, SubCell)[] occupiedCells; (CPos, SubCell)[] targetableCells; @@ -278,7 +277,6 @@ namespace OpenRA.Mods.Common.Traits self = init.Self; topLeft = init.GetValue(); Info = info; - influence = self.World.WorldActor.Trait(); occupiedCells = Info.OccupiedTiles(TopLeft) .Select(c => (c, SubCell.FullCell)).ToArray(); @@ -308,13 +306,11 @@ namespace OpenRA.Mods.Common.Traits RemoveSmudges(); self.World.AddToMaps(self, this); - influence.AddInfluence(self, Info.Tiles(self.Location)); } void INotifyRemovedFromWorld.RemovedFromWorld(Actor self) { self.World.RemoveFromMaps(self, this); - influence.RemoveInfluence(self, Info.Tiles(self.Location)); } void INotifySold.Selling(Actor self) diff --git a/OpenRA.Mods.Common/Traits/Buildings/BuildingInfluence.cs b/OpenRA.Mods.Common/Traits/Buildings/BuildingInfluence.cs deleted file mode 100644 index 22ad8fda18..0000000000 --- a/OpenRA.Mods.Common/Traits/Buildings/BuildingInfluence.cs +++ /dev/null @@ -1,54 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2020 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. For more - * information, see COPYING. - */ -#endregion - -using System.Collections.Generic; -using OpenRA.Traits; - -namespace OpenRA.Mods.Common.Traits -{ - [Desc("A dictionary of buildings placed on the map. Attach this to the world actor.")] - public class BuildingInfluenceInfo : TraitInfo - { - public override object Create(ActorInitializer init) { return new BuildingInfluence(init.World); } - } - - public class BuildingInfluence - { - readonly Map map; - readonly CellLayer influence; - - public BuildingInfluence(World world) - { - map = world.Map; - - influence = new CellLayer(map); - } - - internal void AddInfluence(Actor a, IEnumerable tiles) - { - foreach (var u in tiles) - if (influence.Contains(u) && influence[u] == null) - influence[u] = a; - } - - internal void RemoveInfluence(Actor a, IEnumerable tiles) - { - foreach (var u in tiles) - if (influence.Contains(u) && influence[u] == a) - influence[u] = null; - } - - public Actor GetBuildingAt(CPos cell) - { - return influence.Contains(cell) ? influence[cell] : null; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveBuildingInfluence.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveBuildingInfluence.cs new file mode 100644 index 0000000000..67dce6908d --- /dev/null +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveBuildingInfluence.cs @@ -0,0 +1,34 @@ +#region Copyright & License Information +/* + * Copyright 2007-2020 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. For more + * information, see COPYING. + */ +#endregion + +using System.Collections.Generic; + +namespace OpenRA.Mods.Common.UpdateRules.Rules +{ + public class RemoveBuildingInfluence : UpdateRule + { + public override string Name { get { return "BuildingInfluence trait has been removed."; } } + + public override string Description + { + get + { + return "BuildingInfluence trait has been removed. Its functionality has been integrated into ActorMap."; + } + } + + public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) + { + actorNode.RemoveNodes("BuildingInfluence"); + yield break; + } + } +} diff --git a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs index 46679944a4..437b1b4fcb 100644 --- a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs +++ b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs @@ -76,6 +76,7 @@ namespace OpenRA.Mods.Common.UpdateRules new RemoveTurnToDock(), new RenameSmudgeSmokeFields(), new RenameCircleContrast(), + new RemoveBuildingInfluence(), }) }; diff --git a/mods/cnc/rules/world.yaml b/mods/cnc/rules/world.yaml index ecbf44433b..46763a7a19 100644 --- a/mods/cnc/rules/world.yaml +++ b/mods/cnc/rules/world.yaml @@ -159,7 +159,6 @@ World: PlayerCommands: HelpCommand: ScreenShaker: - BuildingInfluence: LegacyBridgeLayer: Bridges: bridge1, bridge2, bridge3, bridge4 ProductionQueueFromSelection: diff --git a/mods/d2k/rules/world.yaml b/mods/d2k/rules/world.yaml index 2b1af9b6dd..2029bd6033 100644 --- a/mods/d2k/rules/world.yaml +++ b/mods/d2k/rules/world.yaml @@ -129,7 +129,6 @@ World: PlayerCommands: HelpCommand: ScreenShaker: - BuildingInfluence: ProductionQueueFromSelection: ProductionPaletteWidget: PRODUCTION_PALETTE ActorSpawnManager: diff --git a/mods/ra/rules/world.yaml b/mods/ra/rules/world.yaml index d30ce0273d..9a2d72fddc 100644 --- a/mods/ra/rules/world.yaml +++ b/mods/ra/rules/world.yaml @@ -181,7 +181,6 @@ World: PlayerCommands: HelpCommand: ScreenShaker: - BuildingInfluence: ProductionQueueFromSelection: ProductionPaletteWidget: PRODUCTION_PALETTE LegacyBridgeLayer: diff --git a/mods/ts/rules/world.yaml b/mods/ts/rules/world.yaml index b562f0791f..408e0f8568 100644 --- a/mods/ts/rules/world.yaml +++ b/mods/ts/rules/world.yaml @@ -247,7 +247,6 @@ World: DebugVisualizationCommands: PlayerCommands: HelpCommand: - BuildingInfluence: ProductionQueueFromSelection: ProductionPaletteWidget: PRODUCTION_PALETTE DomainIndex: