From c164ec8c8c23ea2654e2a13135ea0ddeec37560e Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 23 Jul 2014 11:58:58 +1200 Subject: [PATCH 1/3] Add Buildable.BuildAtProduction. This allows actors to be restricted to specific production structures. --- OpenRA.Mods.RA/Buildable.cs | 3 +++ OpenRA.Mods.RA/Player/ClassicProductionQueue.cs | 10 ++++++++-- OpenRA.Mods.RA/Player/ProductionQueue.cs | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.RA/Buildable.cs b/OpenRA.Mods.RA/Buildable.cs index c8002105fc..260b3ad565 100755 --- a/OpenRA.Mods.RA/Buildable.cs +++ b/OpenRA.Mods.RA/Buildable.cs @@ -27,6 +27,9 @@ namespace OpenRA.Mods.RA [Desc("Production queue(s) that can produce this.")] public readonly string[] Queue = { }; + [Desc("Override the production structure type (from the Production Produces list) that this unit should be built at.")] + public readonly string BuildAtProductionType = null; + [Desc("Disable production when there are more than this many of this actor on the battlefield. Set to 0 to disable.")] public readonly int BuildLimit = 0; diff --git a/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs b/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs index b914006e6b..c61a30fb9f 100644 --- a/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs +++ b/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs @@ -76,9 +76,15 @@ namespace OpenRA.Mods.RA protected override bool BuildUnit(string name) { // Find a production structure to build this actor + var info = self.World.Map.Rules.Actors[name]; + var bi = info.Traits.GetOrDefault(); + + // Some units may request a specific production type, which is ignored if the AllTech cheat is enabled + var type = bi == null || developerMode.AllTech ? Info.Type : bi.BuildAtProductionType ?? Info.Type; + var producers = self.World.ActorsWithTrait() .Where(x => x.Actor.Owner == self.Owner - && x.Trait.Info.Produces.Contains(Info.Type)) + && x.Trait.Info.Produces.Contains(type)) .OrderByDescending(x => x.Actor.IsPrimaryBuilding()) .ThenByDescending(x => x.Actor.ActorID); @@ -90,7 +96,7 @@ namespace OpenRA.Mods.RA foreach (var p in producers.Where(p => !p.Actor.IsDisabled())) { - if (p.Trait.Produce(p.Actor, self.World.Map.Rules.Actors[name], Race)) + if (p.Trait.Produce(p.Actor, info, Race)) { FinishProduction(); return true; diff --git a/OpenRA.Mods.RA/Player/ProductionQueue.cs b/OpenRA.Mods.RA/Player/ProductionQueue.cs index b719c72862..fca8f15a63 100644 --- a/OpenRA.Mods.RA/Player/ProductionQueue.cs +++ b/OpenRA.Mods.RA/Player/ProductionQueue.cs @@ -74,7 +74,7 @@ namespace OpenRA.Mods.RA // Will change if the owner changes PowerManager playerPower; PlayerResources playerResources; - DeveloperMode developerMode; + protected DeveloperMode developerMode; // A list of things we could possibly build Dictionary produceable; From 90d310690b863cfc854d5bd2264b5538476153b2 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 15 Jul 2014 15:14:01 +1200 Subject: [PATCH 2/3] Merge the RA aircraft queues. Closes #5961. --- mods/ra/chrome.yaml | 18 ++++++------------ mods/ra/rules/aircraft.yaml | 25 +++++++++++++++---------- mods/ra/rules/player.yaml | 10 ++-------- mods/ra/rules/structures.yaml | 4 ++-- 4 files changed, 25 insertions(+), 32 deletions(-) diff --git a/mods/ra/chrome.yaml b/mods/ra/chrome.yaml index 0194af3e7f..7086f5a7dc 100644 --- a/mods/ra/chrome.yaml +++ b/mods/ra/chrome.yaml @@ -77,15 +77,13 @@ tabs-selected: tabs.png allies-Defense: 0,40,27,41 allies-Infantry: 0,80,27,41 allies-Vehicle: 0,120,27,41 - allies-Plane: 162,200,27,41 - allies-Helicopter: 0,160,27,41 + allies-Aircraft: 162,200,27,41 allies-Ship: 0,200,27,41 soviet-Building: 81,0,27,41 soviet-Defense: 81,40,27,41 soviet-Infantry: 81,80,27,41 soviet-Vehicle: 81,120,27,41 - soviet-Plane: 81,160,27,41 - soviet-Helicopter: 162,80,27,41 + soviet-Aircraft: 81,160,27,41 soviet-Ship: 81,200,27,41 tabs-ready: tabs.png @@ -93,15 +91,13 @@ tabs-ready: tabs.png allies-Defense: 27,40,27,41 allies-Infantry: 27,80,27,41 allies-Vehicle: 27,120,27,41 - allies-Plane: 162,160,27,41 - allies-Helicopter: 27,160,27,41 + allies-Aircraft: 162,160,27,41 allies-Ship: 27,200,27,41 soviet-Building: 108,0,27,41 soviet-Defense: 108,40,27,41 soviet-Infantry: 108,80,27,41 soviet-Vehicle: 108,120,27,41 - soviet-Plane: 108,160,27,41 - soviet-Helicopter: 162,40,27,41 + soviet-Aircraft: 108,160,27,41 soviet-Ship: 108,200,27,41 tabs-normal: tabs.png @@ -109,15 +105,13 @@ tabs-normal: tabs.png allies-Defense: 54,40,27,41 allies-Infantry: 54,80,27,41 allies-Vehicle: 54,120,27,41 - allies-Plane: 162,120,27,41 - allies-Helicopter: 54,160,27,41 + allies-Aircraft: 162,120,27,41 allies-Ship: 54,200,27,41 soviet-Building: 135,0,27,41 soviet-Defense: 135,40,27,41 soviet-Infantry: 135,80,27,41 soviet-Vehicle: 135,120,27,41 - soviet-Plane: 135,160,27,41 - soviet-Helicopter: 162,0,27,41 + soviet-Aircraft: 135,160,27,41 soviet-Ship: 135,200,27,41 # Used for the menu diff --git a/mods/ra/rules/aircraft.yaml b/mods/ra/rules/aircraft.yaml index 1c6d25f011..24d0e0ff97 100644 --- a/mods/ra/rules/aircraft.yaml +++ b/mods/ra/rules/aircraft.yaml @@ -75,9 +75,10 @@ BADR.Bomber: MIG: Inherits: ^Plane Buildable: - Queue: Plane + Queue: Aircraft + BuildAtProductionType: Plane BuildPaletteOrder: 50 - Prerequisites: afld, stek, ~techlevel.unrestricted + Prerequisites: ~afld, stek, ~techlevel.unrestricted Hotkey: m Valued: Cost: 2000 @@ -127,9 +128,10 @@ MIG: YAK: Inherits: ^Plane Buildable: - Queue: Plane + Queue: Aircraft + BuildAtProductionType: Plane BuildPaletteOrder: 30 - Prerequisites: afld, ~techlevel.medium + Prerequisites: ~afld, ~techlevel.medium Hotkey: y Valued: Cost: 1000 @@ -185,9 +187,10 @@ YAK: TRAN: Inherits: ^Helicopter Buildable: - Queue: Helicopter + Queue: Aircraft + BuildAtProductionType: Helicopter BuildPaletteOrder: 10 - Prerequisites: hpad, ~techlevel.medium + Prerequisites: ~hpad, ~techlevel.medium Hotkey: t Valued: Cost: 900 @@ -227,9 +230,10 @@ TRAN: HELI: Inherits: ^Helicopter Buildable: - Queue: Helicopter + Queue: Aircraft + BuildAtProductionType: Helicopter BuildPaletteOrder: 40 - Prerequisites: hpad, atek, ~techlevel.unrestricted + Prerequisites: ~hpad, atek, ~techlevel.unrestricted Hotkey: l Valued: Cost: 2000 @@ -277,9 +281,10 @@ HELI: HIND: Inherits: ^Helicopter Buildable: - Queue: Helicopter + Queue: Aircraft + BuildAtProductionType: Helicopter BuildPaletteOrder: 20 - Prerequisites: hpad, ~techlevel.medium + Prerequisites: ~hpad, ~techlevel.medium Hotkey: h Valued: Cost: 1000 diff --git a/mods/ra/rules/player.yaml b/mods/ra/rules/player.yaml index 2c5eb383e2..2ed6bd6b24 100644 --- a/mods/ra/rules/player.yaml +++ b/mods/ra/rules/player.yaml @@ -34,14 +34,8 @@ Player: LowPowerSlowdown: 3 SpeedUp: True RequireOwner: false - ClassicProductionQueue@Plane: - Type: Plane - BuildSpeed: .4 - LowPowerSlowdown: 3 - SpeedUp: True - RequireOwner: false - ClassicProductionQueue@Helicopter: - Type: Helicopter + ClassicProductionQueue@Aircraft: + Type: Aircraft BuildSpeed: .4 LowPowerSlowdown: 3 SpeedUp: True diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 527184fc3d..a0aded36cd 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -858,7 +858,7 @@ HPAD: MoveIntoWorld: false RallyPoint: Production: - Produces: Helicopter + Produces: Aircraft, Helicopter Reservable: IronCurtainable: ProductionBar: @@ -893,7 +893,7 @@ AFLD: MoveIntoWorld: false RallyPoint: Production: - Produces: Plane + Produces: Aircraft, Plane Reservable: IronCurtainable: AirstrikePower: From 2a5d7b73f66cbadae8f7ab65cb922b4f7f9a8423 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 24 Jul 2014 21:04:35 +1200 Subject: [PATCH 3/3] Add BuildAtProductionType to boats/subs. --- mods/ra/rules/ships.yaml | 5 +++++ mods/ra/rules/structures.yaml | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mods/ra/rules/ships.yaml b/mods/ra/rules/ships.yaml index b42b4abdc5..fb20b7eae3 100644 --- a/mods/ra/rules/ships.yaml +++ b/mods/ra/rules/ships.yaml @@ -2,6 +2,7 @@ SS: Inherits: ^Ship Buildable: Queue: Ship + BuildAtProductionType: Submarine BuildPaletteOrder: 30 Prerequisites: ~spen, ~techlevel.medium Hotkey: u @@ -54,6 +55,7 @@ MSUB: Inherits: ^Ship Buildable: Queue: Ship + BuildAtProductionType: Submarine BuildPaletteOrder: 60 Prerequisites: ~spen, stek, ~techlevel.unrestricted Hotkey: m @@ -106,6 +108,7 @@ DD: Inherits: ^Ship Buildable: Queue: Ship + BuildAtProductionType: Boat BuildPaletteOrder: 40 Prerequisites: ~syrd, dome, ~techlevel.medium Hotkey: r @@ -155,6 +158,7 @@ CA: Inherits: ^Ship Buildable: Queue: Ship + BuildAtProductionType: Boat BuildPaletteOrder: 50 Prerequisites: ~syrd, atek, ~techlevel.unrestricted Hotkey: c @@ -249,6 +253,7 @@ PT: Inherits: ^Ship Buildable: Queue: Ship + BuildAtProductionType: Boat BuildPaletteOrder: 20 Prerequisites: ~syrd, ~techlevel.medium Hotkey: b diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index a0aded36cd..5d01ced238 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -127,7 +127,7 @@ SPEN: Facing: 224 ExitCell: 2,0 Production: - Produces: Ship + Produces: Ship, Submarine PrimaryBuilding: IronCurtainable: -EmitInfantryOnSell: @@ -183,7 +183,7 @@ SYRD: Facing: 32 ExitCell: 2,0 Production: - Produces: Ship + Produces: Ship, Boat PrimaryBuilding: IronCurtainable: -EmitInfantryOnSell: