diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 6f78829aae..d188a035c1 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -432,7 +432,6 @@ - @@ -465,6 +464,7 @@ + diff --git a/OpenRA.Mods.RA/Render/WithIdleOverlay.cs b/OpenRA.Mods.RA/Render/WithIdleOverlay.cs new file mode 100644 index 0000000000..f93c14df91 --- /dev/null +++ b/OpenRA.Mods.RA/Render/WithIdleOverlay.cs @@ -0,0 +1,58 @@ +#region Copyright & License Information +/* + * Copyright 2007-2013 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 OpenRA.FileFormats; +using OpenRA.Graphics; +using OpenRA.Traits; +using OpenRA.Mods.RA.Buildings; + +namespace OpenRA.Mods.RA.Render +{ + public class WithIdleOverlayInfo : ITraitInfo, Requires, Requires + { + [Desc("Sequence name to use")] + public readonly string Sequence = "idle-overlay"; + + [Desc("Position relative to body")] + public readonly WVec Offset = WVec.Zero; + + public object Create(ActorInitializer init) { return new WithIdleOverlay(init.self, this); } + } + + public class WithIdleOverlay : INotifyDamageStateChanged, INotifyBuildComplete + { + Animation overlay; + bool buildComplete; + + public WithIdleOverlay(Actor self, WithIdleOverlayInfo info) + { + var rs = self.Trait(); + var body = self.Trait(); + + buildComplete = !self.HasTrait(); // always render instantly for units + overlay = new Animation(rs.GetImage(self)); + overlay.PlayRepeating(info.Sequence); + rs.anims.Add("idle_overlay_{0}".F(info.Sequence), + new AnimationWithOffset(overlay, + () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), + () => !buildComplete, p => WithTurret.ZOffsetFromCenter(self, p, 1))); + } + + public void BuildingComplete(Actor self) + { + buildComplete = true; + } + + public void DamageStateChanged(Actor self, AttackInfo e) + { + overlay.ReplaceAnim(RenderSprites.NormalizeSequence(overlay, e.DamageState, overlay.CurrentSequence.Name)); + } + } +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/Render/WithSpinner.cs b/OpenRA.Mods.RA/Render/WithSpinner.cs deleted file mode 100755 index 68e003d42b..0000000000 --- a/OpenRA.Mods.RA/Render/WithSpinner.cs +++ /dev/null @@ -1,42 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2011 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 OpenRA.FileFormats; -using OpenRA.Graphics; -using OpenRA.Traits; - -namespace OpenRA.Mods.RA.Render -{ - class WithSpinnerInfo : ITraitInfo, Requires, Requires - { - [Desc("Sequence name to use")] - public readonly string Sequence = "spinner"; - - [Desc("Position relative to body")] - public readonly WVec Offset = WVec.Zero; - - public object Create(ActorInitializer init) { return new WithSpinner(init.self, this); } - } - - class WithSpinner - { - public WithSpinner(Actor self, WithSpinnerInfo info) - { - var rs = self.Trait(); - var body = self.Trait(); - - var spinner = new Animation(rs.GetImage(self)); - spinner.PlayRepeating(info.Sequence); - rs.anims.Add("spinner_{0}".F(info.Sequence), new AnimationWithOffset(spinner, - () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), - null, p => WithTurret.ZOffsetFromCenter(self, p, 1))); - } - } -} diff --git a/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj b/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj index ac5fbd4237..3ee58da491 100644 --- a/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj +++ b/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj @@ -9,6 +9,7 @@ Library OpenRA.Mods.TS OpenRA.Mods.TS + v3.5 true diff --git a/mods/cnc/rules/vehicles.yaml b/mods/cnc/rules/vehicles.yaml index cb8acc2594..fa5a5f5b0e 100644 --- a/mods/cnc/rules/vehicles.yaml +++ b/mods/cnc/rules/vehicles.yaml @@ -565,7 +565,8 @@ MHQ: RevealsShroud: Range: 6 RenderUnit: - WithSpinner: + WithIdleOverlay@SPINNER: + Sequence: spinner Offset: -256,0,256 AttackMove: JustMove: yes diff --git a/mods/ra/rules/vehicles.yaml b/mods/ra/rules/vehicles.yaml index 89f8e773b7..c5dec0452a 100644 --- a/mods/ra/rules/vehicles.yaml +++ b/mods/ra/rules/vehicles.yaml @@ -509,8 +509,9 @@ MGG: RevealsShroud: Range: 6 RenderUnit: - WithSpinner: + WithIdleOverlay@SPINNER: Offset: -299,0,171 + Sequence: spinner AttackMove: JustMove: yes CreatesShroud: @@ -554,7 +555,8 @@ MRJ: RevealsShroud: Range: 6 RenderUnit: - WithSpinner: + WithIdleOverlay@SPINNER: + Sequence: spinner Offset: -256,0,256 AttackMove: JustMove: yes @@ -651,7 +653,8 @@ TTNK: LocalOffset: 0,0,213 AttackFrontal: RenderUnit: - WithSpinner: + WithIdleOverlay@SPINNER: + Sequence: spinner Selectable: Bounds: 28,28,0,0 AutoTarget: diff --git a/mods/ts/mod.yaml b/mods/ts/mod.yaml index cd6028d999..9c893483c1 100644 --- a/mods/ts/mod.yaml +++ b/mods/ts/mod.yaml @@ -144,7 +144,7 @@ ServerTraits: MasterServerPinger LobbyDefaults: - AllowCheats: false + AllowCheats: true Crates: true StartingUnitsClass: none FragileAlliances: false diff --git a/mods/ts/rules/structures.yaml b/mods/ts/rules/structures.yaml index c446623d7e..89afd5b241 100644 --- a/mods/ts/rules/structures.yaml +++ b/mods/ts/rules/structures.yaml @@ -31,6 +31,12 @@ GACNST: Facing: 96 ProductionBar: -Sellable: + WithIdleOverlay@TOP: + Sequence: idle-top + WithIdleOverlay@SIDE: + Sequence: idle-side + WithIdleOverlay@FRONT: + Sequence: idle-front GAPOWR: Inherits: ^Building @@ -57,6 +63,10 @@ GAPOWR: Type: Wood RevealsShroud: Range: 4 + WithIdleOverlay@LIGHTS: + Sequence: idle-lights + WithIdleOverlay@PLUG: + Sequence: idle-plug GAPILE: Inherits: ^Building @@ -91,6 +101,12 @@ GAPILE: PrimaryBuilding: IronCurtainable: ProductionBar: + WithIdleOverlay@LIGHTS: + Sequence: idle-lights + WithIdleOverlay@LIGHT: + Sequence: idle-light + WithIdleOverlay@FLAG: + Sequence: idle-flag GAWEAP: Inherits: ^Building @@ -301,6 +317,8 @@ GASPOT: # TODO: has moving spotlights RenderDetectionCircle: DetectCloaked: Range: 3 + WithIdleOverlay@LIGHTS: + Sequence: idle-lights GAHPAD: Inherits: ^Building @@ -332,8 +350,10 @@ GAHPAD: RepairsUnits: # RallyPoint: ProductionBar: - -RenderBuilding: - RenderBuildingWarFactory: # TODO: workaround + WithIdleOverlay@PLATFORM: + Sequence: idle-platform + WithIdleOverlay@LIGHTS: + Sequence: idle-lights # custom prerequisites: ANYPOWER: diff --git a/mods/ts/sequences/structures.yaml b/mods/ts/sequences/structures.yaml index 34ed469bb4..f5fef7e830 100644 --- a/mods/ts/sequences/structures.yaml +++ b/mods/ts/sequences/structures.yaml @@ -1,21 +1,21 @@ -gacnst: # TODO: write a render trait for the overlays +gacnst: idle: gtcnst Start: 0 ShadowStart: 3 - medium-damaged-idle: gtcnst + damaged-idle: gtcnst Start: 1 ShadowStart: 4 - damaged-idle: gtcnst + critical-idle: gtcnst Start: 2 ShadowStart: 5 make: gtcnstmk Start: 0 Length: 24 ShadowStart: 24 - build-front: gtcnst_d + build-front: gtcnst_d # TODO: needs a render overlay trait Start: 0 Length: 20 - damaged-build-front: gtcnst_d + damaged-build-front: gtcnst_d # TODO: needs a render overlay trait Start: 0 Length: 20 idle-top: gtcnst_c @@ -26,7 +26,7 @@ gacnst: # TODO: write a render trait for the overlays Start: 15 Length: 15 Tick: 200 - heavy-damaged-idle-top: gtcnst_c + critical-idle-top: gtcnst_c Start: 30 idle-side: gtcnst_a Start: 0 @@ -34,7 +34,7 @@ gacnst: # TODO: write a render trait for the overlays damaged-idle-side: gtcnst_a Start: 10 Length: 10 - heavy-damaged-idle-side: gtcnst_a + critical-idle-side: gtcnst_a Start: 20 Length: 10 idle-front: gtcnst_b @@ -43,42 +43,85 @@ gacnst: # TODO: write a render trait for the overlays damaged-idle-front: gtcnst_b Start: 0 Length: 10 + critical-idle-front: gtcnst_b + Start: 0 + Length: 10 -gapowr: # TODO: shadow, plugs +gapowr: idle: gtpowr Start: 0 ShadowStart: 3 + damaged-idle: gtpowr + Start: 1 + ShadowStart: 4 + critical-idle: gtpowr + Start: 2 + ShadowStart: 5 + idle-lights: gtpowr_a + Start: 0 + Length: 12 + Tick: 200 + damaged-idle-lights: gtpowr_a + Start: 12 + Length: 12 + Tick: 200 + critical-idle-lights: gtpowr_a + Start: 24 + Length: 12 + Tick: 200 + idle-plug: gtpowr_b + Start: 0 + Length: 12 + Tick: 200 + damaged-idle-plug: gtpowr_b + Start: 0 + Length: 12 + Tick: 200 + critical-idle-plug: gtpowr_b + Start: 0 + Length: 12 + Tick: 200 make: gtpowrmk Start: 0 Length: 20 ShadowStart: 20 - damaged-idle: gtpowr - Start: 1 - ShadowStart: 4 - dead: gtpowr - Start: 2 - ShadowStart: 5 gapile: idle: gtpile Start: 0 ShadowStart: 3 -# TODO: lights: gtpile_a -# Start: 0 -# TODO: light: gtpile_b -# Start: 0 -# TODO: flag: gtpile_c -# Start:0 + damaged-idle: gtpile + Start: 1 + ShadowStart: 4 + critical-idle: gtpile + Start: 2 + ShadowStart: 5 + idle-lights: gtpile_a + Start: 0 + Length: 7 + Tick: 200 + damaged-idle-lights: gtpile_a + Start:7 + Length: 7 + Tick: 200 + idle-light: gtpile_b + Start: 0 + Length: 7 + Tick: 200 + damaged-idle-light: gtpile_b + Start:7 + Length: 7 + Tick: 200 + idle-flag: gtpile_c + Start:0 + Length: 7 + damaged-idle-flag: gtpile_c + Start:7 + Length: 7 make: gtpilemk Start: 0 Length: 20 ShadowStart: 20 - damaged-idle: gtpile - Start: 1 - ShadowStart: 4 - dead: gtpile - Start: 2 - ShadowStart: 5 gaweap: idle: gtweap @@ -175,38 +218,68 @@ gaarty: Length: 16 ShadowStart: 16 -gaspot: # TODO: 1 more damage state, GASPOT_A active animation +gaspot: idle: Start: 0 ShadowStart: 3 damaged-idle: Start: 1 ShadowStart: 4 + critical-idle: + Start: 2 + ShadowStart: 5 + idle-lights: gaspot_a + Start: 0 + Length: 8 + Tick: 200 + damaged-idle-lights: gaspot_a + Start: 8 + Length: 8 + Tick: 200 + critical-idle-lights: gaspot_a + Start: 16 + Length: 8 + Tick: 200 make: gaspotmk Start: 0 Length: 14 ShadowStart: 14 -gahpad: # TODO: 1 more damage state +gahpad: idle: Start: 0 ShadowStart: 3 damaged-idle: Start: 1 ShadowStart: 4 + critical-idle: + Start: 2 + ShadowStart: 5 + idle-platform: gthpadbb + Start: 0 + ShadowStart: 3 + damaged-idle-platform: gthpadbb + Start: 1 + ShadowStart: 4 + critical-idle-platform: gthpadbb + Start: 2 + ShadowStart: 5 + idle-lights: gahpad_a + Start: 0 + Length: 8 + Offset: 2,-12 + Tick: 200 + damaged-idle-lights: gthpad_a + Start: 8 + Length: 8 + Offset: 16,-16 + Tick: 200 + critical-idle-lights: gthpad_a + Start: 16 + Length: 8 + Offset: 24,-24 + Tick: 200 make: gahpadmk Start: 0 Length: 18 - ShadowStart: 18 - build-top: gahpad_a - Start: 8 - Length: 8 - damaged-build-top: gahpad_a - Start: 0 - Length: 8 - idle-top: gahpadbb - Start: 0 - ShadowStart: 3 - damaged-idle-top: gahpadbb - Start: 1 - ShadowStart: 4 \ No newline at end of file + ShadowStart: 18 \ No newline at end of file