diff --git a/OpenRA.Mods.RA/Buildings/Building.cs b/OpenRA.Mods.RA/Buildings/Building.cs index 042b8a9584..3662cba5b6 100755 --- a/OpenRA.Mods.RA/Buildings/Building.cs +++ b/OpenRA.Mods.RA/Buildings/Building.cs @@ -16,10 +16,12 @@ using OpenRA.FileFormats; namespace OpenRA.Mods.RA.Buildings { + public class GivesBuildableAreaInfo : TraitInfo {} + public class GivesBuildableArea {} + public class BuildingInfo : ITraitInfo { public readonly int Power = 0; - public readonly bool BaseNormal = true; public readonly bool WaterBound = false; public readonly int Adjacent = 2; public readonly string Footprint = "x"; @@ -48,14 +50,13 @@ namespace OpenRA.Mods.RA.Buildings var bi = world.WorldActor.Trait(); for( int y = scanStart.Y ; y < scanEnd.Y ; y++ ) - { for( int x = scanStart.X ; x < scanEnd.X ; x++ ) { var at = bi.GetBuildingAt( new int2( x, y ) ); - if( at != null && at.Owner.Stances[ p ] == Stance.Ally && at.Info.Traits.Get().BaseNormal ) + if( at != null && at.Owner.Stances[ p ] == Stance.Ally && at.HasTrait() ) nearnessCandidates.Add( new int2( x, y ) ); } - } + var buildingTiles = FootprintUtils.Tiles( buildingName, this, topLeft ).ToList(); return nearnessCandidates .Any( a => buildingTiles diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index 72fa16ccfb..ef093279b2 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -204,6 +204,7 @@ DestroyedSound: xplobig4.aud Buildable: Queue: Building + GivesBuildableArea: RenderBuilding: WithBuildingExplosion: DeadBuildingState: @@ -260,7 +261,6 @@ Dimensions: 1,1 Footprint: x BuildSounds: hvydoor1.aud - BaseNormal: no Adjacent: 7 TargetableBuilding: TargetTypes: Ground diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index 281cc07836..45742bfadb 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -118,7 +118,7 @@ SILO: Power: -10 Footprint: xx Dimensions: 2,1 - BaseNormal: no + -GivesBuildableArea: Health: HP: 300 RevealsShroud: @@ -512,7 +512,7 @@ OBLI: Power: -150 Footprint: _ x Dimensions: 1,2 - BaseNormal: no + -GivesBuildableArea: Health: HP: 400 Armor: @@ -615,7 +615,7 @@ GUN: Owner: gdi,nod Building: Power: -20 - BaseNormal: no + -GivesBuildableArea: Health: HP: 400 RevealsShroud: @@ -651,7 +651,7 @@ SAM: Power: -20 Footprint: xx Dimensions: 2,1 - BaseNormal: no + -GivesBuildableArea: Health: HP: 400 Armor: @@ -684,7 +684,7 @@ GTWR: Owner: gdi,nod Building: Power: -10 - BaseNormal: no + -GivesBuildableArea: Health: HP: 600 RevealsShroud: @@ -720,7 +720,7 @@ ATWR: Power: -20 Footprint: _ x Dimensions: 1,2 - BaseNormal: no + -GivesBuildableArea: Health: HP: 800 Armor: diff --git a/mods/ra/rules/civilian.yaml b/mods/ra/rules/civilian.yaml index e1b4a0e35f..457577b7fb 100644 --- a/mods/ra/rules/civilian.yaml +++ b/mods/ra/rules/civilian.yaml @@ -93,9 +93,7 @@ BARL: Selectable: Priority: 0 -RepairableBuilding: - Building: - BaseNormal: no - Adjacent: 0 + -GivesBuildableArea: Health: HP: 10 Explodes: @@ -107,9 +105,7 @@ BRL3: Selectable: Priority: 0 -RepairableBuilding: - Building: - BaseNormal: no - Adjacent: 0 + -GivesBuildableArea: Health: HP: 10 Explodes: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index c23c909c08..80d36bcca2 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -171,6 +171,7 @@ Building: Dimensions: 1,1 Footprint: x + GivesBuildableArea: Capturable: SoundOnDamageTransition: DamagedSound: kaboom1.aud @@ -200,7 +201,6 @@ Dimensions: 1,1 Footprint: x BuildSounds: placbldg.aud - BaseNormal: no Adjacent: 7 SoundOnDamageTransition: DamagedSound: sandbag2.aud @@ -236,6 +236,7 @@ ProximityCaptor: Types:CivilianBuilding -AcceptsSupplies: + -GivesBuildableArea: ^CivField: Inherits: ^CivBuilding diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 4b9dbb068f..23405ed9ae 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -38,9 +38,9 @@ MSLO: SupportPowerChargeBar: GAP: + Inherits: ^Building RequiresPower: CanPowerDown: - Inherits: ^Building Valued: Cost: 500 Tooltip: @@ -64,9 +64,9 @@ GAP: IronCurtainable: SPEN: + Inherits: ^Building InfiltrateForSupportPower: Proxy: powerproxy.sonarpulse - Inherits: ^Building Valued: Cost: 650 Tooltip: @@ -84,9 +84,9 @@ SPEN: Power: -30 Footprint: xxx xxx xxx Dimensions: 3,3 - BaseNormal: no Adjacent: 8 WaterBound: yes + -GivesBuildableArea: Health: HP: 1000 Armor: @@ -119,9 +119,9 @@ SPEN: ProductionBar: SYRD: + Inherits: ^Building InfiltrateForSupportPower: Proxy: powerproxy.sonarpulse - Inherits: ^Building Buildable: Queue: Building BuildPaletteOrder: 40 @@ -139,9 +139,9 @@ SYRD: Power: -30 Footprint: xxx xxx xxx Dimensions: 3,3 - BaseNormal: no Adjacent: 8 WaterBound: yes + -GivesBuildableArea: Health: HP: 1000 Armor: @@ -174,9 +174,9 @@ SYRD: ProductionBar: IRON: - RequiresPower: CanPowerDown: Inherits: ^Building + RequiresPower: Buildable: Queue: Defense BuildPaletteOrder: 120 @@ -212,9 +212,9 @@ IRON: SupportPowerChargeBar: PDOX: + Inherits: ^Building RequiresPower: CanPowerDown: - Inherits: ^Building Buildable: Queue: Defense BuildPaletteOrder: 120 @@ -252,9 +252,9 @@ PDOX: -AcceptsSupplies: TSLA: + Inherits: ^Building RequiresPower: CanPowerDown: - Inherits: ^Building Buildable: Queue: Defense BuildPaletteOrder: 70 @@ -270,7 +270,7 @@ TSLA: Power: -150 Footprint: _ x Dimensions: 1,2 - BaseNormal: no + -GivesBuildableArea: Health: HP: 400 Armor: @@ -289,9 +289,9 @@ TSLA: -AcceptsSupplies: AGUN: + Inherits: ^Building RequiresPower: CanPowerDown: - Inherits: ^Building Buildable: Queue: Defense BuildPaletteOrder: 50 @@ -307,7 +307,7 @@ AGUN: Power: -50 Footprint: _ x Dimensions: 1,2 - BaseNormal: no + -GivesBuildableArea: Health: HP: 400 Armor: @@ -372,7 +372,7 @@ PBOX: Description: Basic defensive structure.\n Strong vs Infantry, Light Vehicles\n Weak vs Tanks, Aircraft Building: Power: -15 - BaseNormal: no + -GivesBuildableArea: Health: HP: 400 Armor: @@ -405,7 +405,7 @@ HBOX: Description: Hidden defensive structure.\n Strong vs Infantry, Light Vehicles\n Weak vs Tanks, Aircraft Building: Power: -15 - BaseNormal: no + -GivesBuildableArea: Health: HP: 600 Armor: @@ -438,7 +438,7 @@ GUN: Description: Anti-Armor base defense.\n Strong vs Tanks\n Weak vs Infantry, Aircraft Building: Power: -40 - BaseNormal: no + -GivesBuildableArea: Health: HP: 400 Armor: @@ -472,7 +472,7 @@ FTUR: Description: Anti-Infantry base defense.\n Strong vs Infantry\n Weak vs Aircraft Building: Power: -20 - BaseNormal: no + -GivesBuildableArea: Health: HP: 400 Armor: @@ -507,7 +507,7 @@ SAM: Power: -20 Footprint: xx Dimensions: 2,1 - BaseNormal: no + -GivesBuildableArea: Health: HP: 400 Armor: @@ -684,7 +684,7 @@ SILO: Description: Stores excess harvested Ore Building: Power: -10 - BaseNormal: no + -GivesBuildableArea: Health: HP: 300 Armor: @@ -985,7 +985,7 @@ FACF: Power: -2 Footprint: xxx xxx xxx Dimensions: 3,3 - BaseNormal: no + -GivesBuildableArea: Health: HP: 30 RevealsShroud: @@ -1011,7 +1011,7 @@ WEAF: Power: -2 Footprint: xxx xxx Dimensions: 3,2 - BaseNormal: no + -GivesBuildableArea: Health: HP: 30 RevealsShroud: @@ -1044,9 +1044,9 @@ SYRF: Power: -2 Footprint: xxx xxx xxx Dimensions: 3,3 - BaseNormal: no Adjacent: 8 WaterBound: yes + -GivesBuildableArea: Health: HP: 30 RevealsShroud: @@ -1064,9 +1064,9 @@ SPEF: Power: -2 Footprint: xxx xxx xxx Dimensions: 3,3 - BaseNormal: no Adjacent: 8 WaterBound: yes + -GivesBuildableArea: Health: HP: 30 RevealsShroud: @@ -1094,7 +1094,7 @@ DOMF: Power: -2 Footprint: xx xx Dimensions: 2,2 - BaseNormal: no + -GivesBuildableArea: Health: HP: 30 RevealsShroud: