diff --git a/OpenRA.Mods.Common/Traits/Render/WithWallSpriteBody.cs b/OpenRA.Mods.Common/Traits/Render/WithWallSpriteBody.cs index c8da9c1200..26284be3b7 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithWallSpriteBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithWallSpriteBody.cs @@ -17,7 +17,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Render trait for actors that change sprites if neighbors with the same trait are present.")] - class WithWallSpriteBodyInfo : WithSpriteBodyInfo + class WithWallSpriteBodyInfo : WithSpriteBodyInfo, Requires { public readonly string Type = "wall"; @@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits } } - class WithWallSpriteBody : WithSpriteBody, INotifyAddedToWorld, INotifyRemovedFromWorld, ITick + class WithWallSpriteBody : WithSpriteBody, INotifyRemovedFromWorld, ITick { readonly WithWallSpriteBodyInfo wallInfo; int adjacent = 0; @@ -78,7 +78,6 @@ namespace OpenRA.Mods.Common.Traits : base(init, info, () => 0) { wallInfo = info; - DefaultAnimation.PlayFetchIndex(NormalizeSequence(init.Self, Info.Sequence), () => adjacent); } public override void DamageStateChanged(Actor self, AttackInfo e) @@ -118,6 +117,12 @@ namespace OpenRA.Mods.Common.Traits dirty = false; } + public override void BuildingComplete(Actor self) + { + DefaultAnimation.PlayFetchIndex(NormalizeSequence(self, Info.Sequence), () => adjacent); + UpdateNeighbours(self); + } + static void UpdateNeighbours(Actor self) { var adjacentActors = CVec.Directions.SelectMany(dir => @@ -129,12 +134,6 @@ namespace OpenRA.Mods.Common.Traits rb.dirty = true; } - public void AddedToWorld(Actor self) - { - DefaultAnimation.PlayFetchIndex(NormalizeSequence(self, Info.Sequence), () => adjacent); - UpdateNeighbours(self); - } - public void RemovedFromWorld(Actor self) { UpdateNeighbours(self);