From 770efd710bc6664d5f06d761ea5b865a8c1b57b1 Mon Sep 17 00:00:00 2001 From: atlimit8 Date: Sat, 11 Mar 2017 09:08:21 -0600 Subject: [PATCH] Remove DisabledOverlay using WithColoredOverlay & remove IDisable from Husk --- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 1 - OpenRA.Mods.Common/Traits/Husk.cs | 7 +-- .../Traits/Modifiers/DisabledOverlay.cs | 44 ------------------- mods/cnc/rules/defaults.yaml | 10 ++++- mods/cnc/rules/structures.yaml | 16 +++---- mods/d2k/rules/defaults.yaml | 10 ++++- mods/d2k/rules/structures.yaml | 10 ++--- mods/ra/rules/defaults.yaml | 10 ++++- mods/ra/rules/fakes.yaml | 8 ++-- mods/ra/rules/structures.yaml | 22 +++++----- mods/ts/rules/defaults.yaml | 7 +++ mods/ts/rules/gdi-structures.yaml | 4 +- mods/ts/rules/gdi-support.yaml | 2 +- mods/ts/rules/nod-structures.yaml | 4 +- mods/ts/rules/nod-support.yaml | 8 ++-- mods/ts/rules/shared-support.yaml | 2 +- 16 files changed, 70 insertions(+), 95 deletions(-) delete mode 100644 OpenRA.Mods.Common/Traits/Modifiers/DisabledOverlay.cs diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index ce4c980fff..802806a1f9 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -349,7 +349,6 @@ - diff --git a/OpenRA.Mods.Common/Traits/Husk.cs b/OpenRA.Mods.Common/Traits/Husk.cs index 6c6d2276ba..e0ac3912e3 100644 --- a/OpenRA.Mods.Common/Traits/Husk.cs +++ b/OpenRA.Mods.Common/Traits/Husk.cs @@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits bool IOccupySpaceInfo.SharesCell { get { return false; } } } - public class Husk : IPositionable, IFacing, ISync, INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld, IDisable, IDeathActorInitModifier + public class Husk : IPositionable, IFacing, ISync, INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld, IDeathActorInitModifier { readonly HuskInfo info; readonly Actor self; @@ -120,11 +120,6 @@ namespace OpenRA.Mods.Common.Traits self.World.RemoveFromMaps(self, this); } - public bool Disabled - { - get { return true; } - } - public void ModifyDeathActorInit(Actor self, TypeDictionary init) { init.Add(new FacingInit(Facing)); diff --git a/OpenRA.Mods.Common/Traits/Modifiers/DisabledOverlay.cs b/OpenRA.Mods.Common/Traits/Modifiers/DisabledOverlay.cs deleted file mode 100644 index 5ea9101131..0000000000 --- a/OpenRA.Mods.Common/Traits/Modifiers/DisabledOverlay.cs +++ /dev/null @@ -1,44 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2017 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, either version 3 of - * the License, or (at your option) any later version. For more - * information, see COPYING. - */ -#endregion - -using System.Collections.Generic; -using OpenRA.Graphics; -using OpenRA.Traits; - -namespace OpenRA.Mods.Common.Traits -{ - [Desc("Use together with CanPowerDown/RequiresPower on buildings or Husk for vehicles.")] - public class DisabledOverlayInfo : TraitInfo { } - - public class DisabledOverlay : IRenderModifier - { - public IEnumerable ModifyRender(Actor self, WorldRenderer wr, IEnumerable r) - { - if (!self.IsDisabled()) - return r; - - return ModifiedRender(self, wr, r); - } - - IEnumerable ModifiedRender(Actor self, WorldRenderer wr, IEnumerable r) - { - foreach (var a in r) - { - yield return a; - - if (!a.IsDecoration) - yield return a.WithPalette(wr.Palette("disabled")) - .WithZOffset(a.ZOffset + 1) - .AsDecoration(); - } - } - } -} \ No newline at end of file diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index 1c53911fae..a83c24fdd1 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -830,7 +830,8 @@ ForceHealthPercentage: 25 Tooltip: GenericName: Destroyed Vehicle - DisabledOverlay: + WithColoredOverlay@IDISABLE: + Palette: disabled ScriptTriggers: Explodes: Weapon: UnitExplodeSmall @@ -892,3 +893,10 @@ -GivesBuildableArea: MustBeDestroyed: RequiredForShortGame: false + +^DisabledOverlay: + WithColoredOverlay@IDISABLE: + RequiresCondition: disabled + Palette: disabled + GrantConditionOnDisabled@IDISABLE: + Condition: disabled diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index a49673b64e..fd536ac1bf 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -441,6 +441,7 @@ HPAD: HQ: Inherits: ^BaseBuilding + Inherits@IDISABLE: ^DisabledOverlay Valued: Cost: 1000 Tooltip: @@ -463,7 +464,6 @@ HQ: CanPowerDown: PowerupSound: EnablePower PowerdownSound: DisablePower - DisabledOverlay: WithSpriteBody: PauseAnimationWhenDisabled: true Health: @@ -500,8 +500,6 @@ HQ: SupportPowerChargeBar: Power: Amount: -50 - GrantConditionOnDisabled@IDISABLE: - Condition: disabled FIX: Inherits: ^BaseBuilding @@ -539,6 +537,7 @@ FIX: EYE: Inherits: ^BaseBuilding + Inherits@IDISABLE: ^DisabledOverlay Valued: Cost: 1800 Tooltip: @@ -561,7 +560,6 @@ EYE: CanPowerDown: PowerupSound: EnablePower PowerdownSound: DisablePower - DisabledOverlay: WithSpriteBody: PauseAnimationWhenDisabled: true Health: @@ -592,11 +590,10 @@ EYE: Power: Amount: -200 ProvidesPrerequisite@buildingname: - GrantConditionOnDisabled@IDISABLE: - Condition: disabled TMPL: Inherits: ^BaseBuilding + Inherits@IDISABLE: ^DisabledOverlay Valued: Cost: 2000 Tooltip: @@ -619,7 +616,6 @@ TMPL: CanPowerDown: PowerupSound: EnablePower PowerdownSound: DisablePower - DisabledOverlay: Health: HP: 2100 RevealsShroud: @@ -697,6 +693,7 @@ GUN: SAM: Inherits: ^Defense + Inherits@IDISABLE: ^DisabledOverlay Valued: Cost: 650 Tooltip: @@ -712,7 +709,6 @@ SAM: Footprint: xx Dimensions: 2,1 RequiresPower: - DisabledOverlay: Health: HP: 400 Armor: @@ -739,6 +735,7 @@ SAM: OBLI: Inherits: ^Defense + Inherits@IDISABLE: ^DisabledOverlay Valued: Cost: 1500 Tooltip: @@ -755,7 +752,6 @@ OBLI: SelectionDecorations: VisualBounds: 22,44,0,-10 RequiresPower: - DisabledOverlay: Health: HP: 600 Armor: @@ -818,6 +814,7 @@ GTWR: ATWR: Inherits: ^Defense + Inherits@IDISABLE: ^DisabledOverlay Valued: Cost: 1000 Tooltip: @@ -834,7 +831,6 @@ ATWR: SelectionDecorations: VisualBounds: 22,48,0,-12 RequiresPower: - DisabledOverlay: Health: HP: 550 Armor: diff --git a/mods/d2k/rules/defaults.yaml b/mods/d2k/rules/defaults.yaml index 045f6d0740..15bbb25084 100644 --- a/mods/d2k/rules/defaults.yaml +++ b/mods/d2k/rules/defaults.yaml @@ -199,7 +199,8 @@ Targetable: TargetTypes: Ground, Vehicle RequiresForceFire: true - DisabledOverlay: + WithColoredOverlay@IDISABLE: + Palette: disabled Explodes: Weapon: UnitExplodeMed EmptyWeapon: UnitExplodeMed @@ -394,3 +395,10 @@ MustBeDestroyed: RequiredForShortGame: false RevealOnFire: + +^DisabledOverlay: + WithColoredOverlay@IDISABLE: + RequiresCondition: disabled + Palette: disabled + GrantConditionOnDisabled@IDISABLE: + Condition: disabled diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index b44fea62c7..163a28219b 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -486,11 +486,11 @@ heavy_factory: outpost: Inherits: ^Building + Inherits@IDISABLE: ^DisabledOverlay RequiresPower: CanPowerDown: PowerupSound: EnablePower PowerdownSound: DisablePower - DisabledOverlay: Buildable: Prerequisites: barracks, ~techlevel.medium Queue: Building @@ -533,11 +533,10 @@ outpost: Power: Amount: -125 ProvidesPrerequisite@buildingname: - GrantConditionOnDisabled@IDISABLE: - Condition: disabled starport: Inherits: ^Building + Inherits@IDISABLE: ^DisabledOverlay Tooltip: Name: Starport Buildable: @@ -583,7 +582,6 @@ starport: ProductionBar: PrimaryBuilding: PrimaryCondition: primary - DisabledOverlay: ProvidesPrerequisite@atreides: Prerequisite: starport.atreides Factions: atreides @@ -702,6 +700,7 @@ medium_gun_turret: large_gun_turret: Inherits: ^Defense + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Building Prerequisites: outpost, upgrade.conyard, ~techlevel.medium @@ -739,7 +738,6 @@ large_gun_turret: CanPowerDown: PowerupSound: EnablePower PowerdownSound: DisablePower - DisabledOverlay: Power: Amount: -60 SelectionDecorations: @@ -905,6 +903,7 @@ research_centre: palace: Inherits: ^Building + Inherits@IDISABLE: ^DisabledOverlay Buildable: Prerequisites: research_centre, ~techlevel.high Queue: Building @@ -1002,7 +1001,6 @@ palace: CanPowerDown: PowerupSound: EnablePower PowerdownSound: DisablePower - DisabledOverlay: RequiresPower: SupportPowerChargeBar: ProvidesPrerequisite@buildingname: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index d10e940a71..bede68cdd8 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -786,7 +786,8 @@ CaptureThreshold: 100 TransformOnCapture: ForceHealthPercentage: 25 - DisabledOverlay: + WithColoredOverlay@IDISABLE: + Palette: disabled Targetable: TargetTypes: Ground, Husk RequiresForceFire: true @@ -925,3 +926,10 @@ TargetTypes: Ground Immobile: OccupiesSpace: true + +^DisabledOverlay: + WithColoredOverlay@IDISABLE: + RequiresCondition: disabled + Palette: disabled + GrantConditionOnDisabled@IDISABLE: + Condition: disabled diff --git a/mods/ra/rules/fakes.yaml b/mods/ra/rules/fakes.yaml index 825a21de0d..1d5b0a3fbe 100644 --- a/mods/ra/rules/fakes.yaml +++ b/mods/ra/rules/fakes.yaml @@ -120,6 +120,7 @@ WEAF: DOMF: Inherits: ^FakeBuilding + Inherits@IDISABLE: ^DisabledOverlay Inherits@infiltrate: ^InfiltratableFake Tooltip: Name: Fake Radar Dome @@ -145,7 +146,6 @@ DOMF: Armor: Type: Wood RequiresPower: - DisabledOverlay: FIXF: Inherits: ^FakeBuilding @@ -207,6 +207,7 @@ FAPW: ATEF: Inherits: ^FakeBuilding + Inherits@IDISABLE: ^DisabledOverlay Tooltip: Name: Fake Allied Tech Center GenericName: Allied Tech Center @@ -231,10 +232,10 @@ ATEF: Armor: Type: Wood RequiresPower: - DisabledOverlay: PDOF: Inherits: ^FakeBuilding + Inherits@IDISABLE: ^DisabledOverlay Tooltip: Name: Fake Chronosphere GenericName: Chronosphere @@ -263,10 +264,10 @@ PDOF: Explodes: DamageThreshold: 50 RequiresPower: - DisabledOverlay: MSLF: Inherits: ^FakeBuilding + Inherits@IDISABLE: ^DisabledOverlay Tooltip: Name: Fake Missile Silo GenericName: Missile Silo @@ -293,7 +294,6 @@ MSLF: Explodes: DamageThreshold: 50 RequiresPower: - DisabledOverlay: FACF: Inherits: ^FakeBuilding diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 8fc688e0ca..4908d2cb41 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -1,5 +1,6 @@ MSLO: Inherits: ^ScienceBuilding + Inherits@IDISABLE: ^DisabledOverlay Valued: Cost: 2500 Tooltip: @@ -45,7 +46,6 @@ MSLO: PowerupSound: EnablePower PowerdownSound: DisablePower RequiresPower: - DisabledOverlay: SupportPowerChargeBar: Power: Amount: -150 @@ -54,6 +54,7 @@ MSLO: GAP: Inherits: ^ScienceBuilding + Inherits@IDISABLE: ^DisabledOverlay Valued: Cost: 800 Tooltip: @@ -71,7 +72,6 @@ GAP: CanPowerDown: PowerupSound: EnablePower PowerdownSound: DisablePower - DisabledOverlay: WithSpriteBody: PauseAnimationWhenDisabled: true Health: @@ -284,6 +284,7 @@ SYRD: IRON: Inherits: ^ScienceBuilding + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Defense BuildPaletteOrder: 130 @@ -301,7 +302,6 @@ IRON: CanPowerDown: PowerupSound: EnablePower PowerdownSound: DisablePower - DisabledOverlay: Selectable: Bounds: 48,28,0,2 SelectionDecorations: @@ -338,6 +338,7 @@ IRON: PDOX: Inherits: ^ScienceBuilding + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Defense BuildPaletteOrder: 120 @@ -355,7 +356,6 @@ PDOX: CanPowerDown: PowerupSound: EnablePower PowerdownSound: DisablePower - DisabledOverlay: Health: HP: 1000 Armor: @@ -412,6 +412,7 @@ PDOX: TSLA: Inherits: ^Defense + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Defense BuildPaletteOrder: 80 @@ -429,7 +430,6 @@ TSLA: CanPowerDown: PowerupSound: EnablePower PowerdownSound: DisablePower - DisabledOverlay: Health: HP: 400 Armor: @@ -457,6 +457,7 @@ TSLA: AGUN: Inherits: ^Defense + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Defense BuildPaletteOrder: 90 @@ -474,7 +475,6 @@ AGUN: CanPowerDown: PowerupSound: EnablePower PowerdownSound: DisablePower - DisabledOverlay: Health: HP: 400 Armor: @@ -508,6 +508,7 @@ AGUN: DOME: Inherits: ^Building + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Building BuildPaletteOrder: 90 @@ -526,7 +527,6 @@ DOME: CanPowerDown: PowerupSound: EnablePower PowerdownSound: DisablePower - DisabledOverlay: Health: HP: 1000 Armor: @@ -739,6 +739,7 @@ FTUR: SAM: Inherits: ^Defense + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Defense BuildPaletteOrder: 100 @@ -755,7 +756,6 @@ SAM: CanPowerDown: PowerupSound: EnablePower PowerdownSound: DisablePower - DisabledOverlay: Health: HP: 400 Armor: @@ -785,6 +785,7 @@ SAM: ATEK: Inherits: ^ScienceBuilding + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Building BuildPaletteOrder: 140 @@ -820,7 +821,6 @@ ATEK: DisplayTimerStances: Ally, Neutral, Enemy SupportPowerChargeBar: RequiresPower: - DisabledOverlay: Power: Amount: -200 ProvidesPrerequisite@buildingname: @@ -1303,6 +1303,7 @@ AFLD: POWR: Inherits: ^Building + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Building BuildPaletteOrder: 10 @@ -1331,13 +1332,13 @@ POWR: Targetable: TargetTypes: Ground, Structure, C4, DetonateAttack, SpyInfiltrate ScalePowerWithHealth: - DisabledOverlay: WithDeathAnimation: DeathSequence: dead UseDeathTypeSuffix: false APWR: Inherits: ^Building + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Building BuildPaletteOrder: 110 @@ -1370,7 +1371,6 @@ APWR: Targetable: TargetTypes: Ground, Structure, C4, DetonateAttack, SpyInfiltrate ScalePowerWithHealth: - DisabledOverlay: WithDeathAnimation: DeathSequence: dead UseDeathTypeSuffix: false diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 635212b4bb..02422a42fb 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -947,3 +947,10 @@ StartDelay: -1 SpawnAtLastPosition: false RequiresCondition: !inside-tunnel + +^DisabledOverlay: + WithColoredOverlay@IDISABLE: + RequiresCondition: disabled + Palette: disabled + GrantConditionOnDisabled@IDISABLE: + Condition: disabled diff --git a/mods/ts/rules/gdi-structures.yaml b/mods/ts/rules/gdi-structures.yaml index c7e5ba8bf4..aae21a2731 100644 --- a/mods/ts/rules/gdi-structures.yaml +++ b/mods/ts/rules/gdi-structures.yaml @@ -1,5 +1,6 @@ GAPOWR: Inherits: ^Building + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Building BuildPaletteOrder: 10 @@ -35,7 +36,6 @@ GAPOWR: Targetable: TargetTypes: Ground, C4, DetonateAttack, SpyInfiltrate ScalePowerWithHealth: - DisabledOverlay: Pluggable@pluga: Offset: 0,1 Conditions: @@ -370,6 +370,7 @@ GATECH: GAPLUG: Inherits: ^Building + Inherits@IDISABLE: ^DisabledOverlay Valued: Cost: 1000 Tooltip: @@ -389,7 +390,6 @@ GAPLUG: IndicatorPalette: mouse PowerupSpeech: EnablePower PowerdownSpeech: DisablePower - DisabledOverlay: WithIdleOverlay@DISH: Sequence: idle-dish WithIdleOverlay@LIGHTS: diff --git a/mods/ts/rules/gdi-support.yaml b/mods/ts/rules/gdi-support.yaml index 8f186dfcb1..ba48c4a6ec 100644 --- a/mods/ts/rules/gdi-support.yaml +++ b/mods/ts/rules/gdi-support.yaml @@ -43,6 +43,7 @@ GAGATE_B: GACTWR: Inherits: ^Defense + Inherits@IDISABLE: ^DisabledOverlay -WithSpriteBody: WithWallSpriteBody: Type: wall @@ -58,7 +59,6 @@ GACTWR: Building: Selectable: Bounds: 48, 36, 0, -6 - DisabledOverlay: Health: HP: 500 Armor: diff --git a/mods/ts/rules/nod-structures.yaml b/mods/ts/rules/nod-structures.yaml index 3062ce436a..510f300875 100644 --- a/mods/ts/rules/nod-structures.yaml +++ b/mods/ts/rules/nod-structures.yaml @@ -1,5 +1,6 @@ NAPOWR: Inherits: ^Building + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Building BuildPaletteOrder: 20 @@ -33,12 +34,12 @@ NAPOWR: TargetTypes: Ground, C4, DetonateAttack, SpyInfiltrate ScalePowerWithHealth: PowerTooltip: - DisabledOverlay: SelectionDecorations: VisualBounds: 88, 80, 2, -12 NAAPWR: Inherits: ^Building + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Building BuildPaletteOrder: 120 @@ -71,7 +72,6 @@ NAAPWR: Targetable: TargetTypes: Ground, C4, DetonateAttack, SpyInfiltrate ScalePowerWithHealth: - DisabledOverlay: PowerTooltip: SelectionDecorations: VisualBounds: 100, 74, 0, -12 diff --git a/mods/ts/rules/nod-support.yaml b/mods/ts/rules/nod-support.yaml index 1911230584..978f93a048 100644 --- a/mods/ts/rules/nod-support.yaml +++ b/mods/ts/rules/nod-support.yaml @@ -148,6 +148,7 @@ NAFNCE: NALASR: Inherits: ^Defense + Inherits@IDISABLE: ^DisabledOverlay Valued: Cost: 300 Tooltip: @@ -160,7 +161,6 @@ NALASR: Building: Selectable: Bounds: 40, 30, -8, -6 - DisabledOverlay: Health: HP: 500 Armor: @@ -188,6 +188,7 @@ NALASR: NAOBEL: Inherits: ^Defense + Inherits@IDISABLE: ^DisabledOverlay Valued: Cost: 1500 Tooltip: @@ -203,7 +204,6 @@ NAOBEL: Selectable: Bounds: 88, 42, 0, -6 RequiresPower: - DisabledOverlay: Health: HP: 725 Armor: @@ -232,6 +232,7 @@ NAOBEL: NASAM: Inherits: ^Defense + Inherits@IDISABLE: ^DisabledOverlay Valued: Cost: 500 Tooltip: @@ -244,7 +245,6 @@ NASAM: Selectable: Bounds: 40, 30, -3, -8 RequiresPower: - DisabledOverlay: Health: HP: 600 Armor: @@ -314,6 +314,7 @@ NASTLH: NAMISL: Inherits: ^Building + Inherits@IDISABLE: ^DisabledOverlay Buildable: Queue: Defense BuildPaletteOrder: 180 @@ -346,7 +347,6 @@ NAMISL: PowerupSpeech: EnablePower PowerdownSpeech: DisablePower RequiresPower: - DisabledOverlay: ProvidesPrerequisite@buildingname: SupportPowerChargeBar: NukePower: diff --git a/mods/ts/rules/shared-support.yaml b/mods/ts/rules/shared-support.yaml index c652af6df8..5b6eb687ea 100644 --- a/mods/ts/rules/shared-support.yaml +++ b/mods/ts/rules/shared-support.yaml @@ -1,5 +1,6 @@ NAPULS: Inherits: ^Defense + Inherits@IDISABLE: ^DisabledOverlay Valued: Cost: 1000 Tooltip: @@ -15,7 +16,6 @@ NAPULS: Selectable: Bounds: 78, 54, 0, -12 RequiresPower: - DisabledOverlay: Health: HP: 500 Armor: