From d6fb05ce6837426f0db395a04ae1cb07a1bb5174 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 7 Apr 2015 22:32:38 +0200 Subject: [PATCH 01/18] Introduced VisualBounds on SelectionDecorations To allow visual selection boxes to be independent from Selectable.Bounds. --- OpenRA.Game/Actor.cs | 15 ++++++++++++ .../Graphics/SelectionBarsRenderable.cs | 2 +- .../Graphics/SelectionBoxRenderable.cs | 14 +++++------ OpenRA.Game/Traits/Selectable.cs | 1 + OpenRA.Game/Traits/SelectionDecorations.cs | 6 +++-- .../UtilityCommands/UpgradeRules.cs | 23 +++++++++++++++++++ 6 files changed, 51 insertions(+), 10 deletions(-) diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index 3f8599470e..2be0d3fea9 100644 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -41,12 +41,14 @@ namespace OpenRA public int Generation; Lazy bounds; + Lazy visualBounds; Lazy facing; Lazy health; Lazy occupySpace; Lazy effectiveOwner; public Rectangle Bounds { get { return bounds.Value; } } + public Rectangle VisualBounds { get { return visualBounds.Value; } } public IOccupySpace OccupiesSpace { get { return occupySpace.Value; } } public IEffectiveOwner EffectiveOwner { get { return effectiveOwner.Value; } } @@ -110,6 +112,19 @@ namespace OpenRA return new Rectangle(offset.X, offset.Y, size.X, size.Y); }); + visualBounds = Exts.Lazy(() => + { + var sd = Info.Traits.GetOrDefault(); + var size = (sd != null && sd.VisualBounds != null) ? new int2(sd.VisualBounds[0], sd.VisualBounds[1]) : + TraitsImplementing().Select(x => x.SelectionSize(this)).FirstOrDefault(); + + var offset = -size / 2; + if (sd != null && sd.VisualBounds != null && sd.VisualBounds.Length > 2) + offset += new int2(sd.VisualBounds[2], sd.VisualBounds[3]); + + return new Rectangle(offset.X, offset.Y, size.X, size.Y); + }); + renderModifiers = TraitsImplementing().ToArray(); renders = TraitsImplementing().ToArray(); disables = TraitsImplementing().ToArray(); diff --git a/OpenRA.Game/Graphics/SelectionBarsRenderable.cs b/OpenRA.Game/Graphics/SelectionBarsRenderable.cs index a297a14e35..45cf7b9e36 100644 --- a/OpenRA.Game/Graphics/SelectionBarsRenderable.cs +++ b/OpenRA.Game/Graphics/SelectionBarsRenderable.cs @@ -158,7 +158,7 @@ namespace OpenRA.Graphics var health = actor.TraitOrDefault(); var screenPos = wr.ScreenPxPosition(pos); - var bounds = actor.Bounds; + var bounds = actor.VisualBounds; bounds.Offset(screenPos.X, screenPos.Y); var start = new float2(bounds.Left + 1, bounds.Top); diff --git a/OpenRA.Game/Graphics/SelectionBoxRenderable.cs b/OpenRA.Game/Graphics/SelectionBoxRenderable.cs index 825314c0a5..e36eb24a59 100644 --- a/OpenRA.Game/Graphics/SelectionBoxRenderable.cs +++ b/OpenRA.Game/Graphics/SelectionBoxRenderable.cs @@ -18,16 +18,16 @@ namespace OpenRA.Graphics { readonly WPos pos; readonly float scale; - readonly Rectangle bounds; + readonly Rectangle visualBounds; readonly Color color; public SelectionBoxRenderable(Actor actor, Color color) - : this(actor.CenterPosition, actor.Bounds, 1f, color) { } + : this(actor.CenterPosition, actor.VisualBounds, 1f, color) { } - public SelectionBoxRenderable(WPos pos, Rectangle bounds, float scale, Color color) + public SelectionBoxRenderable(WPos pos, Rectangle visualBounds, float scale, Color color) { this.pos = pos; - this.bounds = bounds; + this.visualBounds = visualBounds; this.scale = scale; this.color = color; } @@ -40,15 +40,15 @@ namespace OpenRA.Graphics public IRenderable WithPalette(PaletteReference newPalette) { return this; } public IRenderable WithZOffset(int newOffset) { return this; } - public IRenderable OffsetBy(WVec vec) { return new SelectionBoxRenderable(pos + vec, bounds, scale, color); } + public IRenderable OffsetBy(WVec vec) { return new SelectionBoxRenderable(pos + vec, visualBounds, scale, color); } public IRenderable AsDecoration() { return this; } public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; } public void Render(WorldRenderer wr) { var screenPos = wr.ScreenPxPosition(pos); - var tl = screenPos + scale * new float2(bounds.Left, bounds.Top); - var br = screenPos + scale * new float2(bounds.Right, bounds.Bottom); + var tl = screenPos + scale * new float2(visualBounds.Left, visualBounds.Top); + var br = screenPos + scale * new float2(visualBounds.Right, visualBounds.Bottom); var tr = new float2(br.X, tl.Y); var bl = new float2(tl.X, br.Y); var u = new float2(4f / wr.Viewport.Zoom, 0); diff --git a/OpenRA.Game/Traits/Selectable.cs b/OpenRA.Game/Traits/Selectable.cs index ed1df48ec1..bc069114f5 100644 --- a/OpenRA.Game/Traits/Selectable.cs +++ b/OpenRA.Game/Traits/Selectable.cs @@ -19,6 +19,7 @@ namespace OpenRA.Traits { public readonly bool Selectable = true; public readonly int Priority = 10; + [Desc("Bounds for the selectable area.")] public readonly int[] Bounds = null; [Desc("All units having the same selection class specified will be selected with select-by-type commands (e.g. double-click). " diff --git a/OpenRA.Game/Traits/SelectionDecorations.cs b/OpenRA.Game/Traits/SelectionDecorations.cs index 072a556243..4008a416ad 100644 --- a/OpenRA.Game/Traits/SelectionDecorations.cs +++ b/OpenRA.Game/Traits/SelectionDecorations.cs @@ -17,6 +17,8 @@ namespace OpenRA.Traits public class SelectionDecorationsInfo : ITraitInfo { public readonly string Palette = "chrome"; + [Desc("Visual bounds for the selection box. If null, it matches Bounds.")] + public readonly int[] VisualBounds = null; public object Create(ActorInitializer init) { return new SelectionDecorations(init.Self, this); } } @@ -41,7 +43,7 @@ namespace OpenRA.Traits if (!self.Owner.IsAlliedWith(self.World.RenderPlayer) || self.World.FogObscures(self)) yield break; - var b = self.Bounds; + var b = self.VisualBounds; var pos = wr.ScreenPxPosition(self.CenterPosition); var tl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Top)); var bl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Bottom)); @@ -85,7 +87,7 @@ namespace OpenRA.Traits var pipxyBase = basePosition + new int2(1 - pipSize.X / 2, -(3 + pipSize.Y / 2)); var pipxyOffset = new int2(0, 0); var pal = wr.Palette(Info.Palette); - var width = self.Bounds.Width; + var width = self.VisualBounds.Width; foreach (var pips in pipSources) { diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 765bb75321..37c63131d0 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -1152,6 +1152,29 @@ namespace OpenRA.Mods.Common.UtilityCommands } } + if (engineVersion < 20150603) + { + if (depth == 0 && node.Value.Nodes.Exists(n => n.Key == "Selectable")) + { + var selectable = node.Value.Nodes.FirstOrDefault(n => n.Key == "Selectable"); + var selDecor = node.Value.Nodes.FirstOrDefault(n => n.Key == "SelectionDecorations"); + var selectableNodes = selectable.Value.Nodes; + var bounds = selectableNodes.FirstOrDefault(n => n.Key == "Bounds"); + + if (bounds != null) + { + var visualBounds = FieldLoader.GetValue("Bounds", bounds.Value.Value); + if (selDecor != null) + selDecor.Value.Nodes.Add(new MiniYamlNode("VisualBounds", visualBounds.ToString())); + else + node.Value.Nodes.Add(new MiniYamlNode("SelectionDecorations", "", new List + { + new MiniYamlNode("VisualBounds", visualBounds), + })); + } + } + } + UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); } } From a3bd007ac708019ff4d6ffa7d4aee7c377b57d97 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Mon, 1 Jun 2015 04:35:34 +0200 Subject: [PATCH 02/18] Moved SelectionDecorations to Mods.Common And added more settings. Moved SelectionBoxRenderable to Mods.Common, too. --- OpenRA.Game/Actor.cs | 8 +++--- OpenRA.Game/OpenRA.Game.csproj | 2 -- OpenRA.Game/Traits/Selectable.cs | 6 ----- OpenRA.Game/Traits/TraitsInterfaces.cs | 10 ++++++++ .../Graphics/SelectionBoxRenderable.cs | 2 +- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 2 ++ .../Traits/SelectionDecorations.cs | 25 ++++++++++++++++--- .../Traits/SupportPowers/GrantUpgradePower.cs | 1 + .../Traits/SupportPowers/ChronoshiftPower.cs | 1 + 9 files changed, 40 insertions(+), 17 deletions(-) rename {OpenRA.Game => OpenRA.Mods.Common}/Graphics/SelectionBoxRenderable.cs (98%) rename {OpenRA.Game => OpenRA.Mods.Common}/Traits/SelectionDecorations.cs (81%) diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index 2be0d3fea9..49d0e23b56 100644 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -114,13 +114,13 @@ namespace OpenRA visualBounds = Exts.Lazy(() => { - var sd = Info.Traits.GetOrDefault(); - var size = (sd != null && sd.VisualBounds != null) ? new int2(sd.VisualBounds[0], sd.VisualBounds[1]) : + var sd = Info.Traits.GetOrDefault(); + var size = (sd != null && sd.SelectionBoxBounds != null) ? new int2(sd.SelectionBoxBounds[0], sd.SelectionBoxBounds[1]) : TraitsImplementing().Select(x => x.SelectionSize(this)).FirstOrDefault(); var offset = -size / 2; - if (sd != null && sd.VisualBounds != null && sd.VisualBounds.Length > 2) - offset += new int2(sd.VisualBounds[2], sd.VisualBounds[3]); + if (sd != null && sd.SelectionBoxBounds != null && sd.SelectionBoxBounds.Length > 2) + offset += new int2(sd.SelectionBoxBounds[2], sd.SelectionBoxBounds[3]); return new Rectangle(offset.X, offset.Y, size.X, size.Y); }); diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index e986b98116..6f66baceeb 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -180,7 +180,6 @@ - @@ -235,7 +234,6 @@ - diff --git a/OpenRA.Game/Traits/Selectable.cs b/OpenRA.Game/Traits/Selectable.cs index bc069114f5..6ba7b12f39 100644 --- a/OpenRA.Game/Traits/Selectable.cs +++ b/OpenRA.Game/Traits/Selectable.cs @@ -61,12 +61,6 @@ namespace OpenRA.Traits public IEnumerable RenderAfterWorld(WorldRenderer wr) { - if (!Info.Selectable) - yield break; - - yield return new SelectionBoxRenderable(self, Color.White); - yield return new SelectionBarsRenderable(self); - if (self.World.LocalPlayer != null && self.World.LocalPlayer.PlayerActor.Trait().PathDebug) yield return new TargetLineRenderable(ActivityTargetPath(), Color.Green); } diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 2e82851707..5fe2bc9551 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -110,6 +110,16 @@ namespace OpenRA.Traits public interface ISeedableResource { void Seed(Actor self); } + public interface ISelectionDecorations + { + ISelectionDecorationsInfo SelectionDecorationsInfo { get; } + } + + public interface ISelectionDecorationsInfo + { + int[] SelectionBoxBounds { get; } + } + public interface IVoiced { string VoiceSet { get; } diff --git a/OpenRA.Game/Graphics/SelectionBoxRenderable.cs b/OpenRA.Mods.Common/Graphics/SelectionBoxRenderable.cs similarity index 98% rename from OpenRA.Game/Graphics/SelectionBoxRenderable.cs rename to OpenRA.Mods.Common/Graphics/SelectionBoxRenderable.cs index e36eb24a59..fd1bb1f099 100644 --- a/OpenRA.Game/Graphics/SelectionBoxRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/SelectionBoxRenderable.cs @@ -12,7 +12,7 @@ using System.Drawing; using OpenRA.Graphics; using OpenRA.Traits; -namespace OpenRA.Graphics +namespace OpenRA.Mods.Common.Graphics { public struct SelectionBoxRenderable : IRenderable, IFinalizedRenderable { diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index b42d802411..447dd44b70 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -171,6 +171,7 @@ + @@ -438,6 +439,7 @@ + diff --git a/OpenRA.Game/Traits/SelectionDecorations.cs b/OpenRA.Mods.Common/Traits/SelectionDecorations.cs similarity index 81% rename from OpenRA.Game/Traits/SelectionDecorations.cs rename to OpenRA.Mods.Common/Traits/SelectionDecorations.cs index 4008a416ad..9d6c1531f4 100644 --- a/OpenRA.Game/Traits/SelectionDecorations.cs +++ b/OpenRA.Mods.Common/Traits/SelectionDecorations.cs @@ -9,21 +9,30 @@ #endregion using System.Collections.Generic; +using System.Drawing; using System.Linq; using OpenRA.Graphics; +using OpenRA.Mods.Common.Graphics; +using OpenRA.Traits; -namespace OpenRA.Traits +namespace OpenRA.Mods.Common.Traits { - public class SelectionDecorationsInfo : ITraitInfo + public class SelectionDecorationsInfo : ITraitInfo, ISelectionDecorationsInfo { public readonly string Palette = "chrome"; - [Desc("Visual bounds for the selection box. If null, it matches Bounds.")] + [Desc("Visual bounds for selection box. If null, it uses AutoSelectionSize.")] public readonly int[] VisualBounds = null; + [Desc("Health bar, production progress bar etc.")] + public readonly bool RenderSelectionBars = true; + public readonly bool RenderSelectionBox = true; + public readonly Color SelectionBoxColor = Color.White; public object Create(ActorInitializer init) { return new SelectionDecorations(init.Self, this); } + + public int[] SelectionBoxBounds { get { return VisualBounds; } } } - public class SelectionDecorations : IPostRenderSelection + public class SelectionDecorations : ISelectionDecorations, IPostRenderSelection { // depends on the order of pips in TraitsInterfaces.cs! static readonly string[] PipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray", "pip-blue", "pip-ammo", "pip-ammoempty" }; @@ -32,6 +41,8 @@ namespace OpenRA.Traits public SelectionDecorationsInfo Info; readonly Actor self; + public ISelectionDecorationsInfo SelectionDecorationsInfo { get { return Info; } } + public SelectionDecorations(Actor self, SelectionDecorationsInfo info) { this.self = self; @@ -43,6 +54,12 @@ namespace OpenRA.Traits if (!self.Owner.IsAlliedWith(self.World.RenderPlayer) || self.World.FogObscures(self)) yield break; + if (Info.RenderSelectionBox) + yield return new SelectionBoxRenderable(self, Info.SelectionBoxColor); + + if (Info.RenderSelectionBars) + yield return new SelectionBarsRenderable(self); + var b = self.VisualBounds; var pos = wr.ScreenPxPosition(self.CenterPosition); var tl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Top)); diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/GrantUpgradePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/GrantUpgradePower.cs index 76080d3239..18f2e1aaae 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/GrantUpgradePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/GrantUpgradePower.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; using OpenRA.Graphics; +using OpenRA.Mods.Common.Graphics; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/ChronoshiftPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/ChronoshiftPower.cs index c6438fe380..642c4983d9 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/ChronoshiftPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/ChronoshiftPower.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; using OpenRA.Graphics; +using OpenRA.Mods.Common.Graphics; using OpenRA.Mods.Common.Traits; using OpenRA.Mods.RA.Activities; From 0ff22b8cbc72e8ebae6b0256ad53b1f069a20c2d Mon Sep 17 00:00:00 2001 From: reaperrr Date: Wed, 8 Apr 2015 00:21:32 +0200 Subject: [PATCH 03/18] Changed Bounds/added VisualBounds in RA mod --- mods/ra/rules/aircraft.yaml | 16 ++++++------ mods/ra/rules/civilian.yaml | 21 ++++++++-------- mods/ra/rules/defaults.yaml | 7 +++++- mods/ra/rules/infantry.yaml | 6 ++++- mods/ra/rules/ships.yaml | 16 +++++++++--- mods/ra/rules/structures.yaml | 28 ++++++++++++++++++++- mods/ra/rules/vehicles.yaml | 40 ++++++++++++++++-------------- mods/ra/sequences/decorations.yaml | 4 +++ 8 files changed, 95 insertions(+), 43 deletions(-) diff --git a/mods/ra/rules/aircraft.yaml b/mods/ra/rules/aircraft.yaml index d6c8daaeb3..56343c4a39 100644 --- a/mods/ra/rules/aircraft.yaml +++ b/mods/ra/rules/aircraft.yaml @@ -114,7 +114,9 @@ MIG: Ammo: 8 ReturnOnIdle: Selectable: - Bounds: 40,29,0,1 + Bounds: 36,28,0,2 + SelectionDecorations: + VisualBounds: 40,29,0,1 Contrail@1: Offset: -598,-683,0 Contrail@2: @@ -173,8 +175,8 @@ YAK: PipCount: 6 ReloadTicks: 11 ReturnOnIdle: - Selectable: - Bounds: 30,28,0,2 + SelectionDecorations: + VisualBounds: 30,28,0,2 WithMuzzleFlash: Contrail: Offset: -853,0,0 @@ -269,8 +271,8 @@ HELI: Offset: 0,0,85 AmmoPool: Ammo: 8 - Selectable: - Bounds: 36,28,0,0 + SelectionDecorations: + VisualBounds: 36,28,0,0 LeavesHusk: HuskActor: HELI.Husk SmokeTrailWhenDamaged: @@ -322,8 +324,8 @@ HIND: Ammo: 24 PipCount: 6 ReloadTicks: 8 - Selectable: - Bounds: 38,32,0,0 + SelectionDecorations: + VisualBounds: 38,32,0,0 WithMuzzleFlash: LeavesHusk: HuskActor: HIND.Husk diff --git a/mods/ra/rules/civilian.yaml b/mods/ra/rules/civilian.yaml index ac6688191c..1441215d72 100644 --- a/mods/ra/rules/civilian.yaml +++ b/mods/ra/rules/civilian.yaml @@ -3,7 +3,6 @@ C1: C2: Inherits: ^CivInfantry - Selectable: Voiced: VoiceSet: CivilianFemaleVoice @@ -12,7 +11,6 @@ C3: C4: Inherits: ^CivInfantry - Selectable: WithInfantryBody: RenderSprites: Image: C2 @@ -27,7 +25,6 @@ C5: C6: Inherits: ^CivInfantry - Selectable: WithInfantryBody: RenderSprites: Image: C2 @@ -42,7 +39,6 @@ C7: C8: Inherits: ^CivInfantry - Selectable: WithInfantryBody: RenderSprites: Image: C2 @@ -57,7 +53,6 @@ C9: C10: Inherits: ^CivInfantry - Selectable: WithInfantryBody: RenderSprites: Image: C2 @@ -639,22 +634,26 @@ LHUS: EditorTilesetFilter: RequireTilesets: TEMPERAT Selectable: - Bounds: 24,48 + Bounds: 24,24,0,16 + SelectionDecorations: + VisualBounds: 24,48 Tooltip: Name: Lighthouse Building: - Footprint: _ x - Dimensions: 1,2 + Footprint: x + Dimensions: 1,1 WINDMILL: Inherits: ^CivBuilding EditorTilesetFilter: RequireTilesets: TEMPERAT Selectable: - Bounds: 36,36 + Bounds: 24,24,0,8 + SelectionDecorations: + VisualBounds: 36,36 Tooltip: Name: Windmill Building: - Footprint: _ x - Dimensions: 1,2 + Footprint: x + Dimensions: 1,1 diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index a647a3b5c9..07d2512a33 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -58,6 +58,7 @@ ROT: 5 SelectionDecorations: Selectable: + Bounds: 24, 24 TargetableUnit: TargetTypes: Ground, Repair, Vehicle Repairable: @@ -112,6 +113,7 @@ ROT: 5 SelectionDecorations: Selectable: + Bounds: 24, 24 TargetableUnit: TargetTypes: Ground, C4, Repair, Tank Repairable: @@ -179,8 +181,9 @@ Gems: 80 Beach: 80 SelectionDecorations: + VisualBounds: 12,18,0,-8 Selectable: - Bounds: 12,18,0,-6 + Bounds: 12,18,0,-8 TargetableUnit: TargetTypes: Ground, Infantry, Disguise TakeCover: @@ -257,6 +260,7 @@ Water: 100 SelectionDecorations: Selectable: + Bounds: 24,24 TargetableUnit: TargetTypes: Ground, Water, Repair HiddenUnderFog: @@ -289,6 +293,7 @@ UseLocation: true SelectionDecorations: Selectable: + Bounds: 24,24 TargetableAircraft: TargetTypes: Air GroundedTargetTypes: Ground, Repair diff --git a/mods/ra/rules/infantry.yaml b/mods/ra/rules/infantry.yaml index 962033e668..ed6e532d14 100644 --- a/mods/ra/rules/infantry.yaml +++ b/mods/ra/rules/infantry.yaml @@ -13,6 +13,8 @@ DOG: GenericName: Dog Selectable: Bounds: 12,17,-1,-4 + SelectionDecorations: + VisualBounds: 12,17,-1,-4 Health: HP: 12 Mobile: @@ -561,7 +563,9 @@ Ant: BuildPaletteOrder: 1954 Prerequisites: ~bio Selectable: - Bounds: 30,30,0,-2 + Bounds: 24,24,0,-5 + SelectionDecorations: + VisualBounds: 30,30,0,-2 Health: HP: 750 Radius: 469 diff --git a/mods/ra/rules/ships.yaml b/mods/ra/rules/ships.yaml index a443786328..8386cc1bb4 100644 --- a/mods/ra/rules/ships.yaml +++ b/mods/ra/rules/ships.yaml @@ -35,8 +35,8 @@ SS: LocalOffset: 0,-171,0, 0,171,0 FireDelay: 2 AttackFrontal: - Selectable: - Bounds: 38,38 + SelectionDecorations: + VisualBounds: 38,38 Chronoshiftable: RepairableNear: AutoTarget: @@ -89,8 +89,8 @@ MSUB: LocalOffset: 0,-171,0, 0,171,0 FireDelay: 2 AttackFrontal: - Selectable: - Bounds: 44,44 + SelectionDecorations: + VisualBounds: 44,44 Chronoshiftable: RepairableNear: AutoTarget: @@ -145,6 +145,8 @@ DD: AttackTurreted: Selectable: Bounds: 38,38 + SelectionDecorations: + VisualBounds: 38,38 WithFacingSpriteBody: WithTurret: AutoTarget: @@ -208,6 +210,8 @@ CA: WithMuzzleFlash: Selectable: Bounds: 44,44 + SelectionDecorations: + VisualBounds: 44,44 WithFacingSpriteBody: WithTurret@PRIMARY: Turret: primary @@ -242,6 +246,8 @@ LST: Speed: 113 RevealsShroud: Range: 6c0 + SelectionDecorations: + VisualBounds: 36,36 RenderLandingCraft: OpenTerrainTypes: Clear, Rough, Road, Ore, Gems, Beach Cargo: @@ -290,6 +296,8 @@ PT: WithMuzzleFlash: Selectable: Bounds: 32,32 + SelectionDecorations: + VisualBounds: 32,32 WithFacingSpriteBody: WithTurret: AutoTarget: diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index fc704d339e..606b70fad4 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -61,6 +61,10 @@ GAP: Building: Footprint: _ x Dimensions: 1,2 + Selectable: + Bounds: 24,28,0,12 + SelectionDecorations: + VisualBounds: 24,40,0,0 RequiresPower: CanPowerDown: DisabledOverlay: @@ -269,7 +273,9 @@ IRON: CanPowerDown: DisabledOverlay: Selectable: - Bounds: 50,50,0,-12 + Bounds: 48,28,0,2 + SelectionDecorations: + VisualBounds: 50,50,0,-12 Health: HP: 1000 Armor: @@ -380,6 +386,10 @@ TSLA: Footprint: _ x Dimensions: 1,2 RequiresPower: + Selectable: + Bounds: 24,24,0,16 + SelectionDecorations: + VisualBounds: 24,36,0,4 CanPowerDown: DisabledOverlay: -GivesBuildableArea: @@ -424,6 +434,10 @@ AGUN: Building: Footprint: _ x Dimensions: 1,2 + Selectable: + Bounds: 24,28,0,16 + SelectionDecorations: + VisualBounds: 24,36,0,12 RequiresPower: CanPowerDown: DisabledOverlay: @@ -929,6 +943,10 @@ PROC: Building: Footprint: _x_ xxx x== Dimensions: 3,3 + Selectable: + Bounds: 72,50,0,12 + SelectionDecorations: + VisualBounds: 72,70,0,-2 TargetableBuilding: TargetTypes: Ground, C4, DetonateAttack, SpyInfiltrate Health: @@ -1220,6 +1238,10 @@ APWR: Building: Footprint: ___ xxx xxx Dimensions: 3,3 + Selectable: + Bounds: 72,48,0,12 + SelectionDecorations: + VisualBounds: 72,64,0,-2 Health: HP: 700 Armor: @@ -1447,6 +1469,10 @@ FIX: Building: Footprint: _x_ xxx _x_ Dimensions: 3,3 + Selectable: + Bounds: 68,34,0,3 + SelectionDecorations: + VisualBounds: 72,48 Health: HP: 800 Armor: diff --git a/mods/ra/rules/vehicles.yaml b/mods/ra/rules/vehicles.yaml index 81917d5c0b..b6f342a3f1 100644 --- a/mods/ra/rules/vehicles.yaml +++ b/mods/ra/rules/vehicles.yaml @@ -20,6 +20,8 @@ V2RL: Armament: Weapon: SCUD AttackFrontal: + SelectionDecorations: + VisualBounds: 28,28 RenderSprites: AutoTarget: Explodes: @@ -111,10 +113,10 @@ V2RL: EmptyWeapon: UnitExplodeSmall LeavesHusk: HuskActor: 2TNK.Husk - Selectable: - Bounds: 30,30 AutoSelectionSize: RenderSprites: + SelectionDecorations: + VisualBounds: 28,28 3TNK: Inherits: ^Tank @@ -154,10 +156,10 @@ V2RL: EmptyWeapon: UnitExplodeSmall LeavesHusk: HuskActor: 3TNK.Husk - Selectable: - Bounds: 30,30 AutoSelectionSize: RenderSprites: + SelectionDecorations: + VisualBounds: 28,28 4TNK: Inherits: ^Tank @@ -211,10 +213,10 @@ V2RL: Ticks: 3 HealIfBelow: 50% DamageCooldown: 150 - Selectable: - Bounds: 44,38,0,-4 AutoSelectionSize: RenderSprites: + SelectionDecorations: + VisualBounds: 44,38,0,-4 ARTY: Inherits: ^Tank @@ -265,7 +267,8 @@ HARV: Description: Collects Ore and Gems for processing.\n Unarmed Selectable: Priority: 7 - Bounds: 42,42 + SelectionDecorations: + VisualBounds: 42,42 Harvester: Capacity: 20 Resources: Ore,Gems @@ -309,7 +312,8 @@ MCV: Description: Deploys into another Construction Yard.\n Unarmed Selectable: Priority: 4 - Bounds: 42,42 + SelectionDecorations: + VisualBounds: 42,42 Health: HP: 600 Armor: @@ -618,8 +622,8 @@ TTNK: WithFacingSpriteBody: WithIdleOverlay@SPINNER: Sequence: spinner - Selectable: - Bounds: 28,28,0,0 + SelectionDecorations: + VisualBounds: 30,30 AutoTarget: Explodes: Weapon: UnitExplodeSmall @@ -663,10 +667,10 @@ FTRK: Explodes: Weapon: UnitExplodeSmall EmptyWeapon: UnitExplodeSmall - Selectable: - Bounds: 28,28,0,0 AutoSelectionSize: RenderSprites: + SelectionDecorations: + VisualBounds: 28,28 DTRK: Inherits: ^Vehicle @@ -712,8 +716,8 @@ CTNK: Tooltip: Name: Chrono Tank Description: Chrono Tank, teleports to areas within range.\n Strong vs Vehicles, Buildings\n Weak vs Infantry, Aircraft\n Special ability: Can teleport - Selectable: - Bounds: 28,28 + SelectionDecorations: + VisualBounds: 30,30 Health: HP: 400 Armor: @@ -761,9 +765,9 @@ QTNK: Crushes: wall, mine, crate, infantry RevealsShroud: Range: 6c0 - Selectable: - Bounds: 44,38,0,-4 WithFacingSpriteBody: + SelectionDecorations: + VisualBounds: 44,38,0,-4 Explodes: Weapon: UnitExplodeSmall MadTank: @@ -784,8 +788,8 @@ STNK: Tooltip: Name: Phase Transport Description: Lightly armored infantry transport\nwhich can cloak. Can detect cloaked units.\n Strong vs Light armor\n Weak vs Infantry, Tanks, Aircraft - Selectable: - Bounds: 28,28 + SelectionDecorations: + VisualBounds: 26,26 Health: HP: 300 Armor: diff --git a/mods/ra/sequences/decorations.yaml b/mods/ra/sequences/decorations.yaml index 63f7701fb2..a7b67df73b 100644 --- a/mods/ra/sequences/decorations.yaml +++ b/mods/ra/sequences/decorations.yaml @@ -806,6 +806,8 @@ snowhut: Tick: 120 lhus: + Defaults: + Offset: 0,-16 idle: Length: 16 Tick: 180 @@ -815,6 +817,8 @@ lhus: Length: 8 windmill: + Defaults: + Offset: 0,-16 idle: Length: 8 Tick: 80 From f709a6f6c4ccc194bd3c03150ff979401fa6ab65 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 5 Jun 2015 04:46:23 +0200 Subject: [PATCH 04/18] Changed Bounds/added VisualBounds in D2k mod --- mods/d2k/rules/aircraft.yaml | 4 ++-- mods/d2k/rules/defaults.yaml | 7 ++++++ mods/d2k/rules/misc.yaml | 2 ++ mods/d2k/rules/structures.yaml | 42 ++++++++++++++++++++++++++++++---- mods/d2k/rules/vehicles.yaml | 19 +++++---------- 5 files changed, 54 insertions(+), 20 deletions(-) diff --git a/mods/d2k/rules/aircraft.yaml b/mods/d2k/rules/aircraft.yaml index bdc5bd81d3..263b5ac493 100644 --- a/mods/d2k/rules/aircraft.yaml +++ b/mods/d2k/rules/aircraft.yaml @@ -145,12 +145,12 @@ orni: RearmBuildings: WithFacingSpriteBody: WithShadow: - Selectable: - Bounds: 38,32,0,0 LeavesHusk: HuskActor: orni.husk AutoSelectionSize: RenderSprites: + SelectionDecorations: + VisualBounds: 38,32,0,0 orni.bomber: AttackBomber: diff --git a/mods/d2k/rules/defaults.yaml b/mods/d2k/rules/defaults.yaml index 88f32fcc80..ef344629ad 100644 --- a/mods/d2k/rules/defaults.yaml +++ b/mods/d2k/rules/defaults.yaml @@ -34,7 +34,9 @@ Dune: 60 ROT: 5 SelectionDecorations: + VisualBounds: 32,32 Selectable: + Bounds: 32,32 TargetableUnit: TargetTypes: Ground, C4 Passenger: @@ -89,7 +91,9 @@ Dune: 70 ROT: 5 SelectionDecorations: + VisualBounds: 32,32 Selectable: + Bounds: 32,32 TargetableUnit: TargetTypes: Ground, C4 Passenger: @@ -213,6 +217,7 @@ Dune: 60 Rough: 70 SelectionDecorations: + VisualBounds: 12,18,0,-6 Selectable: Bounds: 12,18,0,-6 TargetableUnit: @@ -270,7 +275,9 @@ AppearsOnRadar: UseLocation: yes SelectionDecorations: + VisualBounds: 32,32 Selectable: + Bounds: 32,32 TargetableAircraft: TargetTypes: Air GroundedTargetTypes: Ground diff --git a/mods/d2k/rules/misc.yaml b/mods/d2k/rules/misc.yaml index 2e6426df5a..19c3c43f02 100644 --- a/mods/d2k/rules/misc.yaml +++ b/mods/d2k/rules/misc.yaml @@ -113,6 +113,8 @@ crate: Selectable: false Bounds: 15,15,-1,-1 Passenger: + SelectionDecorations: + VisualBounds: 15,15,-1,-1 mpspawn: Immobile: diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index 230fc5d859..8c4ef3d6d3 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -76,6 +76,8 @@ conyard: WithBuildingPlacedOverlay: Palette: d2k PrimaryBuilding: + SelectionDecorations: + VisualBounds: 96,64 power: Inherits: ^Building @@ -110,6 +112,8 @@ power: Amount: 100 ScalePowerWithHealth: ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 64,64 barracks: Inherits: ^Building @@ -166,6 +170,8 @@ barracks: atreides: barracks.atreides ordos: barracks.ordos ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 64,64 refinery: Inherits: ^Building @@ -219,6 +225,8 @@ refinery: WithIdleOverlay@TOP: Sequence: idle-top ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 96,64 silo: Inherits: ^Building @@ -257,6 +265,8 @@ silo: Amount: -5 MustBeDestroyed: RequiredForShortGame: false + SelectionDecorations: + VisualBounds: 32,32 light: Inherits: ^Building @@ -314,6 +324,8 @@ light: Sequence: idle-top Power: Amount: -20 + SelectionDecorations: + VisualBounds: 96,64 heavy: Inherits: ^Building @@ -322,7 +334,7 @@ heavy: Queue: Building BuildPaletteOrder: 100 Selectable: - Bounds: 96,96 + Bounds: 96,68,0,12 Valued: Cost: 2000 Tooltip: @@ -372,6 +384,8 @@ heavy: Power: Amount: -30 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 96,96 radar: Inherits: ^Building @@ -414,6 +428,8 @@ radar: Power: Amount: -40 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 96,64 starport: Inherits: ^Building @@ -473,6 +489,8 @@ starport: Power: Amount: -40 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 96,64 wall: Buildable: @@ -540,7 +558,7 @@ guntower: Sellable: SellSounds: CHUNG.WAV Selectable: - Bounds: 32,40,0,-8 + Bounds: 32,32 Priority: 3 -GivesBuildableArea: Health: @@ -576,6 +594,8 @@ guntower: Amount: -20 MustBeDestroyed: RequiredForShortGame: false + SelectionDecorations: + VisualBounds: 32,40,0,-8 rockettower: Inherits: ^Building @@ -594,7 +614,7 @@ rockettower: Sellable: SellSounds: CHUNG.WAV Selectable: - Bounds: 32,40,0,-8 + Bounds: 32,32 Priority: 3 -GivesBuildableArea: Health: @@ -631,6 +651,8 @@ rockettower: Amount: -30 MustBeDestroyed: RequiredForShortGame: false + SelectionDecorations: + VisualBounds: 32,40,0,-8 repair: Inherits: ^Building @@ -652,6 +674,10 @@ repair: Type: Concrete RevealsShroud: Range: 5c0 + Selectable: + Bounds: 96,64 + SelectionDecorations: + VisualBounds: 96,80 Reservable: RepairsUnits: Interval: 15 @@ -677,7 +703,7 @@ hightech: Queue: Building BuildPaletteOrder: 110 Selectable: - Bounds: 96,96 + Bounds: 96,68,0,12 Valued: Cost: 750 Tooltip: @@ -722,6 +748,8 @@ hightech: Sequence: production-welding Power: Amount: -40 + SelectionDecorations: + VisualBounds: 96,96 research: Inherits: ^Building @@ -730,7 +758,7 @@ research: Prerequisites: radar, heavy, upgrade.heavy, ~techlevel.high BuildPaletteOrder: 140 Selectable: - Bounds: 96,64 + Bounds: 96,64,0,16 Valued: Cost: 1500 Tooltip: @@ -767,6 +795,8 @@ research: Power: Amount: -40 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 96,80 palace: Inherits: ^Building @@ -828,6 +858,8 @@ palace: RequiresPower: SupportPowerChargeBar: ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 96,96 conyard.atreides: Inherits: conyard diff --git a/mods/d2k/rules/vehicles.yaml b/mods/d2k/rules/vehicles.yaml index d475b4480d..877a651c4d 100644 --- a/mods/d2k/rules/vehicles.yaml +++ b/mods/d2k/rules/vehicles.yaml @@ -38,6 +38,8 @@ mcv: HuskActor: mcv.husk AttractsWorms: Intensity: 700 + SelectionDecorations: + VisualBounds: 42,42 harvester: Inherits: ^Vehicle @@ -85,6 +87,8 @@ harvester: Palette: effect50alpha AttractsWorms: Intensity: 700 + SelectionDecorations: + VisualBounds: 42,42 trike: Inherits: ^Vehicle @@ -99,7 +103,6 @@ trike: Description: Fast Scout\n Strong vs Infantry\n Weak vs Tanks, Aircraft Selectable: Class: trike - Bounds: 24,24 Health: HP: 100 Armor: @@ -155,7 +158,6 @@ quad: EmptyWeapon: UnitExplodeTiny Selectable: Class: quad - Bounds: 24,24 AttractsWorms: Intensity: 470 @@ -200,7 +202,6 @@ siegetank: InitialStance: Defend Selectable: Class: siegetank - Bounds: 30,30 LeavesHusk: HuskActor: siegetank.husk AttractsWorms: @@ -241,7 +242,6 @@ missiletank: EmptyWeapon: UnitExplodeScale Selectable: Class: missiletank - Bounds: 30,30 LeavesHusk: HuskActor: missiletank.husk AttractsWorms: @@ -258,8 +258,6 @@ sonictank: Tooltip: Name: Sonic Tank Description: Fires sonic shocks\n Strong vs Infantry, Vehicles\n Weak vs Artillery, Aircraft - Selectable: - Bounds: 30,30 Health: HP: 130 Armor: @@ -315,14 +313,14 @@ devast: Explodes: Weapon: UnitExplodeScale EmptyWeapon: UnitExplodeScale - Selectable: - Bounds: 44,38,0,0 LeavesHusk: HuskActor: devast.husk AttractsWorms: Intensity: 700 AutoSelectionSize: RenderSprites: + SelectionDecorations: + VisualBounds: 44,38,0,0 raider: Inherits: ^Vehicle @@ -335,8 +333,6 @@ raider: Tooltip: Name: Raider Trike Description: Improved Scout\n Strong vs Infantry, Light Vehicles - Selectable: - Bounds: 24,24 Health: HP: 110 Armor: @@ -408,8 +404,6 @@ deviatortank: Explodes: Weapon: UnitExplodeSmall EmptyWeapon: UnitExplodeSmall - Selectable: - Bounds: 30,30 LeavesHusk: HuskActor: deviatortank.husk AttractsWorms: @@ -456,7 +450,6 @@ deviatortank: EmptyWeapon: UnitExplodeSmall Selectable: Class: combat - Bounds: 30,30 AttractsWorms: Intensity: 520 AutoSelectionSize: From 332b7a374e84f913161d53444e84c912b723916d Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 5 Jun 2015 14:36:05 +0200 Subject: [PATCH 05/18] Changed Bounds/added VisualBounds in TD mod Where necessary/applicable. Tweaked Refinery Offsets. --- mods/cnc/rules/aircraft.yaml | 12 ++++++------ mods/cnc/rules/civilian.yaml | 3 +++ mods/cnc/rules/defaults.yaml | 15 ++++++++++++++- mods/cnc/rules/infantry.yaml | 12 +++++------- mods/cnc/rules/ships.yaml | 2 ++ mods/cnc/rules/structures.yaml | 28 ++++++++++++++++++++++++---- mods/cnc/rules/vehicles.yaml | 13 ++++++++----- mods/cnc/sequences/structures.yaml | 8 ++++++-- 8 files changed, 68 insertions(+), 25 deletions(-) diff --git a/mods/cnc/rules/aircraft.yaml b/mods/cnc/rules/aircraft.yaml index 2e346a3fc7..6cbdb96c33 100644 --- a/mods/cnc/rules/aircraft.yaml +++ b/mods/cnc/rules/aircraft.yaml @@ -9,8 +9,6 @@ TRAN: BuildPaletteOrder: 10 Prerequisites: hpad Queue: Aircraft.GDI, Aircraft.Nod - Selectable: - Bounds: 41,41 Helicopter: LandWhenIdle: true ROT: 5 @@ -42,6 +40,8 @@ TRAN: EmptyWeapon: HeliExplode AutoSelectionSize: RenderSprites: + SelectionDecorations: + VisualBounds: 41,41 HELI: Inherits: ^Helicopter @@ -54,8 +54,6 @@ HELI: BuildPaletteOrder: 20 Prerequisites: hpad, anyhq, ~techlevel.medium Queue: Aircraft.Nod - Selectable: - Bounds: 30,24 Helicopter: RearmBuildings: hpad ROT: 4 @@ -95,6 +93,8 @@ HELI: EmptyWeapon: HeliExplode AutoSelectionSize: RenderSprites: + SelectionDecorations: + VisualBounds: 30,24 ORCA: Inherits: ^Helicopter @@ -107,8 +107,6 @@ ORCA: BuildPaletteOrder: 20 Prerequisites: hpad, anyhq, ~techlevel.medium Queue: Aircraft.GDI - Selectable: - Bounds: 30,24 Helicopter: RearmBuildings: hpad ROT: 4 @@ -144,6 +142,8 @@ ORCA: AutoSelectionSize: WithMoveAnimation: MoveSequence: move + SelectionDecorations: + VisualBounds: 30,24 C17: ParaDrop: diff --git a/mods/cnc/rules/civilian.yaml b/mods/cnc/rules/civilian.yaml index 0ed6a8ffd4..f08639e6c3 100644 --- a/mods/cnc/rules/civilian.yaml +++ b/mods/cnc/rules/civilian.yaml @@ -438,7 +438,10 @@ VICE: Tiberium: 100 BlueTiberium: 100 Beach: 60 + SelectionDecorations: + VisualBounds: 24,24 Selectable: + Bounds: 24,24 TargetableUnit: TargetTypes: Ground AutoTarget: diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index 0b459c094d..42adf35550 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -33,7 +33,9 @@ Beach: 50 ROT: 5 SelectionDecorations: + VisualBounds: 24,24 Selectable: + Bounds: 24,24 TargetableUnit: TargetTypes: Ground, Vehicle Repairable: @@ -80,7 +82,9 @@ Beach: 70 ROT: 5 SelectionDecorations: + VisualBounds: 24,24 Selectable: + Bounds: 24,24 TargetableUnit: TargetTypes: Ground, Vehicle Repairable: @@ -124,7 +128,9 @@ TargetTypes: Air GroundedTargetTypes: Ground SelectionDecorations: + VisualBounds: 24,24 Selectable: + Bounds: 24,24 Helicopter: RepairBuildings: hpad RearmBuildings: @@ -177,6 +183,7 @@ PathingCost: 300 Beach: 80 SelectionDecorations: + VisualBounds: 12,17,0,-6 Selectable: Bounds: 12,17,0,-6 TargetableUnit: @@ -248,7 +255,6 @@ -AutoTarget: -TakeCover: AppearsOnRadar: - SelectionDecorations: Valued: Cost: 70 Tooltip: @@ -298,7 +304,10 @@ Tiberium: 70 BlueTiberium: 70 Beach: 80 + SelectionDecorations: + VisualBounds: 24,24 Selectable: + Bounds: 24,24 TargetableUnit: TargetTypes: Ground, Infantry HiddenUnderFog: @@ -328,7 +337,9 @@ AppearsOnRadar: UseLocation: yes SelectionDecorations: + VisualBounds: 24,24 Selectable: + Bounds: 24,24 TargetableUnit: TargetTypes: Air HiddenUnderFog: @@ -664,4 +675,6 @@ Selectable: Selectable: false Bounds: 15,15,-1,-1 + SelectionDecorations: + VisualBounds: 15,15,-1,-1 diff --git a/mods/cnc/rules/infantry.yaml b/mods/cnc/rules/infantry.yaml index 88f5852d0a..95e1c43bd5 100644 --- a/mods/cnc/rules/infantry.yaml +++ b/mods/cnc/rules/infantry.yaml @@ -225,8 +225,6 @@ STEG: WithDeathAnimation: DeathSequencePalette: terrain DeathPaletteIsPlayerPalette: false - Selectable: - Bounds: 24,20,0,4 TREX: Inherits: ^DINO @@ -236,7 +234,9 @@ TREX: Armament: Weapon: teeth Selectable: - Bounds: 52,38 + Bounds: 48,36,2,1 + SelectionDecorations: + VisualBounds: 52,38 TRIC: Inherits: ^DINO @@ -245,8 +245,8 @@ TRIC: Description: Quadruped with large bony frill and three horns Armament: Weapon: horn - Selectable: - Bounds: 34,24,0,2 + SelectionDecorations: + VisualBounds: 34,24,0,2 RAPT: Inherits: ^DINO @@ -255,6 +255,4 @@ RAPT: Description: Bipedal with enlarged sickle-shaped claw on each hindfoot Armament: Weapon: claw - Selectable: - Bounds: 20,20 diff --git a/mods/cnc/rules/ships.yaml b/mods/cnc/rules/ships.yaml index 0cf681618b..bb26dd8d6e 100644 --- a/mods/cnc/rules/ships.yaml +++ b/mods/cnc/rules/ships.yaml @@ -29,6 +29,8 @@ BOAT: AllowMovement: false WithSmoke: RejectsOrders: + SelectionDecorations: + VisualBounds: 42,24 LST: Inherits: ^Ship diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index 976285795f..28bcee7632 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -167,7 +167,7 @@ PROC: DockAngle: 112 DockOffset: 0,2 IsDragRequired: True - DragOffset: -640,341,0 + DragOffset: -554,512,0 DragLength: 12 TickRate: 15 StoresResources: @@ -175,7 +175,7 @@ PROC: PipCount: 10 Capacity: 2000 Selectable: - Bounds: 73,72 + Bounds: 72,56,0,12 CustomSellValue: Value: 500 FreeActor: @@ -187,6 +187,8 @@ PROC: Power: Amount: -50 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 73,72 SILO: Inherits: ^BaseBuilding @@ -214,14 +216,14 @@ SILO: PipCount: 10 PipColor: Green Capacity: 2000 - Selectable: - Bounds: 49,30 -RenderBuilding: -EmitInfantryOnSell: Power: Amount: -10 MustBeDestroyed: RequiredForShortGame: false + SelectionDecorations: + VisualBounds: 49,30 PYLE: Inherits: ^BaseBuilding @@ -301,6 +303,8 @@ HAND: Power: Amount: -20 ProvidesPrerequisite@buildingname: + Selectable: + Bounds: 48,48,0,10 AFLD: Inherits: ^BaseBuilding @@ -361,6 +365,8 @@ WEAP: Building: Footprint: ___ xxx === Dimensions: 3,3 + Selectable: + Bounds: 72,48,0,12 Health: HP: 1000 RevealsShroud: @@ -449,6 +455,8 @@ HQ: Building: Footprint: x_ xx Dimensions: 2,2 + Selectable: + Bounds: 48,36,0,12 RequiresPower: CanPowerDown: DisabledOverlay: @@ -499,6 +507,10 @@ FIX: Building: Footprint: _x_ xxx _x_ Dimensions: 3,3 + Selectable: + Bounds: 64,34,0,3 + SelectionDecorations: + VisualBounds: 72,48 Health: HP: 400 RevealsShroud: @@ -529,6 +541,8 @@ EYE: Building: Footprint: x_ xx Dimensions: 2,2 + Selectable: + Bounds: 48,36,0,12 RequiresPower: CanPowerDown: DisabledOverlay: @@ -578,6 +592,8 @@ TMPL: Building: Footprint: ___ xxx xxx Dimensions: 3,3 + Selectable: + Bounds: 72,48,0,16 RequiresPower: CanPowerDown: DisabledOverlay: @@ -713,6 +729,8 @@ OBLI: Building: Footprint: _ x Dimensions: 1,2 + Selectable: + Bounds: 24,24,0,12 RequiresPower: DisabledOverlay: -GivesBuildableArea: @@ -802,6 +820,8 @@ ATWR: Building: Footprint: _ x Dimensions: 1,2 + Selectable: + Bounds: 24,24,0,12 RequiresPower: DisabledOverlay: -GivesBuildableArea: diff --git a/mods/cnc/rules/vehicles.yaml b/mods/cnc/rules/vehicles.yaml index 28375f9e83..c2fd3bfe38 100644 --- a/mods/cnc/rules/vehicles.yaml +++ b/mods/cnc/rules/vehicles.yaml @@ -39,6 +39,8 @@ MCV: EmptyWeapon: UnitExplodeSmall AutoSelectionSize: RenderSprites: + SelectionDecorations: + VisualBounds: 36,36 HARV: Inherits: ^Tank @@ -55,7 +57,6 @@ HARV: InitialActivity: FindResources Selectable: Priority: 7 - Bounds: 36,36 Harvester: Resources: Tiberium, BlueTiberium PipCount: 7 @@ -78,6 +79,8 @@ HARV: RenderHarvester: Explodes: Weapon: TiberiumExplosion + SelectionDecorations: + VisualBounds: 36,36 APC: Inherits: ^Tank @@ -391,10 +394,10 @@ MTNK: Explodes: Weapon: UnitExplodeSmall EmptyWeapon: UnitExplodeSmall - Selectable: - Bounds: 28,28 AutoSelectionSize: RenderSprites: + SelectionDecorations: + VisualBounds: 28,28 HTNK: Inherits: ^Tank @@ -446,10 +449,10 @@ HTNK: Explodes: Weapon: UnitExplodeSmall EmptyWeapon: UnitExplodeSmall - Selectable: - Bounds: 34,34,0,-3 AutoSelectionSize: RenderSprites: + SelectionDecorations: + VisualBounds: 34,34,0,-3 MSAM: Inherits: ^Tank diff --git a/mods/cnc/sequences/structures.yaml b/mods/cnc/sequences/structures.yaml index f49502ba1c..7aa23c2e56 100644 --- a/mods/cnc/sequences/structures.yaml +++ b/mods/cnc/sequences/structures.yaml @@ -49,23 +49,27 @@ proc: idle: Length: 6 Tick: 120 + Offset: 2,4 damaged-idle: Start: 30 Length: 6 Tick: 120 + Offset: 2,4 dead: Start: 60 Tick: 800 + Offset: 2,4 make: procmake Length: * Tick: 80 + Offset: 2,4 resources: proctwr Length: 6 - Offset: -32,-21 + Offset: -30,-17 damaged-resources: proctwr Start: 6 Length: 6 - Offset: -32,-21 + Offset: -30,-17 bib: bib2 UseTilesetExtension: true Length: * From e30ede3971bd7043e5093c769e2ce38e4e1a7f82 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 5 Jun 2015 23:47:16 +0200 Subject: [PATCH 06/18] Change Bounds/add VisualBounds in TS mod --- mods/ts/rules/aircraft.yaml | 9 +++++++ mods/ts/rules/civilian-structures.yaml | 11 +++++++-- mods/ts/rules/defaults.yaml | 6 +++-- mods/ts/rules/gdi-structures.yaml | 29 +++++++++++++++++----- mods/ts/rules/gdi-support.yaml | 4 +++- mods/ts/rules/gdi-vehicles.yaml | 4 ++++ mods/ts/rules/nod-infantry.yaml | 4 ++++ mods/ts/rules/nod-structures.yaml | 33 +++++++++++++++++++------- mods/ts/rules/nod-support.yaml | 15 +++++++++--- mods/ts/rules/shared-structures.yaml | 10 ++++++-- mods/ts/rules/shared-support.yaml | 3 +++ mods/ts/rules/shared-vehicles.yaml | 4 ++++ 12 files changed, 108 insertions(+), 24 deletions(-) diff --git a/mods/ts/rules/aircraft.yaml b/mods/ts/rules/aircraft.yaml index 72fefc42cf..cdf343eb56 100644 --- a/mods/ts/rules/aircraft.yaml +++ b/mods/ts/rules/aircraft.yaml @@ -95,6 +95,8 @@ ORCA: RenderVoxels: WithVoxelBody: Hovers: + SelectionDecorations: + VisualBounds: 30,24 ORCAB: Inherits: ^Plane @@ -136,6 +138,8 @@ ORCAB: RenderVoxels: WithVoxelBody: Hovers: + SelectionDecorations: + VisualBounds: 30,24 ORCATRAN: Inherits: ^Helicopter @@ -230,6 +234,8 @@ SCRIN: RenderSprites: RenderVoxels: WithVoxelBody: + SelectionDecorations: + VisualBounds: 30,24 APACHE: Inherits: ^Helicopter @@ -270,3 +276,6 @@ APACHE: RenderVoxels: WithVoxelBody: Hovers: + SelectionDecorations: + VisualBounds: 30,24 + diff --git a/mods/ts/rules/civilian-structures.yaml b/mods/ts/rules/civilian-structures.yaml index c306a6c81d..a844475741 100644 --- a/mods/ts/rules/civilian-structures.yaml +++ b/mods/ts/rules/civilian-structures.yaml @@ -1302,7 +1302,7 @@ GASPOT: Footprint: x Dimensions: 1, 1 Selectable: - Bounds: 48, 82, 0, -25 + Bounds: 48, 30, 0, -4 Power: Amount: -10 Armor: @@ -1313,6 +1313,8 @@ GASPOT: Range: 6c0 WithIdleOverlay@LIGHTS: Sequence: idle-lights + SelectionDecorations: + VisualBounds: 48, 82, 0, -25 GALITE: Inherits: ^Building @@ -1336,10 +1338,12 @@ GALITE: Sequence: lighting Palette: alpha Selectable: - Bounds: 25, 35, 0, -12 + Bounds: 24, 24, 0, -4 Buildable: Queue: Defense Prerequisites: ~disabled + SelectionDecorations: + VisualBounds: 25, 35, 0, -12 GAICBM: Inherits: ^Building @@ -1410,3 +1414,6 @@ UFO: Type: Heavy EditorTilesetFilter: RequireTilesets: TEMPERAT + SelectionDecorations: + VisualBounds: 144, 72, 0, 0 + diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 95c5d57726..44e446f955 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -139,6 +139,8 @@ Selectable: Selectable: false Bounds: 25,25,-1,-1 + SelectionDecorations: + VisualBounds: 25,25,-1,-1 ^Wall: AppearsOnRadar: @@ -213,6 +215,7 @@ BlueTiberium: 80 SelectionDecorations: Palette: pips + VisualBounds: 14,23,-1,-9 Selectable: Bounds: 14,23,-1,-9 Voiced: @@ -279,8 +282,6 @@ ^CivilianInfantry: Inherits: ^Infantry - Selectable: - Bounds: 12,17,0,-9 Voiced: VoiceSet: Civilian Valued: @@ -502,6 +503,7 @@ BlueTiberium: 100 SelectionDecorations: Palette: pips + VisualBounds: 26,26,0,-3 Selectable: Bounds: 26,26,0,-3 TargetableUnit: diff --git a/mods/ts/rules/gdi-structures.yaml b/mods/ts/rules/gdi-structures.yaml index 2afaf69112..63921bffac 100644 --- a/mods/ts/rules/gdi-structures.yaml +++ b/mods/ts/rules/gdi-structures.yaml @@ -25,7 +25,7 @@ GAPOWR: WithIdleOverlay@PLUG: Sequence: idle-plug Selectable: - Bounds: 90, 84, 0, -12 + Bounds: 90, 48, 0, -6 Power: Amount: 100 InfiltrateForPowerOutage: @@ -59,6 +59,8 @@ GAPOWR: UpgradeMinEnabledLevel: 1 Amount: 50 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 90, 84, 0, -12 GAPILE: Inherits: ^Building @@ -77,7 +79,7 @@ GAPILE: Footprint: xx xx Dimensions: 2,2 Selectable: - Bounds: 88, 56, 0, -8 + Bounds: 88, 48, 0, -8 Health: HP: 800 Armor: @@ -102,6 +104,8 @@ GAPILE: Power: Amount: -20 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 88, 56, 0, -8 GAWEAP: Inherits: ^Building @@ -120,7 +124,7 @@ GAWEAP: Footprint: xxx= xxx= xxx= Dimensions: 4,3 Selectable: - Bounds: 154, 100, -2, -12 + Bounds: 154, 96, -2, -12 Health: HP: 1000 RevealsShroud: @@ -149,6 +153,8 @@ GAWEAP: Power: Amount: -30 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 154, 100, -2, -12 GAHPAD: Inherits: ^Building @@ -189,6 +195,8 @@ GAHPAD: Selectable: Bounds: 88, 66, 0, -5 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 88, 66, 0, -5 GADEPT: Inherits: ^Building @@ -205,7 +213,7 @@ GADEPT: Footprint: =x= xxx =x= Dimensions: 3,3 Selectable: - Bounds: 98, 68, -6, -6 + Bounds: 96, 64, -6, -6 Health: HP: 1100 RevealsShroud: @@ -229,6 +237,8 @@ GADEPT: Power: Amount: -30 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 98, 68, -6, -6 GARADR: Inherits: ^Building @@ -247,7 +257,7 @@ GARADR: Footprint: xx xx Dimensions: 2,2 Selectable: - Bounds: 96, 118, 0, -38 + Bounds: 96, 48, 0, -6 Health: HP: 800 Armor: @@ -270,6 +280,8 @@ GARADR: Power: Amount: -50 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 96, 118, 0, -38 GATECH: Inherits: ^Building @@ -300,6 +312,8 @@ GATECH: Power: Amount: -150 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 110, 60, 3, -4 GAPLUG: Inherits: ^Building @@ -309,7 +323,7 @@ GAPLUG: Name: GDI Upgrade Center Description: Can be upgraded for additional technology. Selectable: - Bounds: 115,104,0,-24 + Bounds: 115,72,0,-12 Buildable: BuildPaletteOrder: 100 Prerequisites: proc, gatech @@ -373,3 +387,6 @@ GAPLUG: UpgradeMinEnabledLevel: 1 Sequence: idle-ioncannonb ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 115,104,0,-24 + diff --git a/mods/ts/rules/gdi-support.yaml b/mods/ts/rules/gdi-support.yaml index 5a84ac6bfa..825ce60465 100644 --- a/mods/ts/rules/gdi-support.yaml +++ b/mods/ts/rules/gdi-support.yaml @@ -36,7 +36,7 @@ GACTWR: Prerequisites: gapile, ~structures.gdi Building: Selectable: - Bounds: 48, 48, 0, -12 + Bounds: 48, 36, 0, -6 DisabledOverlay: -GivesBuildableArea: Health: @@ -128,6 +128,8 @@ GACTWR: tower.rocket: tower, tower.rocket tower.sam: tower, tower.sam ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 48, 48, 0, -12 GAVULC: Inherits: ^BuildingPlug diff --git a/mods/ts/rules/gdi-vehicles.yaml b/mods/ts/rules/gdi-vehicles.yaml index c3cc680dfd..eaef2bfeed 100644 --- a/mods/ts/rules/gdi-vehicles.yaml +++ b/mods/ts/rules/gdi-vehicles.yaml @@ -115,6 +115,8 @@ SMECH: MoveSequence: run Selectable: Bounds: 20, 32, 0, -8 + SelectionDecorations: + VisualBounds: 20, 32, 0, -8 MMCH: Inherits: ^Tank @@ -154,6 +156,8 @@ MMCH: AutoTarget: Selectable: Bounds: 30, 42, 0, -8 + SelectionDecorations: + VisualBounds: 30, 42, 0, -8 HMEC: Inherits: ^Tank diff --git a/mods/ts/rules/nod-infantry.yaml b/mods/ts/rules/nod-infantry.yaml index a536817863..873ec14e7d 100644 --- a/mods/ts/rules/nod-infantry.yaml +++ b/mods/ts/rules/nod-infantry.yaml @@ -56,6 +56,8 @@ CYBORG: WithInfantryBody: IdleSequences: idle1,idle2 WithPermanentInjury: + SelectionDecorations: + VisualBounds: 16,31,0,-10 CYC2: Inherits: ^Infantry @@ -92,6 +94,8 @@ CYC2: WithInfantryBody: IdleSequences: idle1,idle2 WithPermanentInjury: + SelectionDecorations: + VisualBounds: 16,32,-1,-12 MHIJACK: Inherits: ^Infantry diff --git a/mods/ts/rules/nod-structures.yaml b/mods/ts/rules/nod-structures.yaml index b53dcc6f76..dcbfd3ca11 100644 --- a/mods/ts/rules/nod-structures.yaml +++ b/mods/ts/rules/nod-structures.yaml @@ -15,7 +15,7 @@ NAPOWR: Footprint: xx xx Dimensions: 2,2 Selectable: - Bounds: 88, 80, 2, -12 + Bounds: 88, 48, 2, -6 Health: HP: 750 Armor: @@ -32,6 +32,8 @@ NAPOWR: TargetTypes: Ground, C4, DetonateAttack, SpyInfiltrate ScalePowerWithHealth: DisabledOverlay: + SelectionDecorations: + VisualBounds: 88, 80, 2, -12 NAAPWR: Inherits: ^Building @@ -50,7 +52,7 @@ NAAPWR: Footprint: xxx xxx Dimensions: 2,3 Selectable: - Bounds: 100, 74, 0, -12 + Bounds: 100, 54, 0, -4 Health: HP: 900 Armor: @@ -67,6 +69,8 @@ NAAPWR: TargetTypes: Ground, C4, DetonateAttack, SpyInfiltrate ScalePowerWithHealth: DisabledOverlay: + SelectionDecorations: + VisualBounds: 100, 74, 0, -12 NAHAND: Inherits: ^Building @@ -85,7 +89,7 @@ NAHAND: Footprint: xxx xxx Dimensions: 3,2 Selectable: - Bounds: 116, 78, 3, -8 + Bounds: 116, 60, 3, -6 Health: HP: 800 Armor: @@ -108,6 +112,8 @@ NAHAND: Power: Amount: -20 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 116, 78, 3, -8 NAWEAP: Inherits: ^Building @@ -126,7 +132,7 @@ NAWEAP: Footprint: xxx= xxx= xxx= Dimensions: 4,3 Selectable: - Bounds: 149, 116, -3, -20 + Bounds: 149, 80, -3, -10 Health: HP: 1000 RevealsShroud: @@ -151,6 +157,8 @@ NAWEAP: Power: Amount: -30 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 149, 116, -3, -20 NAHPAD: Inherits: ^Building @@ -189,8 +197,10 @@ NAHPAD: Power: Amount: -10 Selectable: - Bounds: 78, 54, 0, -8 + Bounds: 78, 48, 0, -6 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 78, 54, 0, -8 NARADR: Inherits: ^Building @@ -209,7 +219,7 @@ NARADR: Footprint: xx xx Dimensions: 2,2 Selectable: - Bounds: 96, 82, 0, -17 + Bounds: 96, 48, 0, -6 Health: HP: 800 Armor: @@ -232,6 +242,8 @@ NARADR: Power: Amount: -50 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 96, 72, 0, -12 NATECH: Inherits: ^Building @@ -250,7 +262,7 @@ NATECH: Footprint: xx xx Dimensions: 2,2 Selectable: - Bounds: 86, 58, 0, -4 + Bounds: 86, 48, 0, -4 Health: HP: 500 Armor: @@ -262,6 +274,8 @@ NATECH: Power: Amount: -150 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 86, 58, 0, -4 NASTLH: Inherits: ^Building @@ -301,4 +315,7 @@ NASTLH: DisableSound: cloak5.aud AffectsParent: true Selectable: - Bounds: 106, 60, 8, -15 + Bounds: 106, 48, 8, -6 + SelectionDecorations: + VisualBounds: 106, 60, 8, -15 + diff --git a/mods/ts/rules/nod-support.yaml b/mods/ts/rules/nod-support.yaml index 3d699dc15f..bbed7dd7af 100644 --- a/mods/ts/rules/nod-support.yaml +++ b/mods/ts/rules/nod-support.yaml @@ -36,7 +36,7 @@ NALASR: BuildPaletteOrder: 50 Building: Selectable: - Bounds: 40, 36, -8, -8 + Bounds: 40, 30, -8, -6 RequiresPower: DisabledOverlay: -GivesBuildableArea: @@ -62,6 +62,8 @@ NALASR: AutoTarget: Power: Amount: -40 + SelectionDecorations: + VisualBounds: 40, 36, -8, -8 NAOBEL: Inherits: ^Building @@ -78,7 +80,7 @@ NAOBEL: Footprint: xx xx Dimensions: 2,2 Selectable: - Bounds: 88, 74, 0, -14 + Bounds: 88, 42, 0, -6 RequiresPower: DisabledOverlay: -GivesBuildableArea: @@ -108,6 +110,8 @@ NAOBEL: Sequence: idle-lights Power: Amount: -150 + SelectionDecorations: + VisualBounds: 88, 72, 0, -12 NASAM: Inherits: ^Building @@ -122,7 +126,7 @@ NASAM: BuildPaletteOrder: 60 Building: Selectable: - Bounds: 40, 36, -3, -8 + Bounds: 40, 30, -3, -8 RequiresPower: DisabledOverlay: -GivesBuildableArea: @@ -150,6 +154,8 @@ NASAM: LocalOffset: 512,0,512 Power: Amount: -30 + SelectionDecorations: + VisualBounds: 40, 36, -3, -8 GATICK: Inherits: ^Building @@ -300,3 +306,6 @@ NAMISL: DisplayRadarPing: True BeaconPoster: CameraActor: camera + SelectionDecorations: + VisualBounds: 75,48 + diff --git a/mods/ts/rules/shared-structures.yaml b/mods/ts/rules/shared-structures.yaml index 4fd803e3d3..18f95a456a 100644 --- a/mods/ts/rules/shared-structures.yaml +++ b/mods/ts/rules/shared-structures.yaml @@ -42,13 +42,15 @@ GACNST: Power: Amount: 0 Selectable: - Bounds: 144, 80, 0, -12 + Bounds: 144, 60, 0, -6 ProvidesPrerequisite@gdi: Race: gdi Prerequisite: structures.gdi ProvidesPrerequisite@nod: Race: nod Prerequisite: structures.nod + SelectionDecorations: + VisualBounds: 144, 80, 0, -12 PROC: Inherits: ^Building @@ -65,7 +67,7 @@ PROC: Footprint: xxx= xx== xxx= Dimensions: 4,3 Selectable: - Bounds: 134, 122, 0, -18 + Bounds: 134, 96, 0, -12 Health: HP: 900 RevealsShroud: @@ -94,6 +96,8 @@ PROC: Power: Amount: -30 ProvidesPrerequisite@buildingname: + SelectionDecorations: + VisualBounds: 134, 122, 0, -18 GASILO: Inherits: ^Building @@ -129,6 +133,8 @@ GASILO: Capacity: 1500 Power: Amount: -10 + SelectionDecorations: + VisualBounds: 80, 48, -5, 0 ANYPOWER: Tooltip: diff --git a/mods/ts/rules/shared-support.yaml b/mods/ts/rules/shared-support.yaml index c6627222f6..f9d8f22241 100644 --- a/mods/ts/rules/shared-support.yaml +++ b/mods/ts/rules/shared-support.yaml @@ -62,3 +62,6 @@ NAPULS: Sequence: turret Power: Amount: -150 + SelectionDecorations: + VisualBounds: 78, 54, 0, -12 + diff --git a/mods/ts/rules/shared-vehicles.yaml b/mods/ts/rules/shared-vehicles.yaml index bdbc0b43a7..2e6be2ea30 100644 --- a/mods/ts/rules/shared-vehicles.yaml +++ b/mods/ts/rules/shared-vehicles.yaml @@ -33,6 +33,8 @@ MCV: RenderSprites: RenderVoxels: WithVoxelBody: + SelectionDecorations: + VisualBounds: 42,42 HARV: Inherits: ^Vehicle @@ -84,6 +86,8 @@ HARV: WithHarvestAnimation: Offset: 384,0,0 Palette: effect + SelectionDecorations: + VisualBounds: 36,36 LPST: Inherits: ^Vehicle From a9477ddc2db0183c3bfebad2ebb874f9b9257233 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 5 Jun 2015 14:49:51 +0200 Subject: [PATCH 07/18] Changed back TD power plant footprints to 2x2 impassable Reason 1: The art doesn't really look like that cell should be passable. Reason 2: This falls within Selectable Bounds and can therefore be exploited to protect turrets and towers, while making it impossible to collect crates or squish infantry on this cell. --- mods/cnc/rules/structures.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index 28bcee7632..d043c3a41e 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -108,7 +108,7 @@ NUKE: Prerequisites: fact Queue: Building.GDI, Building.Nod Building: - Footprint: x_ xx + Footprint: xx xx Dimensions: 2,2 Health: HP: 500 @@ -133,7 +133,7 @@ NUK2: Prerequisites: anyhq, ~techlevel.medium Queue: Building.GDI, Building.Nod Building: - Footprint: x_ xx + Footprint: xx xx Dimensions: 2,2 Health: HP: 700 From 2afa3cfa3aaf53a59ef9871bf67ceec0c1ea133b Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 5 Jun 2015 15:28:30 +0200 Subject: [PATCH 08/18] Slightly changed D2k barracks footprint Makes upper-left barracks cell impassable. It might look passable on Atreides' barracks, but not Harkonnen barracks, for example. --- mods/d2k/rules/structures.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index 8c4ef3d6d3..d4446ec149 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -129,7 +129,7 @@ barracks: Name: Barracks Description: Trains infantry Building: - Footprint: =x xx + Footprint: xx xx Dimensions: 2,2 Bib: Health: From c23ee1be2e58bcc512ceb106d56a619bab48eb33 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 5 Jun 2015 16:36:54 +0200 Subject: [PATCH 09/18] Remove Selectable boolean from Selectable trait Add work-around for ta/td bridge huts since they need actor Bounds to be targetable by C4/engineer repair. --- OpenRA.Game/Graphics/WorldRenderer.cs | 8 ++--- OpenRA.Game/Orders/UnitOrderGenerator.cs | 3 +- OpenRA.Game/Traits/Selectable.cs | 2 +- .../WorldInteractionControllerWidget.cs | 10 ++---- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 1 + .../Traits/CustomSelectionSize.cs | 36 +++++++++++++++++++ .../UtilityCommands/UpgradeRules.cs | 22 ++++++++++++ mods/cnc/maps/nod04b/map.yaml | 3 +- mods/cnc/rules/civilian.yaml | 6 ++-- mods/cnc/rules/defaults.yaml | 5 --- mods/d2k/rules/misc.yaml | 5 --- mods/ra/rules/civilian.yaml | 12 +++---- mods/ra/rules/defaults.yaml | 3 -- mods/ra/rules/misc.yaml | 3 -- mods/ts/rules/defaults.yaml | 5 --- 15 files changed, 73 insertions(+), 51 deletions(-) create mode 100644 OpenRA.Mods.Common/Traits/CustomSelectionSize.cs diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index 4663496448..55d0e0f8af 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -190,12 +190,8 @@ namespace OpenRA.Graphics public void DrawRollover(Actor unit) { - var selectable = unit.TraitOrDefault(); - if (selectable != null) - { - if (selectable.Info.Selectable) - new SelectionBarsRenderable(unit).Render(this); - } + if (unit.HasTrait()) + new SelectionBarsRenderable(unit).Render(this); } public void DrawRangeCircle(WPos pos, WRange range, Color c) diff --git a/OpenRA.Game/Orders/UnitOrderGenerator.cs b/OpenRA.Game/Orders/UnitOrderGenerator.cs index faaee0190d..899d6ba3f3 100644 --- a/OpenRA.Game/Orders/UnitOrderGenerator.cs +++ b/OpenRA.Game/Orders/UnitOrderGenerator.cs @@ -63,8 +63,7 @@ namespace OpenRA.Orders if (underCursor != null && (mi.Modifiers.HasModifier(Modifiers.Shift) || !world.Selection.Actors.Any())) { - var selectable = underCursor.TraitOrDefault(); - if (selectable != null && selectable.Info.Selectable) + if (underCursor.HasTrait()) useSelect = true; } diff --git a/OpenRA.Game/Traits/Selectable.cs b/OpenRA.Game/Traits/Selectable.cs index 6ba7b12f39..fa9fc9be10 100644 --- a/OpenRA.Game/Traits/Selectable.cs +++ b/OpenRA.Game/Traits/Selectable.cs @@ -15,9 +15,9 @@ using OpenRA.Graphics; namespace OpenRA.Traits { + [Desc("This actor is selectable. Defines bounds of selectable area and selection priority.")] public class SelectableInfo : ITraitInfo { - public readonly bool Selectable = true; public readonly int Priority = 10; [Desc("Bounds for the selectable area.")] public readonly int[] Bounds = null; diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index ca07f6d9fb..af381f97e5 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -92,7 +92,7 @@ namespace OpenRA.Widgets { if (!hasBox && World.Selection.Actors.Any() && !multiClick) { - if (!(World.ScreenMap.ActorsAt(xy).Where(x => x.HasTrait() && x.Trait().Info.Selectable && + if (!(World.ScreenMap.ActorsAt(xy).Where(x => x.HasTrait() && (x.Owner.IsAlliedWith(World.RenderPlayer) || !World.FogObscures(x))).Any() && !mi.Modifiers.HasModifier(Modifiers.Ctrl) && !mi.Modifiers.HasModifier(Modifiers.Alt) && UnitOrderGenerator.InputOverridesSelection(World, xy, mi))) { @@ -292,7 +292,7 @@ namespace OpenRA.Widgets var s = a.TraitOrDefault(); // sc == null means that units, that meet all other criteria, get selected - return s != null && s.Info.Selectable && (selectionClasses == null || selectionClasses.Contains(s.Class)); + return s != null && (selectionClasses == null || selectionClasses.Contains(s.Class)); }); } @@ -303,11 +303,7 @@ namespace OpenRA.Widgets a = b; return world.ScreenMap.ActorsInBox(a, b) - .Where(x => - { - var s = x.TraitOrDefault(); - return s != null && s.Info.Selectable && (x.Owner.IsAlliedWith(world.RenderPlayer) || !world.FogObscures(x)); - }) + .Where(x => x.HasTrait() && (x.Owner.IsAlliedWith(world.RenderPlayer) || !world.FogObscures(x))) .GroupBy(x => x.GetSelectionPriority()) .OrderByDescending(g => g.Key) .Select(g => g.AsEnumerable()) diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 447dd44b70..d13f3a14c6 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -310,6 +310,7 @@ + diff --git a/OpenRA.Mods.Common/Traits/CustomSelectionSize.cs b/OpenRA.Mods.Common/Traits/CustomSelectionSize.cs new file mode 100644 index 0000000000..159479d4e2 --- /dev/null +++ b/OpenRA.Mods.Common/Traits/CustomSelectionSize.cs @@ -0,0 +1,36 @@ +#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; +using OpenRA.Traits; + +namespace OpenRA.Mods.Common.Traits +{ + [Desc("Special case trait for invisible, unselectable actors like bridge huts.", + "Gives actor targetable area for special cases like C4 and engineer repair.", + "This trait conflicts with AutoSelectionSize so you cannot use both, and doesn't support custom offsets.")] + public class CustomSelectionSizeInfo : ITraitInfo + { + public readonly int[] CustomBounds = null; + + public object Create(ActorInitializer init) { return new CustomSelectionSize(this); } + } + + public class CustomSelectionSize : IAutoSelectionSize + { + readonly CustomSelectionSizeInfo info; + public CustomSelectionSize(CustomSelectionSizeInfo info) { this.info = info; } + + public int2 SelectionSize(Actor self) + { + return new int2(info.CustomBounds[0], info.CustomBounds[1]); + } + } +} diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 37c63131d0..f88d7db7ab 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -1175,6 +1175,28 @@ namespace OpenRA.Mods.Common.UtilityCommands } } + if (engineVersion < 20150604) + { + if (depth == 1 && node.Value.Nodes.Exists(n => n.Key == "Selectable")) + { + var selectable = node.Value.Nodes.FirstOrDefault(n => n.Key == "Selectable"); + if (node.Key == "Selectable" && selectable.Value.Value == "false") + node.Key = "SelectableRemoveMe"; + + // To cover rare cases where the boolean was 'true' + if (node.Key == "Selectable" && selectable.Value.Value == "true") + node.Value.Nodes.Remove(selectable); + } + + if (depth == 0 && node.Value.Nodes.Exists(n => n.Key == "SelectableRemoveMe")) + node.Value.Nodes.RemoveAll(n => n.Key == "SelectableRemoveMe"); + Console.WriteLine("The 'Selectable' boolean has been removed from the Selectable trait."); + Console.WriteLine("If you just want to disable an inherited Selectable trait, use -Selectable instead."); + Console.WriteLine("For special cases like bridge huts, which need bounds to be targetable by C4 and engineers,"); + Console.WriteLine("give them the CustomSelectionSize trait with CustomBounds."); + Console.WriteLine("See RA and C&C bridge huts for reference."); + } + UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); } } diff --git a/mods/cnc/maps/nod04b/map.yaml b/mods/cnc/maps/nod04b/map.yaml index 1a7af70e06..9565289096 100644 --- a/mods/cnc/maps/nod04b/map.yaml +++ b/mods/cnc/maps/nod04b/map.yaml @@ -545,8 +545,7 @@ Rules: ShowOwnerRow: false TRAN: RejectsOrders: - Selectable: - Selectable: false + -Selectable: RevealsShroud: Range: 5c0 diff --git a/mods/cnc/rules/civilian.yaml b/mods/cnc/rules/civilian.yaml index f08639e6c3..c2097631c5 100644 --- a/mods/cnc/rules/civilian.yaml +++ b/mods/cnc/rules/civilian.yaml @@ -370,10 +370,8 @@ BRIDGEHUT: Building: Footprint: __ __ Dimensions: 2,2 - Selectable: - Selectable: false - Bounds: 48,48 - Priority: 2 + CustomSelectionSize: + CustomBounds: 48,48 BridgeHut: TargetableBuilding: TargetTypes: BridgeHut, C4 diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index 42adf35550..ebf87f6e4d 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -672,9 +672,4 @@ Image: crate WithCrateBody: XmasImages: xcratea, xcrateb, xcratec, xcrated - Selectable: - Selectable: false - Bounds: 15,15,-1,-1 - SelectionDecorations: - VisualBounds: 15,15,-1,-1 diff --git a/mods/d2k/rules/misc.yaml b/mods/d2k/rules/misc.yaml index 19c3c43f02..dd74f52c95 100644 --- a/mods/d2k/rules/misc.yaml +++ b/mods/d2k/rules/misc.yaml @@ -109,12 +109,7 @@ crate: RenderSprites: Palette: effect WithCrateBody: - Selectable: - Selectable: false - Bounds: 15,15,-1,-1 Passenger: - SelectionDecorations: - VisualBounds: 15,15,-1,-1 mpspawn: Immobile: diff --git a/mods/ra/rules/civilian.yaml b/mods/ra/rules/civilian.yaml index 1441215d72..b365048b99 100644 --- a/mods/ra/rules/civilian.yaml +++ b/mods/ra/rules/civilian.yaml @@ -490,10 +490,8 @@ BRIDGEHUT: Building: Footprint: __ __ Dimensions: 2,2 - Selectable: - Selectable: false - Bounds: 48,48 - Priority: 2 + CustomSelectionSize: + CustomBounds: 48,48 BridgeHut: TargetableBuilding: TargetTypes: BridgeHut, C4 @@ -502,10 +500,8 @@ BRIDGEHUT.small: Building: Footprint: _ Dimensions: 1,1 - Selectable: - Selectable: false - Bounds: 24,24 - Priority: 2 + CustomSelectionSize: + CustomBounds: 24,24 BridgeHut: TargetableBuilding: TargetTypes: BridgeHut, C4 diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 07d2512a33..2cf670256c 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -665,9 +665,6 @@ Image: scrate WithCrateBody: XmasImages: xcratea, xcrateb, xcratec, xcrated - Selectable: - Selectable: false - Bounds: 15,15,-1,-1 Parachutable: KilledOnImpassableTerrain: false ParachuteSequence: parach diff --git a/mods/ra/rules/misc.yaml b/mods/ra/rules/misc.yaml index 4496de2172..2328f4441e 100644 --- a/mods/ra/rules/misc.yaml +++ b/mods/ra/rules/misc.yaml @@ -217,9 +217,6 @@ FLARE: Tooltip: Name: Flare ShowOwnerRow: false - Selectable: - Selectable: false - Bounds: 25,25 BodyOrientation: MINE: diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 44e446f955..bf30fd7362 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -136,11 +136,6 @@ Palette: terrain WithCrateBody: Images: crate - Selectable: - Selectable: false - Bounds: 25,25,-1,-1 - SelectionDecorations: - VisualBounds: 25,25,-1,-1 ^Wall: AppearsOnRadar: From 875d8bac06a91f8949c90ac084a3940ca5da0af8 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Mon, 8 Jun 2015 01:08:41 +0200 Subject: [PATCH 10/18] Move debug target path rendering to SelectionDecorations --- OpenRA.Game/Traits/Selectable.cs | 31 ++----------------- .../Traits/SelectionDecorations.cs | 21 ++++++++++++- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/OpenRA.Game/Traits/Selectable.cs b/OpenRA.Game/Traits/Selectable.cs index fa9fc9be10..2141452889 100644 --- a/OpenRA.Game/Traits/Selectable.cs +++ b/OpenRA.Game/Traits/Selectable.cs @@ -9,9 +9,7 @@ #endregion using System.Collections.Generic; -using System.Drawing; using System.Linq; -using OpenRA.Graphics; namespace OpenRA.Traits { @@ -19,6 +17,7 @@ namespace OpenRA.Traits public class SelectableInfo : ITraitInfo { public readonly int Priority = 10; + [Desc("Bounds for the selectable area.")] public readonly int[] Bounds = null; @@ -29,40 +28,16 @@ namespace OpenRA.Traits public object Create(ActorInitializer init) { return new Selectable(init.Self, this); } } - public class Selectable : IPostRenderSelection + public class Selectable { public readonly string Class = null; - public SelectableInfo Info; - readonly Actor self; + public readonly SelectableInfo Info; public Selectable(Actor self, SelectableInfo info) { - this.self = self; Info = info; Class = string.IsNullOrEmpty(info.Class) ? self.Info.Name : info.Class; } - - IEnumerable ActivityTargetPath() - { - if (!self.IsInWorld || self.IsDead) - yield break; - - var activity = self.GetCurrentActivity(); - if (activity != null) - { - var targets = activity.GetTargets(self); - yield return self.CenterPosition; - - foreach (var t in targets.Where(t => t.Type != TargetType.Invalid)) - yield return t.CenterPosition; - } - } - - public IEnumerable RenderAfterWorld(WorldRenderer wr) - { - if (self.World.LocalPlayer != null && self.World.LocalPlayer.PlayerActor.Trait().PathDebug) - yield return new TargetLineRenderable(ActivityTargetPath(), Color.Green); - } } } diff --git a/OpenRA.Mods.Common/Traits/SelectionDecorations.cs b/OpenRA.Mods.Common/Traits/SelectionDecorations.cs index 9d6c1531f4..d23153a9e7 100644 --- a/OpenRA.Mods.Common/Traits/SelectionDecorations.cs +++ b/OpenRA.Mods.Common/Traits/SelectionDecorations.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits static readonly string[] PipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray", "pip-blue", "pip-ammo", "pip-ammoempty" }; static readonly string[] TagStrings = { "", "tag-fake", "tag-primary" }; - public SelectionDecorationsInfo Info; + public readonly SelectionDecorationsInfo Info; readonly Actor self; public ISelectionDecorationsInfo SelectionDecorationsInfo { get { return Info; } } @@ -49,6 +49,22 @@ namespace OpenRA.Mods.Common.Traits Info = info; } + IEnumerable ActivityTargetPath() + { + if (!self.IsInWorld || self.IsDead) + yield break; + + var activity = self.GetCurrentActivity(); + if (activity != null) + { + var targets = activity.GetTargets(self); + yield return self.CenterPosition; + + foreach (var t in targets.Where(t => t.Type != TargetType.Invalid)) + yield return t.CenterPosition; + } + } + public IEnumerable RenderAfterWorld(WorldRenderer wr) { if (!self.Owner.IsAlliedWith(self.World.RenderPlayer) || self.World.FogObscures(self)) @@ -60,6 +76,9 @@ namespace OpenRA.Mods.Common.Traits if (Info.RenderSelectionBars) yield return new SelectionBarsRenderable(self); + if (self.World.LocalPlayer != null && self.World.LocalPlayer.PlayerActor.Trait().PathDebug) + yield return new TargetLineRenderable(ActivityTargetPath(), Color.Green); + var b = self.VisualBounds; var pos = wr.ScreenPxPosition(self.CenterPosition); var tl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Top)); From a1fa43966ba46907f8d78bbc4a87f02711f5b581 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 9 Jun 2015 22:25:05 +0200 Subject: [PATCH 11/18] Newlines to improve readability of SelectionDecorations. --- OpenRA.Mods.Common/Traits/SelectionDecorations.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenRA.Mods.Common/Traits/SelectionDecorations.cs b/OpenRA.Mods.Common/Traits/SelectionDecorations.cs index d23153a9e7..1fac7b8cc5 100644 --- a/OpenRA.Mods.Common/Traits/SelectionDecorations.cs +++ b/OpenRA.Mods.Common/Traits/SelectionDecorations.cs @@ -20,11 +20,15 @@ namespace OpenRA.Mods.Common.Traits public class SelectionDecorationsInfo : ITraitInfo, ISelectionDecorationsInfo { public readonly string Palette = "chrome"; + [Desc("Visual bounds for selection box. If null, it uses AutoSelectionSize.")] public readonly int[] VisualBounds = null; + [Desc("Health bar, production progress bar etc.")] public readonly bool RenderSelectionBars = true; + public readonly bool RenderSelectionBox = true; + public readonly Color SelectionBoxColor = Color.White; public object Create(ActorInitializer init) { return new SelectionDecorations(init.Self, this); } From b6bbd11c838a5406a7a085d2319c60c5fd7a6f9e Mon Sep 17 00:00:00 2001 From: reaperrr Date: Wed, 17 Jun 2015 00:42:26 +0200 Subject: [PATCH 12/18] Fix crate tooltips --- mods/cnc/rules/defaults.yaml | 2 ++ mods/d2k/rules/misc.yaml | 2 ++ mods/ra/rules/defaults.yaml | 2 ++ mods/ts/rules/defaults.yaml | 2 ++ 4 files changed, 8 insertions(+) diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index ebf87f6e4d..0ba840498f 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -672,4 +672,6 @@ Image: crate WithCrateBody: XmasImages: xcratea, xcrateb, xcratec, xcrated + CustomSelectionSize: + CustomBounds: 16,16 diff --git a/mods/d2k/rules/misc.yaml b/mods/d2k/rules/misc.yaml index dd74f52c95..a0b57b81c0 100644 --- a/mods/d2k/rules/misc.yaml +++ b/mods/d2k/rules/misc.yaml @@ -110,6 +110,8 @@ crate: Palette: effect WithCrateBody: Passenger: + CustomSelectionSize: + CustomBounds: 16,16 mpspawn: Immobile: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 2cf670256c..1fdcff33ec 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -669,4 +669,6 @@ KilledOnImpassableTerrain: false ParachuteSequence: parach Passenger: + CustomSelectionSize: + CustomBounds: 16,16 diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index bf30fd7362..205ddccbe4 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -136,6 +136,8 @@ Palette: terrain WithCrateBody: Images: crate + CustomSelectionSize: + CustomBounds: 24,24 ^Wall: AppearsOnRadar: From 29862774909d85ffe688660c8b96b9124177ee29 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Wed, 17 Jun 2015 21:37:24 +0200 Subject: [PATCH 13/18] Improved SelectionDecoration description & removed ISelectionDecoration interface --- OpenRA.Game/Traits/TraitsInterfaces.cs | 5 ----- OpenRA.Mods.Common/Traits/SelectionDecorations.cs | 8 ++++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 5fe2bc9551..c2e7e154df 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -110,11 +110,6 @@ namespace OpenRA.Traits public interface ISeedableResource { void Seed(Actor self); } - public interface ISelectionDecorations - { - ISelectionDecorationsInfo SelectionDecorationsInfo { get; } - } - public interface ISelectionDecorationsInfo { int[] SelectionBoxBounds { get; } diff --git a/OpenRA.Mods.Common/Traits/SelectionDecorations.cs b/OpenRA.Mods.Common/Traits/SelectionDecorations.cs index 1fac7b8cc5..ce4a3dea52 100644 --- a/OpenRA.Mods.Common/Traits/SelectionDecorations.cs +++ b/OpenRA.Mods.Common/Traits/SelectionDecorations.cs @@ -21,7 +21,9 @@ namespace OpenRA.Mods.Common.Traits { public readonly string Palette = "chrome"; - [Desc("Visual bounds for selection box. If null, it uses AutoSelectionSize.")] + [Desc("Visual bounds for selection box. If null, it uses AutoSelectionSize.", + "The first two values define the bounds' size, the optional third and fourth", + "values specify the position relative to the actors' center. Defaults to selectable bounds.")] public readonly int[] VisualBounds = null; [Desc("Health bar, production progress bar etc.")] @@ -36,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits public int[] SelectionBoxBounds { get { return VisualBounds; } } } - public class SelectionDecorations : ISelectionDecorations, IPostRenderSelection + public class SelectionDecorations : IPostRenderSelection { // depends on the order of pips in TraitsInterfaces.cs! static readonly string[] PipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray", "pip-blue", "pip-ammo", "pip-ammoempty" }; @@ -45,8 +47,6 @@ namespace OpenRA.Mods.Common.Traits public readonly SelectionDecorationsInfo Info; readonly Actor self; - public ISelectionDecorationsInfo SelectionDecorationsInfo { get { return Info; } } - public SelectionDecorations(Actor self, SelectionDecorationsInfo info) { this.self = self; From f2d8e32b0182e6ec71f56b0371bca94b7c54a97b Mon Sep 17 00:00:00 2001 From: reaperrr Date: Wed, 17 Jun 2015 21:42:15 +0200 Subject: [PATCH 14/18] Selection box size now defaults to Selectable.Bounds if VisualBounds are null --- OpenRA.Game/Actor.cs | 8 +++++--- mods/cnc/rules/defaults.yaml | 6 ------ mods/d2k/rules/defaults.yaml | 4 ---- mods/ra/rules/defaults.yaml | 1 - mods/ts/rules/defaults.yaml | 2 -- 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index 49d0e23b56..e8d704cf59 100644 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -115,11 +115,13 @@ namespace OpenRA visualBounds = Exts.Lazy(() => { var sd = Info.Traits.GetOrDefault(); - var size = (sd != null && sd.SelectionBoxBounds != null) ? new int2(sd.SelectionBoxBounds[0], sd.SelectionBoxBounds[1]) : - TraitsImplementing().Select(x => x.SelectionSize(this)).FirstOrDefault(); + if (sd == null || sd.SelectionBoxBounds == null) + return bounds.Value; + + var size = new int2(sd.SelectionBoxBounds[0], sd.SelectionBoxBounds[1]); var offset = -size / 2; - if (sd != null && sd.SelectionBoxBounds != null && sd.SelectionBoxBounds.Length > 2) + if (sd.SelectionBoxBounds.Length > 2) offset += new int2(sd.SelectionBoxBounds[2], sd.SelectionBoxBounds[3]); return new Rectangle(offset.X, offset.Y, size.X, size.Y); diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index 0ba840498f..cf5195edfc 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -33,7 +33,6 @@ Beach: 50 ROT: 5 SelectionDecorations: - VisualBounds: 24,24 Selectable: Bounds: 24,24 TargetableUnit: @@ -82,7 +81,6 @@ Beach: 70 ROT: 5 SelectionDecorations: - VisualBounds: 24,24 Selectable: Bounds: 24,24 TargetableUnit: @@ -128,7 +126,6 @@ TargetTypes: Air GroundedTargetTypes: Ground SelectionDecorations: - VisualBounds: 24,24 Selectable: Bounds: 24,24 Helicopter: @@ -183,7 +180,6 @@ PathingCost: 300 Beach: 80 SelectionDecorations: - VisualBounds: 12,17,0,-6 Selectable: Bounds: 12,17,0,-6 TargetableUnit: @@ -305,7 +301,6 @@ BlueTiberium: 70 Beach: 80 SelectionDecorations: - VisualBounds: 24,24 Selectable: Bounds: 24,24 TargetableUnit: @@ -337,7 +332,6 @@ AppearsOnRadar: UseLocation: yes SelectionDecorations: - VisualBounds: 24,24 Selectable: Bounds: 24,24 TargetableUnit: diff --git a/mods/d2k/rules/defaults.yaml b/mods/d2k/rules/defaults.yaml index ef344629ad..f05b780298 100644 --- a/mods/d2k/rules/defaults.yaml +++ b/mods/d2k/rules/defaults.yaml @@ -34,7 +34,6 @@ Dune: 60 ROT: 5 SelectionDecorations: - VisualBounds: 32,32 Selectable: Bounds: 32,32 TargetableUnit: @@ -91,7 +90,6 @@ Dune: 70 ROT: 5 SelectionDecorations: - VisualBounds: 32,32 Selectable: Bounds: 32,32 TargetableUnit: @@ -217,7 +215,6 @@ Dune: 60 Rough: 70 SelectionDecorations: - VisualBounds: 12,18,0,-6 Selectable: Bounds: 12,18,0,-6 TargetableUnit: @@ -275,7 +272,6 @@ AppearsOnRadar: UseLocation: yes SelectionDecorations: - VisualBounds: 32,32 Selectable: Bounds: 32,32 TargetableAircraft: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 1fdcff33ec..9de3e1a045 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -181,7 +181,6 @@ Gems: 80 Beach: 80 SelectionDecorations: - VisualBounds: 12,18,0,-8 Selectable: Bounds: 12,18,0,-8 TargetableUnit: diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 205ddccbe4..0415035970 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -212,7 +212,6 @@ BlueTiberium: 80 SelectionDecorations: Palette: pips - VisualBounds: 14,23,-1,-9 Selectable: Bounds: 14,23,-1,-9 Voiced: @@ -500,7 +499,6 @@ BlueTiberium: 100 SelectionDecorations: Palette: pips - VisualBounds: 26,26,0,-3 Selectable: Bounds: 26,26,0,-3 TargetableUnit: From f5771571c10b56e86fd36ec26a40468804338984 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Wed, 17 Jun 2015 21:44:59 +0200 Subject: [PATCH 15/18] Fix Selectable style nits and description Silence Travis --- OpenRA.Game/Traits/Selectable.cs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/OpenRA.Game/Traits/Selectable.cs b/OpenRA.Game/Traits/Selectable.cs index 2141452889..727515a047 100644 --- a/OpenRA.Game/Traits/Selectable.cs +++ b/OpenRA.Game/Traits/Selectable.cs @@ -8,12 +8,9 @@ */ #endregion -using System.Collections.Generic; -using System.Linq; - namespace OpenRA.Traits { - [Desc("This actor is selectable. Defines bounds of selectable area and selection priority.")] + [Desc("This actor is selectable. Defines bounds of selectable area, selection class and selection priority.")] public class SelectableInfo : ITraitInfo { public readonly int Priority = 10; @@ -32,11 +29,8 @@ namespace OpenRA.Traits { public readonly string Class = null; - public readonly SelectableInfo Info; - public Selectable(Actor self, SelectableInfo info) { - Info = info; Class = string.IsNullOrEmpty(info.Class) ? self.Info.Name : info.Class; } } From 3bcf0aab00ba2e6da2d8872e84a1eab220699114 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Wed, 17 Jun 2015 22:06:08 +0200 Subject: [PATCH 16/18] Move SelectionDecorations to Traits\Render --- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 2 +- OpenRA.Mods.Common/Traits/{ => Render}/SelectionDecorations.cs | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename OpenRA.Mods.Common/Traits/{ => Render}/SelectionDecorations.cs (100%) diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index d13f3a14c6..44e8c69a92 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -440,7 +440,7 @@ - + diff --git a/OpenRA.Mods.Common/Traits/SelectionDecorations.cs b/OpenRA.Mods.Common/Traits/Render/SelectionDecorations.cs similarity index 100% rename from OpenRA.Mods.Common/Traits/SelectionDecorations.cs rename to OpenRA.Mods.Common/Traits/Render/SelectionDecorations.cs From 61ea21005acf7e8d1d98c675320229d85955c56d Mon Sep 17 00:00:00 2001 From: reaperrr Date: Wed, 17 Jun 2015 22:06:36 +0200 Subject: [PATCH 17/18] Update CustomSelectionSize description --- OpenRA.Mods.Common/Traits/CustomSelectionSize.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/CustomSelectionSize.cs b/OpenRA.Mods.Common/Traits/CustomSelectionSize.cs index 159479d4e2..e3eca9e5dd 100644 --- a/OpenRA.Mods.Common/Traits/CustomSelectionSize.cs +++ b/OpenRA.Mods.Common/Traits/CustomSelectionSize.cs @@ -13,9 +13,9 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - [Desc("Special case trait for invisible, unselectable actors like bridge huts.", - "Gives actor targetable area for special cases like C4 and engineer repair.", - "This trait conflicts with AutoSelectionSize so you cannot use both, and doesn't support custom offsets.")] + [Desc("Special case trait for unselectable actors that need to define targetable area bounds", + "for special cases like C4, engineer repair and tooltips.", + "Examples: bridge huts and crates.")] public class CustomSelectionSizeInfo : ITraitInfo { public readonly int[] CustomBounds = null; From 3e57145cfaba00693f45f750b3cb39439c5949c8 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Wed, 17 Jun 2015 22:08:13 +0200 Subject: [PATCH 18/18] Updated upgrade rules Now all they do is remove the Selectable trait when the Selectable boolean is false, and just remove the boolean if it's true. --- .../UtilityCommands/UpgradeRules.cs | 28 ++----------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index f88d7db7ab..ee98153315 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -1152,30 +1152,8 @@ namespace OpenRA.Mods.Common.UtilityCommands } } - if (engineVersion < 20150603) - { - if (depth == 0 && node.Value.Nodes.Exists(n => n.Key == "Selectable")) - { - var selectable = node.Value.Nodes.FirstOrDefault(n => n.Key == "Selectable"); - var selDecor = node.Value.Nodes.FirstOrDefault(n => n.Key == "SelectionDecorations"); - var selectableNodes = selectable.Value.Nodes; - var bounds = selectableNodes.FirstOrDefault(n => n.Key == "Bounds"); - - if (bounds != null) - { - var visualBounds = FieldLoader.GetValue("Bounds", bounds.Value.Value); - if (selDecor != null) - selDecor.Value.Nodes.Add(new MiniYamlNode("VisualBounds", visualBounds.ToString())); - else - node.Value.Nodes.Add(new MiniYamlNode("SelectionDecorations", "", new List - { - new MiniYamlNode("VisualBounds", visualBounds), - })); - } - } - } - - if (engineVersion < 20150604) + // 'Selectable' boolean was removed from selectable trait. + if (engineVersion < 20150619) { if (depth == 1 && node.Value.Nodes.Exists(n => n.Key == "Selectable")) { @@ -1194,7 +1172,7 @@ namespace OpenRA.Mods.Common.UtilityCommands Console.WriteLine("If you just want to disable an inherited Selectable trait, use -Selectable instead."); Console.WriteLine("For special cases like bridge huts, which need bounds to be targetable by C4 and engineers,"); Console.WriteLine("give them the CustomSelectionSize trait with CustomBounds."); - Console.WriteLine("See RA and C&C bridge huts for reference."); + Console.WriteLine("See RA and C&C bridge huts or crates for reference."); } UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);