Remove BuildingInfluence trait.
This commit is contained in:
committed by
Matthias Mailänder
parent
b9dd59cd63
commit
72c82cb080
@@ -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<LocationInit, CPos>();
|
||||
Info = info;
|
||||
influence = self.World.WorldActor.Trait<BuildingInfluence>();
|
||||
|
||||
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)
|
||||
|
||||
@@ -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<Actor> influence;
|
||||
|
||||
public BuildingInfluence(World world)
|
||||
{
|
||||
map = world.Map;
|
||||
|
||||
influence = new CellLayer<Actor>(map);
|
||||
}
|
||||
|
||||
internal void AddInfluence(Actor a, IEnumerable<CPos> tiles)
|
||||
{
|
||||
foreach (var u in tiles)
|
||||
if (influence.Contains(u) && influence[u] == null)
|
||||
influence[u] = a;
|
||||
}
|
||||
|
||||
internal void RemoveInfluence(Actor a, IEnumerable<CPos> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
actorNode.RemoveNodes("BuildingInfluence");
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,6 +76,7 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
new RemoveTurnToDock(),
|
||||
new RenameSmudgeSmokeFields(),
|
||||
new RenameCircleContrast(),
|
||||
new RemoveBuildingInfluence(),
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
@@ -159,7 +159,6 @@ World:
|
||||
PlayerCommands:
|
||||
HelpCommand:
|
||||
ScreenShaker:
|
||||
BuildingInfluence:
|
||||
LegacyBridgeLayer:
|
||||
Bridges: bridge1, bridge2, bridge3, bridge4
|
||||
ProductionQueueFromSelection:
|
||||
|
||||
@@ -129,7 +129,6 @@ World:
|
||||
PlayerCommands:
|
||||
HelpCommand:
|
||||
ScreenShaker:
|
||||
BuildingInfluence:
|
||||
ProductionQueueFromSelection:
|
||||
ProductionPaletteWidget: PRODUCTION_PALETTE
|
||||
ActorSpawnManager:
|
||||
|
||||
@@ -181,7 +181,6 @@ World:
|
||||
PlayerCommands:
|
||||
HelpCommand:
|
||||
ScreenShaker:
|
||||
BuildingInfluence:
|
||||
ProductionQueueFromSelection:
|
||||
ProductionPaletteWidget: PRODUCTION_PALETTE
|
||||
LegacyBridgeLayer:
|
||||
|
||||
@@ -247,7 +247,6 @@ World:
|
||||
DebugVisualizationCommands:
|
||||
PlayerCommands:
|
||||
HelpCommand:
|
||||
BuildingInfluence:
|
||||
ProductionQueueFromSelection:
|
||||
ProductionPaletteWidget: PRODUCTION_PALETTE
|
||||
DomainIndex:
|
||||
|
||||
Reference in New Issue
Block a user