diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 49d839cb9a..42336b5898 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -370,7 +370,6 @@ - diff --git a/OpenRA.Mods.Common/Traits/Render/RenderBuildingWarFactory.cs b/OpenRA.Mods.Common/Traits/Render/RenderBuildingWarFactory.cs deleted file mode 100644 index a8c53111c6..0000000000 --- a/OpenRA.Mods.Common/Traits/Render/RenderBuildingWarFactory.cs +++ /dev/null @@ -1,96 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2015 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. For more information, - * see COPYING. - */ -#endregion - -using System.Collections.Generic; -using System.Linq; -using OpenRA.Graphics; -using OpenRA.Mods.Common.Graphics; -using OpenRA.Traits; - -namespace OpenRA.Mods.Common.Traits -{ - class RenderBuildingWarFactoryInfo : RenderBuildingInfo - { - public override object Create(ActorInitializer init) { return new RenderBuildingWarFactory(init, this); } - - public override IEnumerable RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p) - { - foreach (var orig in base.RenderPreviewSprites(init, rs, image, facings, p)) - yield return orig; - - // Show additional roof overlay - var anim = new Animation(init.World, image, () => 0); - anim.PlayRepeating("idle-top"); - - var bi = init.Actor.Traits.Get(); - var offset = FootprintUtils.CenterOffset(init.World, bi).Y + 512; - yield return new SpriteActorPreview(anim, WVec.Zero, offset, p, rs.Scale); - } - } - - class RenderBuildingWarFactory : RenderBuilding, INotifyBuildComplete, ITick, INotifyProduction, INotifySold - { - readonly Animation roof; - bool isOpen; - CPos openExit; - bool buildComplete; - - public RenderBuildingWarFactory(ActorInitializer init, RenderBuildingInfo info) - : base(init, info) - { - roof = new Animation(init.World, GetImage(init.Self)); - var bi = init.Self.Info.Traits.Get(); - - // Additional 512 units move from center -> top of cell - var offset = FootprintUtils.CenterOffset(init.World, bi).Y + 512; - Add("roof", new AnimationWithOffset(roof, null, - () => !buildComplete, offset)); - } - - public override void BuildingComplete(Actor self) - { - roof.Play(NormalizeSequence(self, - self.GetDamageState() > DamageState.Heavy ? "damaged-idle-top" : "idle-top")); - buildComplete = true; - } - - public override void Tick(Actor self) - { - base.Tick(self); - if (isOpen && !self.World.ActorMap.GetUnitsAt(openExit).Any(a => a != self)) - { - isOpen = false; - roof.PlayBackwardsThen(NormalizeSequence(self, "build-top"), - () => roof.Play(NormalizeSequence(self, "idle-top"))); - } - } - - public override void DamageStateChanged(Actor self, AttackInfo e) - { - if (roof.CurrentSequence != null) - { - if (e.DamageState >= DamageState.Heavy) - roof.ReplaceAnim("damaged-" + roof.CurrentSequence.Name); - else - roof.ReplaceAnim(roof.CurrentSequence.Name.Replace("damaged-", "")); - } - - base.DamageStateChanged(self, e); - } - - public void UnitProduced(Actor self, Actor other, CPos exit) - { - roof.PlayThen(NormalizeSequence(self, "build-top"), () => { isOpen = true; openExit = exit; }); - } - - public void Selling(Actor self) { Remove("roof"); } - public void Sold(Actor self) { } - } -} diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index 70b06a605f..f27dff3aa0 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -363,8 +363,9 @@ WEAP: RevealsShroud: Range: 4c0 Bib: - -RenderBuilding: - RenderBuildingWarFactory: + WithProductionDoorOverlay: + Sequence: idle-top + BuildSequence: build-top RallyPoint: RallyPoint: 0,3 Exit@1: diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index 0038aec005..cfe97627c2 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -200,8 +200,7 @@ refinery: DeliveryOffset: 2,2 DeliveringActor: carryall.reinforce Facing: 160 - -RenderBuilding: - RenderBuildingWarFactory: + RenderBuilding: Image: refinery.harkonnen RaceImages: atreides: refinery.atreides diff --git a/mods/ra/rules/fakes.yaml b/mods/ra/rules/fakes.yaml index 9d39c1e6f3..c24069c28c 100644 --- a/mods/ra/rules/fakes.yaml +++ b/mods/ra/rules/fakes.yaml @@ -37,9 +37,10 @@ WEAF: Footprint: xxx xxx Dimensions: 3,2 Bib: - -RenderBuilding: - RenderBuildingWarFactory: + RenderBuilding: Image: WEAP + WithIdleOverlay@ROOF: + Sequence: idle-top Valued: Cost: 200 diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 0c634e1dff..c21635ae1c 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -761,8 +761,9 @@ WEAP: RevealsShroud: Range: 4c0 Bib: - -RenderBuilding: - RenderBuildingWarFactory: + WithProductionDoorOverlay: + Sequence: idle-top + BuildSequence: build-top RallyPoint: Exit@1: SpawnOffset: 213,-128,0