diff --git a/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs b/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs index c61a30fb9f..c25deaabfe 100644 --- a/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs +++ b/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs @@ -8,7 +8,6 @@ */ #endregion -using System; using System.Collections.Generic; using System.Linq; using OpenRA.Mods.RA.Buildings; @@ -76,8 +75,8 @@ 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(); + var ai = self.World.Map.Rules.Actors[name]; + var bi = ai.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; @@ -96,7 +95,7 @@ namespace OpenRA.Mods.RA foreach (var p in producers.Where(p => !p.Actor.IsDisabled())) { - if (p.Trait.Produce(p.Actor, info, Race)) + if (p.Trait.Produce(p.Actor, ai, Race)) { FinishProduction(); return true; @@ -108,23 +107,24 @@ namespace OpenRA.Mods.RA public override int GetBuildTime(string unitString) { - var unit = self.World.Map.Rules.Actors[unitString]; - if (unit == null || !unit.Traits.Contains()) + var ai = self.World.Map.Rules.Actors[unitString]; + var bi = ai.Traits.GetOrDefault(); + if (bi == null) return 0; if (self.World.AllowDevCommands && self.Owner.PlayerActor.Trait().FastBuild) return 0; - var time = (int)(unit.GetBuildTime() * Info.BuildSpeed); + var time = (int)(ai.GetBuildTime() * Info.BuildSpeed); if (info.SpeedUp) { - var queues = unit.Traits.Get().Queue; - var selfsameBuildings = self.World.ActorsWithTrait() - .Where(p => p.Actor.Owner == self.Owner && p.Trait.Info.Produces.Intersect(queues).Any()) - .ToArray(); + var type = bi.BuildAtProductionType ?? info.Type; - var speedModifier = selfsameBuildings.Count().Clamp(1, info.BuildTimeSpeedReduction.Length) - 1; + var selfsameBuildingsCount = self.World.ActorsWithTrait() + .Count(p => p.Actor.Owner == self.Owner && p.Trait.Info.Produces.Contains(type)); + + var speedModifier = selfsameBuildingsCount.Clamp(1, info.BuildTimeSpeedReduction.Length) - 1; time = (time * info.BuildTimeSpeedReduction[speedModifier]) / 100; } diff --git a/mods/ra/maps/intervention/map.yaml b/mods/ra/maps/intervention/map.yaml index 14d9f6c6dd..bcc3e8dd43 100644 --- a/mods/ra/maps/intervention/map.yaml +++ b/mods/ra/maps/intervention/map.yaml @@ -1280,7 +1280,7 @@ Actors: Location: 73,63 Owner: Soviets FreeActor: False - Actor397: kenn + Kennel: kenn Location: 64,61 Owner: Soviets Actor484: silo diff --git a/mods/ra/maps/intervention/mission.lua b/mods/ra/maps/intervention/mission.lua index 9f00876ea9..ab3f9156f9 100644 --- a/mods/ra/maps/intervention/mission.lua +++ b/mods/ra/maps/intervention/mission.lua @@ -45,7 +45,7 @@ HunterSubs = { { SubPen, {"ss", "ss"} } } GroundPatrolWpts = { PatrolWpt1, PatrolWpt2 } GroundPatrolUnits = { - { { Barracks, {"e1", "e1", "e1", "e3", "e3", "dog"} } }, + { { Barracks, {"e1", "e1", "e1", "e3", "e3"} }, { Kennel, {"dog"} } }, { { WarFactory, {"apc", "apc", "ftrk"} } }, { { WarFactory, {"3tnk", "3tnk"} } } } diff --git a/mods/ra/rules/infantry.yaml b/mods/ra/rules/infantry.yaml index 17ab0f1405..16987d1b30 100644 --- a/mods/ra/rules/infantry.yaml +++ b/mods/ra/rules/infantry.yaml @@ -2,8 +2,9 @@ DOG: Inherits: ^Infantry Buildable: Queue: Infantry + BuildAtProductionType: Dog BuildPaletteOrder: 50 - Prerequisites: ~barr, ~techlevel.infonly + Prerequisites: ~kenn, ~techlevel.infonly Hotkey: o Valued: Cost: 200 @@ -32,8 +33,9 @@ E1: Inherits: ^Infantry Buildable: Queue: Infantry + BuildAtProductionType: Soldier BuildPaletteOrder: 10 - Prerequisites: ~techlevel.infonly + Prerequisites: ~barracks, ~techlevel.infonly Hotkey: i Valued: Cost: 100 @@ -63,6 +65,7 @@ E2: Inherits: ^Infantry Buildable: Queue: Infantry + BuildAtProductionType: Soldier BuildPaletteOrder: 20 Prerequisites: ~barr, ~techlevel.infonly Hotkey: g @@ -99,8 +102,9 @@ E3: Inherits: ^Infantry Buildable: Queue: Infantry + BuildAtProductionType: Soldier BuildPaletteOrder: 30 - Prerequisites: ~techlevel.infonly + Prerequisites: ~barracks, ~techlevel.infonly Hotkey: r Valued: Cost: 300 @@ -133,6 +137,7 @@ E4: Inherits: ^Infantry Buildable: Queue: Infantry + BuildAtProductionType: Soldier BuildPaletteOrder: 70 Prerequisites: ~barr, ftur, ~techlevel.low Hotkey: t @@ -165,8 +170,9 @@ E6: Inherits: ^Infantry Buildable: Queue: Infantry + BuildAtProductionType: Soldier BuildPaletteOrder: 60 - Prerequisites: ~techlevel.infonly + Prerequisites: ~barracks, ~techlevel.infonly Hotkey: e Valued: Cost: 500 @@ -197,6 +203,7 @@ SPY: Inherits: ^Infantry Buildable: Queue: Infantry + BuildAtProductionType: Soldier BuildPaletteOrder: 90 Prerequisites: dome, ~tent, ~techlevel.medium Hotkey: p @@ -233,6 +240,7 @@ E7: Inherits: ^Infantry Buildable: Queue: Infantry + BuildAtProductionType: Soldier BuildPaletteOrder: 120 Prerequisites: ~tent, atek, ~techlevel.unrestricted Hotkey: y @@ -273,6 +281,7 @@ MEDI: Inherits: ^Infantry Buildable: Queue: Infantry + BuildAtProductionType: Soldier BuildPaletteOrder: 40 Prerequisites: ~tent, ~techlevel.infonly Hotkey: m @@ -309,6 +318,7 @@ MECH: Inherits: ^Infantry Buildable: Queue: Infantry + BuildAtProductionType: Soldier BuildPaletteOrder: 100 Prerequisites: ~tent, fix, ~techlevel.medium Hotkey: c @@ -426,6 +436,7 @@ HIJACKER: Inherits: ^Infantry Buildable: Queue: Infantry + BuildAtProductionType: Soldier BuildPaletteOrder: 110 Prerequisites: ~barr, fix, ~techlevel.medium Hotkey: j @@ -453,6 +464,7 @@ SHOK: Inherits: ^Infantry Buildable: Queue: Infantry + BuildAtProductionType: Soldier BuildPaletteOrder: 130 Prerequisites: ~barr, stek, tsla, ~techlevel.unrestricted Hotkey: l @@ -492,6 +504,7 @@ SNIPER: Description: Elite sniper infantry unit.\nCan detect cloaked units.\n Strong vs Infantry\n Weak vs Vehicles Buildable: Queue: Infantry + BuildAtProductionType: Soldier BuildPaletteOrder: 80 Prerequisites: ~barr, dome, ~techlevel.medium Hotkey: h diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 5d01ced238..f80f07fecf 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -1039,10 +1039,47 @@ BARR: SpawnOffset: -725,640,0 ExitCell: 0,2 Production: - Produces: Infantry + Produces: Infantry, Soldier PrimaryBuilding: IronCurtainable: ProductionBar: + ProvidesCustomPrerequisite: + Prerequisite: barracks + +KENN: + Inherits: ^Building + Buildable: + Queue: Building + BuildPaletteOrder: 25 + Prerequisites: anypower, ~structures.soviet, ~techlevel.infonly + Hotkey: k + Valued: + Cost: 100 + Tooltip: + Name: Kennel + Description: Trains Attack Dogs. + Building: + Power: -10 + -GivesBuildableArea: + Health: + HP: 300 + Armor: + Type: Wood + RevealsShroud: + Range: 4c0 + Bib: + HasMinibib: True + RallyPoint: + RallyPoint: 0,2 + Exit: + SpawnOffset: -280,400,0 + ExitCell: 0,1 + Production: + Produces: Infantry, Dog + PrimaryBuilding: + IronCurtainable: + ProductionBar: + -EmitInfantryOnSell: TENT: Inherits: ^Building @@ -1075,27 +1112,12 @@ TENT: SpawnOffset: -725,640,0 ExitCell: 0,2 Production: - Produces: Infantry + Produces: Infantry, Soldier PrimaryBuilding: IronCurtainable: ProductionBar: - -KENN: - Inherits: ^Building - Tooltip: - Name: Kennel - Building: - Power: -10 - -GivesBuildableArea: - Health: - HP: 300 - Armor: - Type: Wood - RevealsShroud: - Range: 4c0 - IronCurtainable: - -EmitInfantryOnSell: - -AcceptsSupplies: + ProvidesCustomPrerequisite: + Prerequisite: barracks FIX: Inherits: ^Building diff --git a/mods/ra/sequences/structures.yaml b/mods/ra/sequences/structures.yaml index f70a2e42d3..9bd42bfaea 100644 --- a/mods/ra/sequences/structures.yaml +++ b/mods/ra/sequences/structures.yaml @@ -191,6 +191,9 @@ kenn: make: kennmake Start: 0 Length: * + bib: mbSILO + Start: 0 + Length: * icon: kennicon Start: 0