diff --git a/OpenRA.Mods.RA/Buildings/Building.cs b/OpenRA.Mods.RA/Buildings/Building.cs index d0d1811a45..ea0645d84f 100755 --- a/OpenRA.Mods.RA/Buildings/Building.cs +++ b/OpenRA.Mods.RA/Buildings/Building.cs @@ -22,7 +22,6 @@ namespace OpenRA.Mods.RA.Buildings public readonly bool BaseNormal = true; public readonly bool WaterBound = false; public readonly int Adjacent = 2; - public readonly bool Capturable = false; public readonly string Footprint = "x"; public readonly int2 Dimensions = new int2(1, 1); diff --git a/OpenRA.Mods.RA/Capturable.cs b/OpenRA.Mods.RA/Capturable.cs new file mode 100644 index 0000000000..633ec6a255 --- /dev/null +++ b/OpenRA.Mods.RA/Capturable.cs @@ -0,0 +1,23 @@ +#region Copyright & License Information +/* + * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see COPYING. + */ +#endregion + +using System.Linq; +using OpenRA.Effects; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA +{ + public class CapturableInfo : TraitInfo + { + public readonly string[] CaptureClasses = {"Building"}; + } + + public class Capturable {} +} diff --git a/OpenRA.Mods.RA/EngineerCapture.cs b/OpenRA.Mods.RA/EngineerCapture.cs index 2ed257ffd3..5bb6ea6939 100644 --- a/OpenRA.Mods.RA/EngineerCapture.cs +++ b/OpenRA.Mods.RA/EngineerCapture.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using System.Drawing; +using System.Linq; using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Orders; @@ -17,15 +18,26 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { - class EngineerCaptureInfo : TraitInfo {} + class EngineerCaptureInfo : ITraitInfo + { + public string[] CaptureClasses = {"Building"}; + public object Create(ActorInitializer init) { return new EngineerCapture(this); } + } + class EngineerCapture : IIssueOrder, IResolveOrder, IOrderVoice { + public readonly EngineerCaptureInfo Info; + public EngineerCapture(EngineerCaptureInfo info) + { + Info = info; + } + public IEnumerable Orders { get { - yield return new EnterOrderTargeter( "CaptureBuilding", 5, true, false, - _ => true, target => target.Info.Traits.Get().Capturable ); + yield return new EnterOrderTargeter( "CaptureBuilding", 5, true, false, + _ => true, target => target.Info.Traits.Get().CaptureClasses.Intersect(Info.CaptureClasses).Any() ); } } diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 09aebb2ef9..32f2c844bc 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -1,4 +1,4 @@ - + Debug @@ -340,6 +340,7 @@ + diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index dba6656874..27d5f0f75b 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -220,6 +220,7 @@ RelativeToTopLeft: yes ShakeOnDeath: Sellable: + Capturable: ^CivBuilding: Inherits: ^Building @@ -232,6 +233,7 @@ Type: Wood Building: -RepairableBuilding: + -Capturable: Tooltip: Name: Civilian Building @@ -252,7 +254,6 @@ Dimensions: 1,1 Footprint: x BuildSounds: hvydoor1.aud - Capturable: false BaseNormal: no Adjacent: 7 TargetableBuilding: diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index ea5cdd8bcb..dd1fe2dda6 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -11,7 +11,6 @@ FACT: Power: 15 Footprint: xxx xxx Dimensions: 3,2 - Capturable: true Health: HP: 1750 RevealsShroud: @@ -60,7 +59,6 @@ NUKE: Power: 100 Footprint: x_ xx Dimensions: 2,2 - Capturable: true Health: HP: 400 RevealsShroud: @@ -83,7 +81,6 @@ PROC: Power: -30 Footprint: xxx xxx === Dimensions: 3,3 - Capturable: true Health: HP: 900 RevealsShroud: @@ -121,7 +118,6 @@ SILO: Power: -10 Footprint: xx Dimensions: 2,1 - Capturable: true BaseNormal: no Health: HP: 300 @@ -153,7 +149,6 @@ PYLE: Power: -20 Footprint: xx xx Dimensions: 2,2 - Capturable: true Health: HP: 500 RevealsShroud: @@ -196,7 +191,6 @@ HAND: Power: -20 Footprint: __ xx xx Dimensions: 2,3 - Capturable: true Health: HP: 500 RevealsShroud: @@ -236,7 +230,6 @@ AFLD: Power: -30 Footprint: xxxx xxxx Dimensions: 4,2 - Capturable: true Health: HP: 1000 RevealsShroud: @@ -278,7 +271,6 @@ WEAP: Power: -30 Footprint: ___ xxx === Dimensions: 3,3 - Capturable: true Health: HP: 1000 RevealsShroud: @@ -321,7 +313,6 @@ HQ: Power: -40 Footprint: x_ xx Dimensions: 2,2 - Capturable: true Health: HP: 1000 RevealsShroud: @@ -359,7 +350,6 @@ NUK2: Power: 200 Footprint: xx xx Dimensions: 2,2 - Capturable: true Health: HP: 600 RevealsShroud: @@ -382,7 +372,6 @@ FIX: Power: -30 Footprint: _x_ xxx =x= Dimensions: 3,3 - Capturable: true Health: HP: 800 RevealsShroud: @@ -409,7 +398,6 @@ HPAD: Power: -10 Footprint: xx xx Dimensions: 2,2 - Capturable: true Health: HP: 800 RevealsShroud: @@ -451,7 +439,6 @@ EYE: Power: -200 Footprint: x_ xx Dimensions: 2,2 - Capturable: true Health: HP: 1000 RevealsShroud: @@ -490,7 +477,6 @@ TMPL: Power: -150 Footprint: ___ xxx xxx Dimensions: 3,3 - Capturable: true Health: HP: 2000 RevealsShroud: diff --git a/mods/cnc/rules/tech.yaml b/mods/cnc/rules/tech.yaml index 7f06bcc522..89c312e309 100644 --- a/mods/cnc/rules/tech.yaml +++ b/mods/cnc/rules/tech.yaml @@ -7,10 +7,10 @@ V19: Building: Footprint: x Dimensions: 1,1 - Capturable: true RevealsShroud: Range: 3 -DeadBuildingState: + Capturable: Tooltip: Name: Oil Derrick LeavesHusk: diff --git a/mods/ra/rules/civilian.yaml b/mods/ra/rules/civilian.yaml index 0602e73d89..f768bf3bfb 100644 --- a/mods/ra/rules/civilian.yaml +++ b/mods/ra/rules/civilian.yaml @@ -4,7 +4,6 @@ FCOM: Power: -200 Footprint: xx xx Dimensions: 2,2 - Capturable: true Health: HP: 400 Armor: @@ -124,7 +123,6 @@ MISS: Building: Footprint: xxx xxx Dimensions: 3,2 - Capturable: true Health: HP: 400 Armor: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 572447c502..f8a5aedeed 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -154,6 +154,7 @@ Building: Dimensions: 1,1 Footprint: x + Capturable: SoundOnDamageTransition: DamagedSound: kaboom1.aud DestroyedSound: kaboom22.aud @@ -181,7 +182,6 @@ Dimensions: 1,1 Footprint: x BuildSounds: placbldg.aud - Capturable: false BaseNormal: no Adjacent: 7 SoundOnDamageTransition: diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 48a6fd85d5..c525c93198 100755 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -55,7 +55,6 @@ GAP: Power: -60 Footprint: _ x Dimensions: 1,2 - Capturable: true Health: HP: 1000 Armor: @@ -85,7 +84,6 @@ SPEN: Power: -30 Footprint: xxx xxx xxx Dimensions: 3,3 - Capturable: true BaseNormal: no Adjacent: 8 WaterBound: yes @@ -141,7 +139,6 @@ SYRD: Power: -30 Footprint: xxx xxx xxx Dimensions: 3,3 - Capturable: true BaseNormal: no Adjacent: 8 WaterBound: yes @@ -195,7 +192,6 @@ IRON: Power: -200 Footprint: xx xx Dimensions: 2,2 - Capturable: true Health: HP: 400 Armor: @@ -234,7 +230,6 @@ PDOX: Power: -200 Footprint: xx xx Dimensions: 2,2 - Capturable: true Health: HP: 400 Armor: @@ -351,7 +346,6 @@ DOME: Power: -40 Footprint: xx xx Dimensions: 2,2 - Capturable: true Health: HP: 1000 Armor: @@ -542,7 +536,6 @@ ATEK: Power: -200 Footprint: xx xx Dimensions: 2,2 - Capturable: true Health: HP: 400 Armor: @@ -578,7 +571,6 @@ WEAP: Power: -30 Footprint: xxx xxx Dimensions: 3,2 - Capturable: true Health: HP: 1500 Armor: @@ -604,7 +596,6 @@ FACT: Power: 0 Footprint: xxx xxx xxx Dimensions: 3,3 - Capturable: true Health: HP: 1000 Armor: @@ -646,7 +637,6 @@ PROC: Power: -30 Footprint: _x_ xxx x== Dimensions: 3,3 - Capturable: true Health: HP: 900 Armor: @@ -682,7 +672,6 @@ SILO: Description: Stores excess harvested Ore Building: Power: -10 - Capturable: true BaseNormal: no Health: HP: 300 @@ -715,7 +704,6 @@ HPAD: Power: -10 Footprint: xx xx Dimensions: 2,2 - Capturable: true Health: HP: 800 Armor: @@ -751,7 +739,6 @@ AFLD: Power: -20 Footprint: xxx xxx Dimensions: 3,2 - Capturable: true Health: HP: 1000 Armor: @@ -804,7 +791,6 @@ POWR: Power: 100 Footprint: xx xx Dimensions: 2,2 - Capturable: true Health: HP: 400 Armor: @@ -833,7 +819,6 @@ APWR: Power: 200 Footprint: ___ xxx xxx Dimensions: 3,3 - Capturable: true Health: HP: 700 Armor: @@ -862,7 +847,6 @@ STEK: Power: -100 Footprint: xxx xxx Dimensions: 3,2 - Capturable: true Health: HP: 600 Armor: @@ -889,7 +873,6 @@ BARR: Power: -20 Footprint: xx xx Dimensions: 2,2 - Capturable: true Health: HP: 800 Armor: @@ -927,7 +910,6 @@ TENT: Power: -20 Footprint: xx xx Dimensions: 2,2 - Capturable: true Health: HP: 800 Armor: @@ -965,7 +947,6 @@ FIX: Power: -30 Footprint: _x_ xxx _x_ Dimensions: 3,3 - Capturable: true Health: HP: 800 Armor: @@ -992,7 +973,6 @@ FACF: Power: -2 Footprint: xxx xxx xxx Dimensions: 3,3 - Capturable: true BaseNormal: no Health: HP: 30 @@ -1019,7 +999,6 @@ WEAF: Power: -2 Footprint: xxx xxx Dimensions: 3,2 - Capturable: true BaseNormal: no Health: HP: 30 @@ -1053,7 +1032,6 @@ SYRF: Power: -2 Footprint: xxx xxx xxx Dimensions: 3,3 - Capturable: true BaseNormal: no Adjacent: 8 WaterBound: yes @@ -1074,7 +1052,6 @@ SPEF: Power: -2 Footprint: xxx xxx xxx Dimensions: 3,3 - Capturable: true BaseNormal: no Adjacent: 8 WaterBound: yes @@ -1105,7 +1082,6 @@ DOMF: Power: -2 Footprint: xx xx Dimensions: 2,2 - Capturable: true BaseNormal: no Health: HP: 30