Split Capturable into its own trait
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
23
OpenRA.Mods.RA/Capturable.cs
Normal file
23
OpenRA.Mods.RA/Capturable.cs
Normal file
@@ -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<Capturable>
|
||||
{
|
||||
public readonly string[] CaptureClasses = {"Building"};
|
||||
}
|
||||
|
||||
public class Capturable {}
|
||||
}
|
||||
@@ -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<EngineerCapture> {}
|
||||
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<IOrderTargeter> Orders
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return new EnterOrderTargeter<Building>( "CaptureBuilding", 5, true, false,
|
||||
_ => true, target => target.Info.Traits.Get<BuildingInfo>().Capturable );
|
||||
yield return new EnterOrderTargeter<Capturable>( "CaptureBuilding", 5, true, false,
|
||||
_ => true, target => target.Info.Traits.Get<CapturableInfo>().CaptureClasses.Intersect(Info.CaptureClasses).Any() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -340,6 +340,7 @@
|
||||
<Compile Include="Render\WithMuzzleFlash.cs" />
|
||||
<Compile Include="Render\WithShadow.cs" />
|
||||
<Compile Include="AnnounceOnBuild.cs" />
|
||||
<Compile Include="Capturable.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -7,10 +7,10 @@ V19:
|
||||
Building:
|
||||
Footprint: x
|
||||
Dimensions: 1,1
|
||||
Capturable: true
|
||||
RevealsShroud:
|
||||
Range: 3
|
||||
-DeadBuildingState:
|
||||
Capturable:
|
||||
Tooltip:
|
||||
Name: Oil Derrick
|
||||
LeavesHusk:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user