Merge pull request #6070 from ScottNZ/kenneltech

Move dog to kenn and make kenn buildable
This commit is contained in:
Paul Chote
2014-07-29 23:14:17 +12:00
6 changed files with 75 additions and 37 deletions

View File

@@ -8,7 +8,6 @@
*/ */
#endregion #endregion
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
@@ -76,8 +75,8 @@ namespace OpenRA.Mods.RA
protected override bool BuildUnit(string name) protected override bool BuildUnit(string name)
{ {
// Find a production structure to build this actor // Find a production structure to build this actor
var info = self.World.Map.Rules.Actors[name]; var ai = self.World.Map.Rules.Actors[name];
var bi = info.Traits.GetOrDefault<BuildableInfo>(); var bi = ai.Traits.GetOrDefault<BuildableInfo>();
// Some units may request a specific production type, which is ignored if the AllTech cheat is enabled // 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 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())) 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(); FinishProduction();
return true; return true;
@@ -108,23 +107,24 @@ namespace OpenRA.Mods.RA
public override int GetBuildTime(string unitString) public override int GetBuildTime(string unitString)
{ {
var unit = self.World.Map.Rules.Actors[unitString]; var ai = self.World.Map.Rules.Actors[unitString];
if (unit == null || !unit.Traits.Contains<BuildableInfo>()) var bi = ai.Traits.GetOrDefault<BuildableInfo>();
if (bi == null)
return 0; return 0;
if (self.World.AllowDevCommands && self.Owner.PlayerActor.Trait<DeveloperMode>().FastBuild) if (self.World.AllowDevCommands && self.Owner.PlayerActor.Trait<DeveloperMode>().FastBuild)
return 0; return 0;
var time = (int)(unit.GetBuildTime() * Info.BuildSpeed); var time = (int)(ai.GetBuildTime() * Info.BuildSpeed);
if (info.SpeedUp) if (info.SpeedUp)
{ {
var queues = unit.Traits.Get<BuildableInfo>().Queue; var type = bi.BuildAtProductionType ?? info.Type;
var selfsameBuildings = self.World.ActorsWithTrait<Production>()
.Where(p => p.Actor.Owner == self.Owner && p.Trait.Info.Produces.Intersect(queues).Any())
.ToArray();
var speedModifier = selfsameBuildings.Count().Clamp(1, info.BuildTimeSpeedReduction.Length) - 1; var selfsameBuildingsCount = self.World.ActorsWithTrait<Production>()
.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; time = (time * info.BuildTimeSpeedReduction[speedModifier]) / 100;
} }

View File

@@ -1280,7 +1280,7 @@ Actors:
Location: 73,63 Location: 73,63
Owner: Soviets Owner: Soviets
FreeActor: False FreeActor: False
Actor397: kenn Kennel: kenn
Location: 64,61 Location: 64,61
Owner: Soviets Owner: Soviets
Actor484: silo Actor484: silo

View File

@@ -45,7 +45,7 @@ HunterSubs = { { SubPen, {"ss", "ss"} } }
GroundPatrolWpts = { PatrolWpt1, PatrolWpt2 } GroundPatrolWpts = { PatrolWpt1, PatrolWpt2 }
GroundPatrolUnits = { GroundPatrolUnits = {
{ { Barracks, {"e1", "e1", "e1", "e3", "e3", "dog"} } }, { { Barracks, {"e1", "e1", "e1", "e3", "e3"} }, { Kennel, {"dog"} } },
{ { WarFactory, {"apc", "apc", "ftrk"} } }, { { WarFactory, {"apc", "apc", "ftrk"} } },
{ { WarFactory, {"3tnk", "3tnk"} } } { { WarFactory, {"3tnk", "3tnk"} } }
} }

View File

@@ -2,8 +2,9 @@ DOG:
Inherits: ^Infantry Inherits: ^Infantry
Buildable: Buildable:
Queue: Infantry Queue: Infantry
BuildAtProductionType: Dog
BuildPaletteOrder: 50 BuildPaletteOrder: 50
Prerequisites: ~barr, ~techlevel.infonly Prerequisites: ~kenn, ~techlevel.infonly
Hotkey: o Hotkey: o
Valued: Valued:
Cost: 200 Cost: 200
@@ -32,8 +33,9 @@ E1:
Inherits: ^Infantry Inherits: ^Infantry
Buildable: Buildable:
Queue: Infantry Queue: Infantry
BuildAtProductionType: Soldier
BuildPaletteOrder: 10 BuildPaletteOrder: 10
Prerequisites: ~techlevel.infonly Prerequisites: ~barracks, ~techlevel.infonly
Hotkey: i Hotkey: i
Valued: Valued:
Cost: 100 Cost: 100
@@ -63,6 +65,7 @@ E2:
Inherits: ^Infantry Inherits: ^Infantry
Buildable: Buildable:
Queue: Infantry Queue: Infantry
BuildAtProductionType: Soldier
BuildPaletteOrder: 20 BuildPaletteOrder: 20
Prerequisites: ~barr, ~techlevel.infonly Prerequisites: ~barr, ~techlevel.infonly
Hotkey: g Hotkey: g
@@ -99,8 +102,9 @@ E3:
Inherits: ^Infantry Inherits: ^Infantry
Buildable: Buildable:
Queue: Infantry Queue: Infantry
BuildAtProductionType: Soldier
BuildPaletteOrder: 30 BuildPaletteOrder: 30
Prerequisites: ~techlevel.infonly Prerequisites: ~barracks, ~techlevel.infonly
Hotkey: r Hotkey: r
Valued: Valued:
Cost: 300 Cost: 300
@@ -133,6 +137,7 @@ E4:
Inherits: ^Infantry Inherits: ^Infantry
Buildable: Buildable:
Queue: Infantry Queue: Infantry
BuildAtProductionType: Soldier
BuildPaletteOrder: 70 BuildPaletteOrder: 70
Prerequisites: ~barr, ftur, ~techlevel.low Prerequisites: ~barr, ftur, ~techlevel.low
Hotkey: t Hotkey: t
@@ -165,8 +170,9 @@ E6:
Inherits: ^Infantry Inherits: ^Infantry
Buildable: Buildable:
Queue: Infantry Queue: Infantry
BuildAtProductionType: Soldier
BuildPaletteOrder: 60 BuildPaletteOrder: 60
Prerequisites: ~techlevel.infonly Prerequisites: ~barracks, ~techlevel.infonly
Hotkey: e Hotkey: e
Valued: Valued:
Cost: 500 Cost: 500
@@ -197,6 +203,7 @@ SPY:
Inherits: ^Infantry Inherits: ^Infantry
Buildable: Buildable:
Queue: Infantry Queue: Infantry
BuildAtProductionType: Soldier
BuildPaletteOrder: 90 BuildPaletteOrder: 90
Prerequisites: dome, ~tent, ~techlevel.medium Prerequisites: dome, ~tent, ~techlevel.medium
Hotkey: p Hotkey: p
@@ -233,6 +240,7 @@ E7:
Inherits: ^Infantry Inherits: ^Infantry
Buildable: Buildable:
Queue: Infantry Queue: Infantry
BuildAtProductionType: Soldier
BuildPaletteOrder: 120 BuildPaletteOrder: 120
Prerequisites: ~tent, atek, ~techlevel.unrestricted Prerequisites: ~tent, atek, ~techlevel.unrestricted
Hotkey: y Hotkey: y
@@ -273,6 +281,7 @@ MEDI:
Inherits: ^Infantry Inherits: ^Infantry
Buildable: Buildable:
Queue: Infantry Queue: Infantry
BuildAtProductionType: Soldier
BuildPaletteOrder: 40 BuildPaletteOrder: 40
Prerequisites: ~tent, ~techlevel.infonly Prerequisites: ~tent, ~techlevel.infonly
Hotkey: m Hotkey: m
@@ -309,6 +318,7 @@ MECH:
Inherits: ^Infantry Inherits: ^Infantry
Buildable: Buildable:
Queue: Infantry Queue: Infantry
BuildAtProductionType: Soldier
BuildPaletteOrder: 100 BuildPaletteOrder: 100
Prerequisites: ~tent, fix, ~techlevel.medium Prerequisites: ~tent, fix, ~techlevel.medium
Hotkey: c Hotkey: c
@@ -426,6 +436,7 @@ HIJACKER:
Inherits: ^Infantry Inherits: ^Infantry
Buildable: Buildable:
Queue: Infantry Queue: Infantry
BuildAtProductionType: Soldier
BuildPaletteOrder: 110 BuildPaletteOrder: 110
Prerequisites: ~barr, fix, ~techlevel.medium Prerequisites: ~barr, fix, ~techlevel.medium
Hotkey: j Hotkey: j
@@ -453,6 +464,7 @@ SHOK:
Inherits: ^Infantry Inherits: ^Infantry
Buildable: Buildable:
Queue: Infantry Queue: Infantry
BuildAtProductionType: Soldier
BuildPaletteOrder: 130 BuildPaletteOrder: 130
Prerequisites: ~barr, stek, tsla, ~techlevel.unrestricted Prerequisites: ~barr, stek, tsla, ~techlevel.unrestricted
Hotkey: l Hotkey: l
@@ -492,6 +504,7 @@ SNIPER:
Description: Elite sniper infantry unit.\nCan detect cloaked units.\n Strong vs Infantry\n Weak vs Vehicles Description: Elite sniper infantry unit.\nCan detect cloaked units.\n Strong vs Infantry\n Weak vs Vehicles
Buildable: Buildable:
Queue: Infantry Queue: Infantry
BuildAtProductionType: Soldier
BuildPaletteOrder: 80 BuildPaletteOrder: 80
Prerequisites: ~barr, dome, ~techlevel.medium Prerequisites: ~barr, dome, ~techlevel.medium
Hotkey: h Hotkey: h

View File

@@ -1039,10 +1039,47 @@ BARR:
SpawnOffset: -725,640,0 SpawnOffset: -725,640,0
ExitCell: 0,2 ExitCell: 0,2
Production: Production:
Produces: Infantry Produces: Infantry, Soldier
PrimaryBuilding: PrimaryBuilding:
IronCurtainable: IronCurtainable:
ProductionBar: 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: TENT:
Inherits: ^Building Inherits: ^Building
@@ -1075,27 +1112,12 @@ TENT:
SpawnOffset: -725,640,0 SpawnOffset: -725,640,0
ExitCell: 0,2 ExitCell: 0,2
Production: Production:
Produces: Infantry Produces: Infantry, Soldier
PrimaryBuilding: PrimaryBuilding:
IronCurtainable: IronCurtainable:
ProductionBar: ProductionBar:
ProvidesCustomPrerequisite:
KENN: Prerequisite: barracks
Inherits: ^Building
Tooltip:
Name: Kennel
Building:
Power: -10
-GivesBuildableArea:
Health:
HP: 300
Armor:
Type: Wood
RevealsShroud:
Range: 4c0
IronCurtainable:
-EmitInfantryOnSell:
-AcceptsSupplies:
FIX: FIX:
Inherits: ^Building Inherits: ^Building

View File

@@ -191,6 +191,9 @@ kenn:
make: kennmake make: kennmake
Start: 0 Start: 0
Length: * Length: *
bib: mbSILO
Start: 0
Length: *
icon: kennicon icon: kennicon
Start: 0 Start: 0