From e37d804a5af921686c8b22857c244989fd8b0da5 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sun, 10 Jan 2016 21:52:04 +0100 Subject: [PATCH 1/5] Replace spaces by tabs in UpgradeRules.cs --- OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 594b30558a..23da778cf4 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -1899,7 +1899,7 @@ namespace OpenRA.Mods.Common.UtilityCommands // Rename *CrateAction.ValidRaces if (depth == 2 && node.Key == "ValidRaces" - && (parentKey == "DuplicateUnitCrateAction" || parentKey == "GiveUnitCrateAction")) + && (parentKey == "DuplicateUnitCrateAction" || parentKey == "GiveUnitCrateAction")) node.Key = "ValidFactions"; } From 3106336c6a333de7ea0c132e4b9ff24384d22858 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sat, 16 Jan 2016 14:01:10 +0100 Subject: [PATCH 2/5] Add missing spaces to the rallypoint sequences in misc.yaml --- mods/ra/sequences/misc.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ra/sequences/misc.yaml b/mods/ra/sequences/misc.yaml index 1ceadee7ad..de96ed084c 100644 --- a/mods/ra/sequences/misc.yaml +++ b/mods/ra/sequences/misc.yaml @@ -88,11 +88,11 @@ v2: ZOffset: 1023 rallypoint: - flag:flagfly + flag: flagfly Length: * Offset: 11,-5 ZOffset: 2535 - circles:fpls + circles: fpls Length: * ZOffset: 2047 From fdfea2f0fb5c1685ca6400f25039b50e48a9ecd3 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sat, 16 Jan 2016 14:09:59 +0100 Subject: [PATCH 3/5] Fix style errors in ProductionQueue.cs --- .../Traits/Player/ProductionQueue.cs | 93 +++++++++---------- 1 file changed, 44 insertions(+), 49 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs index a570446ae1..c0c720bf43 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs @@ -249,66 +249,61 @@ namespace OpenRA.Mods.Common.Traits switch (order.OrderString) { case "StartProduction": + var unit = rules.Actors[order.TargetString]; + var bi = unit.TraitInfo(); + + // Not built by this queue + if (!bi.Queue.Contains(Info.Type)) + return; + + var cost = unit.HasTraitInfo() ? unit.TraitInfo().Cost : 0; + var time = GetBuildTime(order.TargetString); + + // You can't build that + if (BuildableItems().All(b => b.Name != order.TargetString)) + return; + + // Check if the player is trying to build more units that they are allowed + var fromLimit = int.MaxValue; + if (!developerMode.AllTech && bi.BuildLimit > 0) { - var unit = rules.Actors[order.TargetString]; - var bi = unit.TraitInfo(); - if (!bi.Queue.Contains(Info.Type)) - return; /* Not built by this queue */ + var inQueue = queue.Count(pi => pi.Item == order.TargetString); + var owned = self.Owner.World.ActorsHavingTrait().Count(a => a.Info.Name == order.TargetString && a.Owner == self.Owner); + fromLimit = bi.BuildLimit - (inQueue + owned); - var cost = unit.HasTraitInfo() ? unit.TraitInfo().Cost : 0; - var time = GetBuildTime(order.TargetString); + if (fromLimit <= 0) + return; + } - if (BuildableItems().All(b => b.Name != order.TargetString)) - return; /* you can't build that!! */ - - // Check if the player is trying to build more units that they are allowed - var fromLimit = int.MaxValue; - if (!developerMode.AllTech && bi.BuildLimit > 0) + var amountToBuild = Math.Min(fromLimit, order.ExtraData); + for (var n = 0; n < amountToBuild; n++) + { + var hasPlayedSound = false; + BeginProduction(new ProductionItem(this, order.TargetString, cost, playerPower, () => self.World.AddFrameEndTask(_ => { - var inQueue = queue.Count(pi => pi.Item == order.TargetString); - var owned = self.Owner.World.ActorsHavingTrait().Count(a => a.Info.Name == order.TargetString && a.Owner == self.Owner); - fromLimit = bi.BuildLimit - (inQueue + owned); + var isBuilding = unit.HasTraitInfo(); - if (fromLimit <= 0) - return; - } - - var amountToBuild = Math.Min(fromLimit, order.ExtraData); - for (var n = 0; n < amountToBuild; n++) - { - var hasPlayedSound = false; - BeginProduction(new ProductionItem(this, order.TargetString, cost, playerPower, () => self.World.AddFrameEndTask(_ => + if (isBuilding && !hasPlayedSound) + hasPlayedSound = Game.Sound.PlayNotification(rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName); + else if (!isBuilding) { - var isBuilding = unit.HasTraitInfo(); - - if (isBuilding && !hasPlayedSound) - hasPlayedSound = Game.Sound.PlayNotification(rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName); - else if (!isBuilding) - { - if (BuildUnit(order.TargetString)) - Game.Sound.PlayNotification(rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName); - else if (!hasPlayedSound && time > 0) - hasPlayedSound = Game.Sound.PlayNotification(rules, self.Owner, "Speech", Info.BlockedAudio, self.Owner.Faction.InternalName); - } - }))); - } - - break; + if (BuildUnit(order.TargetString)) + Game.Sound.PlayNotification(rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName); + else if (!hasPlayedSound && time > 0) + hasPlayedSound = Game.Sound.PlayNotification(rules, self.Owner, "Speech", Info.BlockedAudio, self.Owner.Faction.InternalName); + } + }))); } + break; case "PauseProduction": - { - if (queue.Count > 0 && queue[0].Item == order.TargetString) - queue[0].Pause(order.ExtraData != 0); - - break; - } + if (queue.Count > 0 && queue[0].Item == order.TargetString) + queue[0].Pause(order.ExtraData != 0); + break; case "CancelProduction": - { - CancelProduction(order.TargetString, order.ExtraData); - break; - } + CancelProduction(order.TargetString, order.ExtraData); + break; } } From 6bbab081d1ad379023e58b54324be63b2049ccf9 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sat, 16 Jan 2016 14:11:39 +0100 Subject: [PATCH 4/5] Fix wrong indentation in ProductionPaletteWidget.cs --- .../Widgets/ProductionPaletteWidget.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs index 0346f07bae..9e68a189ca 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs @@ -418,17 +418,17 @@ namespace OpenRA.Mods.Common.Widgets } else if (first.Paused) overlayFont.DrawTextWithContrast(HoldText, - icon.Pos + holdOffset, - Color.White, Color.Black, 1); + icon.Pos + holdOffset, + Color.White, Color.Black, 1); else if (!waiting) overlayFont.DrawTextWithContrast(WidgetUtils.FormatTime(first.RemainingTimeActual, World.Timestep), - icon.Pos + timeOffset, - Color.White, Color.Black, 1); + icon.Pos + timeOffset, + Color.White, Color.Black, 1); if (total > 1 || waiting) overlayFont.DrawTextWithContrast(total.ToString(), - icon.Pos + queuedOffset, - Color.White, Color.Black, 1); + icon.Pos + queuedOffset, + Color.White, Color.Black, 1); } } } From 2437091760062af08d22c9368594f71ab325501b Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sat, 16 Jan 2016 14:21:47 +0100 Subject: [PATCH 5/5] Remove yaml duplication in ts by creating ^Cloakable and using inheritance --- mods/ts/rules/defaults.yaml | 71 +++++++++---------------------------- 1 file changed, 17 insertions(+), 54 deletions(-) diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 73a8bae329..ae0878062e 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -77,9 +77,21 @@ UpgradeTypes: notmobile UpgradeMaxEnabledLevel: 0 +^Cloakable: + Cloak@CLOAKGENERATOR: + UpgradeTypes: cloakgenerator + UpgradeMinEnabledLevel: 1 + InitialDelay: 0 + CloakDelay: 90 + IsPlayerPalette: true + CloakSound: cloak5.aud + UncloakSound: cloak5.aud + UncloakOn: Attack, Unload, Infiltrate, Demolish, Damage + ^BasicBuilding: Inherits@1: ^ExistsInWorld Inherits@2: ^SpriteActor + Inherits@3: ^Cloakable SelectionDecorations: Palette: pips Selectable: @@ -105,15 +117,6 @@ Guardable: Range: 3c0 Demolishable: - Cloak@CLOAKGENERATOR: - UpgradeTypes: cloakgenerator - UpgradeMinEnabledLevel: 1 - InitialDelay: 0 - CloakDelay: 90 - IsPlayerPalette: true - CloakSound: cloak5.aud - UncloakSound: cloak5.aud - UncloakOn: Attack, Unload, Infiltrate, Demolish, Damage ^Building: Inherits@1: ^BasicBuilding @@ -184,6 +187,7 @@ ^Wall: Inherits@1: ^SpriteActor + Inherits@2: ^Cloakable CombatDebugOverlay: HiddenUnderShroud: AppearsOnRadar: @@ -213,15 +217,6 @@ Demolishable: ScriptTriggers: UpgradeManager: - Cloak@CLOAKGENERATOR: - UpgradeTypes: cloakgenerator - UpgradeMinEnabledLevel: 1 - InitialDelay: 0 - CloakDelay: 90 - IsPlayerPalette: true - CloakSound: cloak5.aud - UncloakSound: cloak5.aud - UncloakOn: Attack, Unload, Infiltrate, Demolish, Damage Health: Shape: Circle Radius: 363 @@ -238,6 +233,7 @@ Inherits@1: ^GainsExperience Inherits@2: ^ExistsInWorld Inherits@3: ^SpriteActor + Inherits@4: ^Cloakable DrawLineToTarget: Health: HP: 50 @@ -319,15 +315,6 @@ DeathSounds@ZAPPED: Voice: Zapped DeathTypes: EnergyDeath - Cloak@CLOAKGENERATOR: - UpgradeTypes: cloakgenerator - UpgradeMinEnabledLevel: 1 - InitialDelay: 0 - CloakDelay: 90 - IsPlayerPalette: true - CloakSound: cloak5.aud - UncloakSound: cloak5.aud - UncloakOn: Attack, Unload, Infiltrate, Demolish, Damage ^Soldier: Inherits: ^Infantry @@ -379,6 +366,7 @@ Inherits@1: ^GainsExperience Inherits@2: ^ExistsInWorld Inherits@3: ^EmpDisableMobile + Inherits@4: ^Cloakable DrawLineToTarget: Mobile: Crushes: crate @@ -423,15 +411,6 @@ Explodes: Weapon: UnitExplodeSmall EmptyWeapon: UnitExplodeSmall - Cloak@CLOAKGENERATOR: - UpgradeTypes: cloakgenerator - UpgradeMinEnabledLevel: 1 - InitialDelay: 0 - CloakDelay: 90 - IsPlayerPalette: true - CloakSound: cloak5.aud - UncloakSound: cloak5.aud - UncloakOn: Attack, Unload, Infiltrate, Demolish, Damage MustBeDestroyed: RenderSprites: ThrowsShrapnel: @@ -474,6 +453,7 @@ ^Aircraft: Inherits@1: ^GainsExperience Inherits@2: ^ExistsInWorld + Inherits@3: ^Cloakable DrawLineToTarget: AppearsOnRadar: UseLocation: yes @@ -512,15 +492,6 @@ MustBeDestroyed: RenderVoxels: WithVoxelBody: - Cloak@CLOAKGENERATOR: - UpgradeTypes: cloakgenerator - UpgradeMinEnabledLevel: 1 - InitialDelay: 0 - CloakDelay: 90 - IsPlayerPalette: true - CloakSound: cloak5.aud - UncloakSound: cloak5.aud - UncloakOn: Attack, Unload, Infiltrate, Demolish, Damage ^Helicopter: Inherits: ^Aircraft @@ -715,6 +686,7 @@ ^Train: Inherits@1: ^EmpDisableMobile Inherits@2: ^ExistsInWorld + Inherits@3: ^Cloakable RenderVoxels: RenderSprites: WithVoxelBody: @@ -753,15 +725,6 @@ Explodes: Weapon: UnitExplodeSmall EmptyWeapon: UnitExplodeSmall - Cloak@CLOAKGENERATOR: - UpgradeTypes: cloakgenerator - UpgradeMinEnabledLevel: 1 - InitialDelay: 0 - CloakDelay: 90 - IsPlayerPalette: true - CloakSound: cloak5.aud - UncloakSound: cloak5.aud - UncloakOn: Attack, Unload, Infiltrate, Demolish, Damage ThrowsShrapnel: Weapons: SmallDebris Pieces: 3, 7