fixed #728: BuildableInfo.BaseNormal -> GivesBuildableArea

This commit is contained in:
Chris Forbes
2011-06-28 23:10:50 +12:00
parent fb027a5650
commit 43d8750aad
6 changed files with 38 additions and 40 deletions

View File

@@ -16,10 +16,12 @@ using OpenRA.FileFormats;
namespace OpenRA.Mods.RA.Buildings namespace OpenRA.Mods.RA.Buildings
{ {
public class GivesBuildableAreaInfo : TraitInfo<GivesBuildableArea> {}
public class GivesBuildableArea {}
public class BuildingInfo : ITraitInfo public class BuildingInfo : ITraitInfo
{ {
public readonly int Power = 0; public readonly int Power = 0;
public readonly bool BaseNormal = true;
public readonly bool WaterBound = false; public readonly bool WaterBound = false;
public readonly int Adjacent = 2; public readonly int Adjacent = 2;
public readonly string Footprint = "x"; public readonly string Footprint = "x";
@@ -48,14 +50,13 @@ namespace OpenRA.Mods.RA.Buildings
var bi = world.WorldActor.Trait<BuildingInfluence>(); var bi = world.WorldActor.Trait<BuildingInfluence>();
for( int y = scanStart.Y ; y < scanEnd.Y ; y++ ) for( int y = scanStart.Y ; y < scanEnd.Y ; y++ )
{
for( int x = scanStart.X ; x < scanEnd.X ; x++ ) for( int x = scanStart.X ; x < scanEnd.X ; x++ )
{ {
var at = bi.GetBuildingAt( new int2( x, y ) ); var at = bi.GetBuildingAt( new int2( x, y ) );
if( at != null && at.Owner.Stances[ p ] == Stance.Ally && at.Info.Traits.Get<BuildingInfo>().BaseNormal ) if( at != null && at.Owner.Stances[ p ] == Stance.Ally && at.HasTrait<GivesBuildableArea>() )
nearnessCandidates.Add( new int2( x, y ) ); nearnessCandidates.Add( new int2( x, y ) );
} }
}
var buildingTiles = FootprintUtils.Tiles( buildingName, this, topLeft ).ToList(); var buildingTiles = FootprintUtils.Tiles( buildingName, this, topLeft ).ToList();
return nearnessCandidates return nearnessCandidates
.Any( a => buildingTiles .Any( a => buildingTiles

View File

@@ -204,6 +204,7 @@
DestroyedSound: xplobig4.aud DestroyedSound: xplobig4.aud
Buildable: Buildable:
Queue: Building Queue: Building
GivesBuildableArea:
RenderBuilding: RenderBuilding:
WithBuildingExplosion: WithBuildingExplosion:
DeadBuildingState: DeadBuildingState:
@@ -260,7 +261,6 @@
Dimensions: 1,1 Dimensions: 1,1
Footprint: x Footprint: x
BuildSounds: hvydoor1.aud BuildSounds: hvydoor1.aud
BaseNormal: no
Adjacent: 7 Adjacent: 7
TargetableBuilding: TargetableBuilding:
TargetTypes: Ground TargetTypes: Ground

View File

@@ -118,7 +118,7 @@ SILO:
Power: -10 Power: -10
Footprint: xx Footprint: xx
Dimensions: 2,1 Dimensions: 2,1
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 300 HP: 300
RevealsShroud: RevealsShroud:
@@ -512,7 +512,7 @@ OBLI:
Power: -150 Power: -150
Footprint: _ x Footprint: _ x
Dimensions: 1,2 Dimensions: 1,2
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 400 HP: 400
Armor: Armor:
@@ -615,7 +615,7 @@ GUN:
Owner: gdi,nod Owner: gdi,nod
Building: Building:
Power: -20 Power: -20
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 400 HP: 400
RevealsShroud: RevealsShroud:
@@ -651,7 +651,7 @@ SAM:
Power: -20 Power: -20
Footprint: xx Footprint: xx
Dimensions: 2,1 Dimensions: 2,1
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 400 HP: 400
Armor: Armor:
@@ -684,7 +684,7 @@ GTWR:
Owner: gdi,nod Owner: gdi,nod
Building: Building:
Power: -10 Power: -10
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 600 HP: 600
RevealsShroud: RevealsShroud:
@@ -720,7 +720,7 @@ ATWR:
Power: -20 Power: -20
Footprint: _ x Footprint: _ x
Dimensions: 1,2 Dimensions: 1,2
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 800 HP: 800
Armor: Armor:

View File

@@ -93,9 +93,7 @@ BARL:
Selectable: Selectable:
Priority: 0 Priority: 0
-RepairableBuilding: -RepairableBuilding:
Building: -GivesBuildableArea:
BaseNormal: no
Adjacent: 0
Health: Health:
HP: 10 HP: 10
Explodes: Explodes:
@@ -107,9 +105,7 @@ BRL3:
Selectable: Selectable:
Priority: 0 Priority: 0
-RepairableBuilding: -RepairableBuilding:
Building: -GivesBuildableArea:
BaseNormal: no
Adjacent: 0
Health: Health:
HP: 10 HP: 10
Explodes: Explodes:

View File

@@ -171,6 +171,7 @@
Building: Building:
Dimensions: 1,1 Dimensions: 1,1
Footprint: x Footprint: x
GivesBuildableArea:
Capturable: Capturable:
SoundOnDamageTransition: SoundOnDamageTransition:
DamagedSound: kaboom1.aud DamagedSound: kaboom1.aud
@@ -200,7 +201,6 @@
Dimensions: 1,1 Dimensions: 1,1
Footprint: x Footprint: x
BuildSounds: placbldg.aud BuildSounds: placbldg.aud
BaseNormal: no
Adjacent: 7 Adjacent: 7
SoundOnDamageTransition: SoundOnDamageTransition:
DamagedSound: sandbag2.aud DamagedSound: sandbag2.aud
@@ -236,6 +236,7 @@
ProximityCaptor: ProximityCaptor:
Types:CivilianBuilding Types:CivilianBuilding
-AcceptsSupplies: -AcceptsSupplies:
-GivesBuildableArea:
^CivField: ^CivField:
Inherits: ^CivBuilding Inherits: ^CivBuilding

View File

@@ -38,9 +38,9 @@ MSLO:
SupportPowerChargeBar: SupportPowerChargeBar:
GAP: GAP:
Inherits: ^Building
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
Inherits: ^Building
Valued: Valued:
Cost: 500 Cost: 500
Tooltip: Tooltip:
@@ -64,9 +64,9 @@ GAP:
IronCurtainable: IronCurtainable:
SPEN: SPEN:
Inherits: ^Building
InfiltrateForSupportPower: InfiltrateForSupportPower:
Proxy: powerproxy.sonarpulse Proxy: powerproxy.sonarpulse
Inherits: ^Building
Valued: Valued:
Cost: 650 Cost: 650
Tooltip: Tooltip:
@@ -84,9 +84,9 @@ SPEN:
Power: -30 Power: -30
Footprint: xxx xxx xxx Footprint: xxx xxx xxx
Dimensions: 3,3 Dimensions: 3,3
BaseNormal: no
Adjacent: 8 Adjacent: 8
WaterBound: yes WaterBound: yes
-GivesBuildableArea:
Health: Health:
HP: 1000 HP: 1000
Armor: Armor:
@@ -119,9 +119,9 @@ SPEN:
ProductionBar: ProductionBar:
SYRD: SYRD:
Inherits: ^Building
InfiltrateForSupportPower: InfiltrateForSupportPower:
Proxy: powerproxy.sonarpulse Proxy: powerproxy.sonarpulse
Inherits: ^Building
Buildable: Buildable:
Queue: Building Queue: Building
BuildPaletteOrder: 40 BuildPaletteOrder: 40
@@ -139,9 +139,9 @@ SYRD:
Power: -30 Power: -30
Footprint: xxx xxx xxx Footprint: xxx xxx xxx
Dimensions: 3,3 Dimensions: 3,3
BaseNormal: no
Adjacent: 8 Adjacent: 8
WaterBound: yes WaterBound: yes
-GivesBuildableArea:
Health: Health:
HP: 1000 HP: 1000
Armor: Armor:
@@ -174,9 +174,9 @@ SYRD:
ProductionBar: ProductionBar:
IRON: IRON:
RequiresPower:
CanPowerDown: CanPowerDown:
Inherits: ^Building Inherits: ^Building
RequiresPower:
Buildable: Buildable:
Queue: Defense Queue: Defense
BuildPaletteOrder: 120 BuildPaletteOrder: 120
@@ -212,9 +212,9 @@ IRON:
SupportPowerChargeBar: SupportPowerChargeBar:
PDOX: PDOX:
Inherits: ^Building
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
Inherits: ^Building
Buildable: Buildable:
Queue: Defense Queue: Defense
BuildPaletteOrder: 120 BuildPaletteOrder: 120
@@ -252,9 +252,9 @@ PDOX:
-AcceptsSupplies: -AcceptsSupplies:
TSLA: TSLA:
Inherits: ^Building
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
Inherits: ^Building
Buildable: Buildable:
Queue: Defense Queue: Defense
BuildPaletteOrder: 70 BuildPaletteOrder: 70
@@ -270,7 +270,7 @@ TSLA:
Power: -150 Power: -150
Footprint: _ x Footprint: _ x
Dimensions: 1,2 Dimensions: 1,2
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 400 HP: 400
Armor: Armor:
@@ -289,9 +289,9 @@ TSLA:
-AcceptsSupplies: -AcceptsSupplies:
AGUN: AGUN:
Inherits: ^Building
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:
Inherits: ^Building
Buildable: Buildable:
Queue: Defense Queue: Defense
BuildPaletteOrder: 50 BuildPaletteOrder: 50
@@ -307,7 +307,7 @@ AGUN:
Power: -50 Power: -50
Footprint: _ x Footprint: _ x
Dimensions: 1,2 Dimensions: 1,2
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 400 HP: 400
Armor: Armor:
@@ -372,7 +372,7 @@ PBOX:
Description: Basic defensive structure.\n Strong vs Infantry, Light Vehicles\n Weak vs Tanks, Aircraft Description: Basic defensive structure.\n Strong vs Infantry, Light Vehicles\n Weak vs Tanks, Aircraft
Building: Building:
Power: -15 Power: -15
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 400 HP: 400
Armor: Armor:
@@ -405,7 +405,7 @@ HBOX:
Description: Hidden defensive structure.\n Strong vs Infantry, Light Vehicles\n Weak vs Tanks, Aircraft Description: Hidden defensive structure.\n Strong vs Infantry, Light Vehicles\n Weak vs Tanks, Aircraft
Building: Building:
Power: -15 Power: -15
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 600 HP: 600
Armor: Armor:
@@ -438,7 +438,7 @@ GUN:
Description: Anti-Armor base defense.\n Strong vs Tanks\n Weak vs Infantry, Aircraft Description: Anti-Armor base defense.\n Strong vs Tanks\n Weak vs Infantry, Aircraft
Building: Building:
Power: -40 Power: -40
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 400 HP: 400
Armor: Armor:
@@ -472,7 +472,7 @@ FTUR:
Description: Anti-Infantry base defense.\n Strong vs Infantry\n Weak vs Aircraft Description: Anti-Infantry base defense.\n Strong vs Infantry\n Weak vs Aircraft
Building: Building:
Power: -20 Power: -20
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 400 HP: 400
Armor: Armor:
@@ -507,7 +507,7 @@ SAM:
Power: -20 Power: -20
Footprint: xx Footprint: xx
Dimensions: 2,1 Dimensions: 2,1
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 400 HP: 400
Armor: Armor:
@@ -684,7 +684,7 @@ SILO:
Description: Stores excess harvested Ore Description: Stores excess harvested Ore
Building: Building:
Power: -10 Power: -10
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 300 HP: 300
Armor: Armor:
@@ -985,7 +985,7 @@ FACF:
Power: -2 Power: -2
Footprint: xxx xxx xxx Footprint: xxx xxx xxx
Dimensions: 3,3 Dimensions: 3,3
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 30 HP: 30
RevealsShroud: RevealsShroud:
@@ -1011,7 +1011,7 @@ WEAF:
Power: -2 Power: -2
Footprint: xxx xxx Footprint: xxx xxx
Dimensions: 3,2 Dimensions: 3,2
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 30 HP: 30
RevealsShroud: RevealsShroud:
@@ -1044,9 +1044,9 @@ SYRF:
Power: -2 Power: -2
Footprint: xxx xxx xxx Footprint: xxx xxx xxx
Dimensions: 3,3 Dimensions: 3,3
BaseNormal: no
Adjacent: 8 Adjacent: 8
WaterBound: yes WaterBound: yes
-GivesBuildableArea:
Health: Health:
HP: 30 HP: 30
RevealsShroud: RevealsShroud:
@@ -1064,9 +1064,9 @@ SPEF:
Power: -2 Power: -2
Footprint: xxx xxx xxx Footprint: xxx xxx xxx
Dimensions: 3,3 Dimensions: 3,3
BaseNormal: no
Adjacent: 8 Adjacent: 8
WaterBound: yes WaterBound: yes
-GivesBuildableArea:
Health: Health:
HP: 30 HP: 30
RevealsShroud: RevealsShroud:
@@ -1094,7 +1094,7 @@ DOMF:
Power: -2 Power: -2
Footprint: xx xx Footprint: xx xx
Dimensions: 2,2 Dimensions: 2,2
BaseNormal: no -GivesBuildableArea:
Health: Health:
HP: 30 HP: 30
RevealsShroud: RevealsShroud: