Add Replaceable and Replacement traits to support wall overrides.

This commit is contained in:
Michael Silber
2018-04-07 17:25:08 +00:00
committed by ltem
parent 0c52ff3ae5
commit 1b110b7833
5 changed files with 84 additions and 3 deletions

View File

@@ -136,6 +136,18 @@ namespace OpenRA.Mods.Common.Traits
|| !buildingInfo.IsCloseEnoughToBase(self.World, order.Player, actorInfo, order.TargetLocation))
return;
var replacementInfo = actorInfo.TraitInfoOrDefault<ReplacementInfo>();
if (replacementInfo != null)
{
var buildingInfluence = self.World.WorldActor.Trait<BuildingInfluence>();
foreach (var t in buildingInfo.Tiles(order.TargetLocation))
{
var host = buildingInfluence.GetBuildingAt(t);
if (host != null)
host.World.Remove(host);
}
}
var building = w.CreateActor(order.TargetString, new TypeDictionary
{
new LocationInit(order.TargetLocation),