Merge pull request #9605 from Mailaender/nod-poweroffline

Added support for speech variants to CanPowerDown
This commit is contained in:
reaperrr
2015-12-27 20:10:27 +01:00
10 changed files with 68 additions and 6 deletions

View File

@@ -20,9 +20,15 @@ namespace OpenRA.Mods.Common.Traits
public readonly bool CancelWhenDisabled = false; public readonly bool CancelWhenDisabled = false;
public readonly string IndicatorImage = "poweroff"; 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); } 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") if (!IsTraitDisabled && order.OrderString == "PowerDown")
{ {
disabled = !disabled; 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); power.UpdateActor(self);
if (disabled) if (disabled)
@@ -68,7 +86,13 @@ namespace OpenRA.Mods.Common.Traits
if (!disabled || !Info.CancelWhenDisabled) if (!disabled || !Info.CancelWhenDisabled)
return; return;
disabled = false; 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); power.UpdateActor(self);
} }
} }

View File

@@ -460,6 +460,8 @@ HQ:
Bounds: 48,36,0,12 Bounds: 48,36,0,12
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay: DisabledOverlay:
WithSpriteBody: WithSpriteBody:
PauseAnimationWhenDisabled: true PauseAnimationWhenDisabled: true
@@ -547,6 +549,8 @@ EYE:
Bounds: 48,36,0,12 Bounds: 48,36,0,12
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay: DisabledOverlay:
WithSpriteBody: WithSpriteBody:
PauseAnimationWhenDisabled: true PauseAnimationWhenDisabled: true
@@ -598,6 +602,8 @@ TMPL:
Bounds: 72,48,0,16 Bounds: 72,48,0,16
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay: DisabledOverlay:
Health: Health:
HP: 2000 HP: 2000

View File

@@ -476,6 +476,8 @@ outpost:
Inherits: ^Building Inherits: ^Building
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay: DisabledOverlay:
Buildable: Buildable:
Prerequisites: construction_yard, barracks, ~techlevel.medium Prerequisites: construction_yard, barracks, ~techlevel.medium
@@ -560,6 +562,8 @@ starport:
PrimaryBuilding: PrimaryBuilding:
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay: DisabledOverlay:
ProvidesPrerequisite@atreides: ProvidesPrerequisite@atreides:
Prerequisite: starport.atreides Prerequisite: starport.atreides
@@ -712,6 +716,8 @@ large_gun_turret:
InitialFacing: 128 InitialFacing: 128
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay: DisabledOverlay:
Power: Power:
Amount: -60 Amount: -60
@@ -963,6 +969,8 @@ palace:
Production: Production:
Produces: Palace Produces: Palace
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay: DisabledOverlay:
RequiresPower: RequiresPower:
SupportPowerChargeBar: SupportPowerChargeBar:

View File

@@ -40,6 +40,8 @@ MSLO:
CameraActor: camera CameraActor: camera
FlashType: Nuke FlashType: Nuke
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
RequiresPower: RequiresPower:
DisabledOverlay: DisabledOverlay:
SupportPowerChargeBar: SupportPowerChargeBar:
@@ -290,6 +292,8 @@ IRON:
Dimensions: 2,1 Dimensions: 2,1
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay: DisabledOverlay:
Selectable: Selectable:
Bounds: 48,28,0,2 Bounds: 48,28,0,2
@@ -338,6 +342,8 @@ PDOX:
Dimensions: 2,2 Dimensions: 2,2
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay: DisabledOverlay:
Health: Health:
HP: 1000 HP: 1000
@@ -410,6 +416,8 @@ TSLA:
SelectionDecorations: SelectionDecorations:
VisualBounds: 24,36,0,4 VisualBounds: 24,36,0,4
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay: DisabledOverlay:
Health: Health:
HP: 400 HP: 400
@@ -455,6 +463,8 @@ AGUN:
VisualBounds: 24,36,0,12 VisualBounds: 24,36,0,12
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay: DisabledOverlay:
Health: Health:
HP: 400 HP: 400
@@ -502,6 +512,8 @@ DOME:
TargetTypes: Ground, Structure, C4, DetonateAttack, SpyInfiltrate TargetTypes: Ground, Structure, C4, DetonateAttack, SpyInfiltrate
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay: DisabledOverlay:
Health: Health:
HP: 1000 HP: 1000

View File

@@ -13,8 +13,6 @@ Sounds:
ChatLine: message1 ChatLine: message1
ClickDisabledSound: wrong1 ClickDisabledSound: wrong1
ClickSound: clicky1 ClickSound: clicky1
DisablePower: 00-i232
EnablePower: 00-i230
GameForming: gamefrm1 GameForming: gamefrm1
Gdiclose: gdiclose Gdiclose: gdiclose
Gdiopen: gdiopen Gdiopen: gdiopen

View File

@@ -25,6 +25,8 @@ Speech:
ConstructionComplete: 00-i018 ConstructionComplete: 00-i018
CriticalStructureLost: 00-i196 CriticalStructureLost: 00-i196
CriticalUnitLost: 00-i194 CriticalUnitLost: 00-i194
DisablePower: 00-i232
EnablePower: 00-i230
EmPulseCannonReady: 00-i158 EmPulseCannonReady: 00-i158
EstablishingBattleControlStandBy: 01-n006 EstablishingBattleControlStandBy: 01-n006
FireStormDefenseOffline: 00-i170 FireStormDefenseOffline: 00-i170

View File

@@ -305,6 +305,8 @@ GARADR:
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
IndicatorPalette: mouse IndicatorPalette: mouse
PowerupSpeech: EnablePower
PowerdownSpeech: DisablePower
ProvidesRadar: ProvidesRadar:
InfiltrateForExploration: InfiltrateForExploration:
DetectCloaked: DetectCloaked:
@@ -374,6 +376,8 @@ GAPLUG:
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
IndicatorPalette: mouse IndicatorPalette: mouse
PowerupSpeech: EnablePower
PowerdownSpeech: DisablePower
DisabledOverlay: DisabledOverlay:
WithIdleOverlay@DISH: WithIdleOverlay@DISH:
Sequence: idle-dish Sequence: idle-dish

View File

@@ -62,6 +62,8 @@ GACTWR:
UpgradeMinEnabledLevel: 1 UpgradeMinEnabledLevel: 1
CanPowerDown: CanPowerDown:
IndicatorPalette: mouse IndicatorPalette: mouse
PowerupSpeech: EnablePower
PowerdownSpeech: DisablePower
WithSpriteTurret@VULC: WithSpriteTurret@VULC:
UpgradeTypes: tower.vulcan UpgradeTypes: tower.vulcan
UpgradeMinEnabledLevel: 1 UpgradeMinEnabledLevel: 1

View File

@@ -260,6 +260,8 @@ NARADR:
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
IndicatorPalette: mouse IndicatorPalette: mouse
PowerupSpeech: EnablePower
PowerdownSpeech: DisablePower
ProvidesRadar: ProvidesRadar:
InfiltrateForExploration: InfiltrateForExploration:
DetectCloaked: DetectCloaked:
@@ -379,6 +381,8 @@ NASTLH:
Amount: -350 Amount: -350
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
PowerupSpeech: EnablePower
PowerdownSpeech: DisablePower
IndicatorPalette: mouse IndicatorPalette: mouse
UpgradeActorsNear: UpgradeActorsNear:
Upgrades: cloakgenerator Upgrades: cloakgenerator

View File

@@ -253,6 +253,8 @@ NAMISL:
Amount: -50 Amount: -50
CanPowerDown: CanPowerDown:
IndicatorPalette: mouse IndicatorPalette: mouse
PowerupSpeech: EnablePower
PowerdownSpeech: DisablePower
RequiresPower: RequiresPower:
DisabledOverlay: DisabledOverlay:
ProvidesPrerequisite@buildingname: ProvidesPrerequisite@buildingname: