diff --git a/OpenRA.Mods.Common/Traits/Power/CanPowerDown.cs b/OpenRA.Mods.Common/Traits/Power/CanPowerDown.cs index f52780bd5d..fee4ef87a1 100644 --- a/OpenRA.Mods.Common/Traits/Power/CanPowerDown.cs +++ b/OpenRA.Mods.Common/Traits/Power/CanPowerDown.cs @@ -20,9 +20,15 @@ namespace OpenRA.Mods.Common.Traits public readonly bool CancelWhenDisabled = false; public readonly string IndicatorImage = "poweroff"; - public readonly string IndicatorSequence = "offline"; + [SequenceReference("IndicatorImage")] public readonly string IndicatorSequence = "offline"; - public readonly string IndicatorPalette = "chrome"; + [PaletteReference] public readonly string IndicatorPalette = "chrome"; + + public readonly string PowerupSound = null; + public readonly string PowerdownSound = null; + + public readonly string PowerupSpeech = null; + public readonly string PowerdownSpeech = null; public override object Create(ActorInitializer init) { return new CanPowerDown(init.Self, this); } } @@ -45,7 +51,19 @@ namespace OpenRA.Mods.Common.Traits if (!IsTraitDisabled && order.OrderString == "PowerDown") { disabled = !disabled; - Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", disabled ? "EnablePower" : "DisablePower", self.Owner.Faction.InternalName); + + if (Info.PowerupSound != null && disabled) + Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", Info.PowerupSound, self.Owner.Faction.InternalName); + + if (Info.PowerdownSound != null && !disabled) + Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", Info.PowerdownSound, self.Owner.Faction.InternalName); + + if (Info.PowerupSpeech != null && disabled) + Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.PowerupSpeech, self.Owner.Faction.InternalName); + + if (Info.PowerdownSpeech != null && !disabled) + Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.PowerdownSpeech, self.Owner.Faction.InternalName); + power.UpdateActor(self); if (disabled) @@ -68,7 +86,13 @@ namespace OpenRA.Mods.Common.Traits if (!disabled || !Info.CancelWhenDisabled) return; disabled = false; - Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "EnablePower", self.Owner.Faction.InternalName); + + if (Info.PowerupSound != null) + Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sound", Info.PowerupSound, self.Owner.Faction.InternalName); + + if (Info.PowerupSpeech != null) + Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.PowerupSpeech, self.Owner.Faction.InternalName); + power.UpdateActor(self); } } diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index f4f17ad671..9bed45effe 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -460,6 +460,8 @@ HQ: Bounds: 48,36,0,12 RequiresPower: CanPowerDown: + PowerupSound: EnablePower + PowerdownSound: DisablePower DisabledOverlay: WithSpriteBody: PauseAnimationWhenDisabled: true @@ -547,6 +549,8 @@ EYE: Bounds: 48,36,0,12 RequiresPower: CanPowerDown: + PowerupSound: EnablePower + PowerdownSound: DisablePower DisabledOverlay: WithSpriteBody: PauseAnimationWhenDisabled: true @@ -598,6 +602,8 @@ TMPL: Bounds: 72,48,0,16 RequiresPower: CanPowerDown: + PowerupSound: EnablePower + PowerdownSound: DisablePower DisabledOverlay: Health: HP: 2000 diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index fd6b207857..dc37d9ae9a 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -476,6 +476,8 @@ outpost: Inherits: ^Building RequiresPower: CanPowerDown: + PowerupSound: EnablePower + PowerdownSound: DisablePower DisabledOverlay: Buildable: Prerequisites: construction_yard, barracks, ~techlevel.medium @@ -560,6 +562,8 @@ starport: PrimaryBuilding: RequiresPower: CanPowerDown: + PowerupSound: EnablePower + PowerdownSound: DisablePower DisabledOverlay: ProvidesPrerequisite@atreides: Prerequisite: starport.atreides @@ -712,6 +716,8 @@ large_gun_turret: InitialFacing: 128 RequiresPower: CanPowerDown: + PowerupSound: EnablePower + PowerdownSound: DisablePower DisabledOverlay: Power: Amount: -60 @@ -963,6 +969,8 @@ palace: Production: Produces: Palace CanPowerDown: + PowerupSound: EnablePower + PowerdownSound: DisablePower DisabledOverlay: RequiresPower: SupportPowerChargeBar: diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 4f0210afb7..88e52554ee 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -40,6 +40,8 @@ MSLO: CameraActor: camera FlashType: Nuke CanPowerDown: + PowerupSound: EnablePower + PowerdownSound: DisablePower RequiresPower: DisabledOverlay: SupportPowerChargeBar: @@ -290,6 +292,8 @@ IRON: Dimensions: 2,1 RequiresPower: CanPowerDown: + PowerupSound: EnablePower + PowerdownSound: DisablePower DisabledOverlay: Selectable: Bounds: 48,28,0,2 @@ -338,6 +342,8 @@ PDOX: Dimensions: 2,2 RequiresPower: CanPowerDown: + PowerupSound: EnablePower + PowerdownSound: DisablePower DisabledOverlay: Health: HP: 1000 @@ -410,6 +416,8 @@ TSLA: SelectionDecorations: VisualBounds: 24,36,0,4 CanPowerDown: + PowerupSound: EnablePower + PowerdownSound: DisablePower DisabledOverlay: Health: HP: 400 @@ -455,6 +463,8 @@ AGUN: VisualBounds: 24,36,0,12 RequiresPower: CanPowerDown: + PowerupSound: EnablePower + PowerdownSound: DisablePower DisabledOverlay: Health: HP: 400 @@ -502,6 +512,8 @@ DOME: TargetTypes: Ground, Structure, C4, DetonateAttack, SpyInfiltrate RequiresPower: CanPowerDown: + PowerupSound: EnablePower + PowerdownSound: DisablePower DisabledOverlay: Health: HP: 1000 diff --git a/mods/ts/audio/sounds-generic.yaml b/mods/ts/audio/sounds-generic.yaml index 5fd72ea71c..2fe2c32857 100644 --- a/mods/ts/audio/sounds-generic.yaml +++ b/mods/ts/audio/sounds-generic.yaml @@ -13,8 +13,6 @@ Sounds: ChatLine: message1 ClickDisabledSound: wrong1 ClickSound: clicky1 - DisablePower: 00-i232 - EnablePower: 00-i230 GameForming: gamefrm1 Gdiclose: gdiclose Gdiopen: gdiopen diff --git a/mods/ts/audio/speech-generic.yaml b/mods/ts/audio/speech-generic.yaml index 31141f94f7..9346869516 100644 --- a/mods/ts/audio/speech-generic.yaml +++ b/mods/ts/audio/speech-generic.yaml @@ -25,6 +25,8 @@ Speech: ConstructionComplete: 00-i018 CriticalStructureLost: 00-i196 CriticalUnitLost: 00-i194 + DisablePower: 00-i232 + EnablePower: 00-i230 EmPulseCannonReady: 00-i158 EstablishingBattleControlStandBy: 01-n006 FireStormDefenseOffline: 00-i170 diff --git a/mods/ts/rules/gdi-structures.yaml b/mods/ts/rules/gdi-structures.yaml index dff7090b89..9881b8c4d5 100644 --- a/mods/ts/rules/gdi-structures.yaml +++ b/mods/ts/rules/gdi-structures.yaml @@ -305,6 +305,8 @@ GARADR: RequiresPower: CanPowerDown: IndicatorPalette: mouse + PowerupSpeech: EnablePower + PowerdownSpeech: DisablePower ProvidesRadar: InfiltrateForExploration: DetectCloaked: @@ -374,6 +376,8 @@ GAPLUG: RequiresPower: CanPowerDown: IndicatorPalette: mouse + PowerupSpeech: EnablePower + PowerdownSpeech: DisablePower DisabledOverlay: WithIdleOverlay@DISH: Sequence: idle-dish diff --git a/mods/ts/rules/gdi-support.yaml b/mods/ts/rules/gdi-support.yaml index da1d68de25..92cae3b829 100644 --- a/mods/ts/rules/gdi-support.yaml +++ b/mods/ts/rules/gdi-support.yaml @@ -62,6 +62,8 @@ GACTWR: UpgradeMinEnabledLevel: 1 CanPowerDown: IndicatorPalette: mouse + PowerupSpeech: EnablePower + PowerdownSpeech: DisablePower WithSpriteTurret@VULC: UpgradeTypes: tower.vulcan UpgradeMinEnabledLevel: 1 diff --git a/mods/ts/rules/nod-structures.yaml b/mods/ts/rules/nod-structures.yaml index ad23525a1a..39ef10fc5b 100644 --- a/mods/ts/rules/nod-structures.yaml +++ b/mods/ts/rules/nod-structures.yaml @@ -260,6 +260,8 @@ NARADR: RequiresPower: CanPowerDown: IndicatorPalette: mouse + PowerupSpeech: EnablePower + PowerdownSpeech: DisablePower ProvidesRadar: InfiltrateForExploration: DetectCloaked: @@ -379,6 +381,8 @@ NASTLH: Amount: -350 RequiresPower: CanPowerDown: + PowerupSpeech: EnablePower + PowerdownSpeech: DisablePower IndicatorPalette: mouse UpgradeActorsNear: Upgrades: cloakgenerator diff --git a/mods/ts/rules/nod-support.yaml b/mods/ts/rules/nod-support.yaml index 5d2b9f0d5f..60987f03ed 100644 --- a/mods/ts/rules/nod-support.yaml +++ b/mods/ts/rules/nod-support.yaml @@ -253,6 +253,8 @@ NAMISL: Amount: -50 CanPowerDown: IndicatorPalette: mouse + PowerupSpeech: EnablePower + PowerdownSpeech: DisablePower RequiresPower: DisabledOverlay: ProvidesPrerequisite@buildingname: