diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index 215b435f51..9028824c85 100755 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -18,10 +18,10 @@ */ #endregion +using System; using System.Collections.Generic; using System.Drawing; using System.Linq; -using System; using OpenRA.FileFormats; using OpenRA.GameRules; using OpenRA.Traits; diff --git a/OpenRA.Game/Traits/LineBuild.cs b/OpenRA.Game/Traits/LineBuild.cs index c7c1d7fb5b..bb08f67873 100644 --- a/OpenRA.Game/Traits/LineBuild.cs +++ b/OpenRA.Game/Traits/LineBuild.cs @@ -18,18 +18,12 @@ */ #endregion -using System; -using System.Collections.Generic; -using System.Linq; -using OpenRA.Effects; -using OpenRA.GameRules; -using OpenRA.Traits.Activities; - namespace OpenRA.Traits { public class LineBuildInfo : TraitInfo { public readonly int Range = 5; } + public class LineBuild {} } diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index b92307ef18..b3fb2c8de1 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -20,7 +20,6 @@ using System.Collections.Generic; using System.Drawing; -using OpenRA.FileFormats; using OpenRA.GameRules; using OpenRA.Graphics; diff --git a/OpenRA.Game/Traits/Wall.cs b/OpenRA.Game/Traits/Wall.cs index 835869a80c..284de0f469 100644 --- a/OpenRA.Game/Traits/Wall.cs +++ b/OpenRA.Game/Traits/Wall.cs @@ -18,8 +18,39 @@ */ #endregion +using System.Collections.Generic; +using System.Linq; +using OpenRA.GameRules; + namespace OpenRA.Traits { - public class WallInfo : TraitInfo {} - public class Wall {} + public class WallInfo : ITraitInfo + { + public readonly UnitMovementType[] CrushableBy = { }; + + public object Create(Actor self) { return new Wall(self); } + } + + public class Wall : ICrushable, IOccupySpace + { + readonly Actor self; + public Wall(Actor self) + { + this.self = self; + self.World.WorldActor.traits.Get().Add(self, this); + } + + public IEnumerable OccupiedCells() { yield return self.Location; } + + public void OnCrush(Actor crusher) { self.InflictDamage(crusher, self.Health, null); } + public bool IsCrushableBy(UnitMovementType umt, Player player) + { + return self.Info.Traits.Get().CrushableBy.Contains(umt); + } + + public bool IsPathableCrush(UnitMovementType umt, Player player) + { + return IsCrushableBy(umt, player); + } + } } diff --git a/OpenRA.Game/Widgets/PostGameWidget.cs b/OpenRA.Game/Widgets/PostGameWidget.cs index 2927f223a1..c5d27385cf 100644 --- a/OpenRA.Game/Widgets/PostGameWidget.cs +++ b/OpenRA.Game/Widgets/PostGameWidget.cs @@ -1,3 +1,23 @@ +#region Copyright & License Information +/* + * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. + * This file is part of OpenRA. + * + * OpenRA is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenRA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenRA. If not, see . + */ +#endregion + using System.Drawing; using System.Linq; using OpenRA.Traits; diff --git a/OpenRA.Game/WorldUtils.cs b/OpenRA.Game/WorldUtils.cs index cd81f2007b..75c7c465ff 100755 --- a/OpenRA.Game/WorldUtils.cs +++ b/OpenRA.Game/WorldUtils.cs @@ -139,9 +139,9 @@ namespace OpenRA public static bool CanPlaceBuilding(this World world, string name, BuildingInfo building, int2 topLeft, Actor toIgnore) { var res = world.WorldActor.traits.Get(); - return !Footprint.Tiles(name, building, topLeft).Any( - t => !world.Map.IsInMap(t.X, t.Y) || res.GetResource(t) != null || !world.IsCellBuildable(t, - building.WaterBound, toIgnore)); + return Footprint.Tiles(name, building, topLeft).All( + t => world.Map.IsInMap(t.X, t.Y) && res.GetResource(t) == null && + world.IsCellBuildable(t, building.WaterBound, toIgnore)); } public static bool IsVisible(this Actor a) diff --git a/mods/ra/defaults.yaml b/mods/ra/defaults.yaml index 4d5ee2c65d..ffdd08575d 100644 --- a/mods/ra/defaults.yaml +++ b/mods/ra/defaults.yaml @@ -61,12 +61,12 @@ Category: Building Building: Dimensions: 1,1 - Footprint: x + Footprint: y BuildSounds: placbldg.aud Capturable: false BaseNormal: no Crewed: no - Sight: 0 + Sight: 0 Wall: LineBuild: Selectable: diff --git a/mods/ra/structures.yaml b/mods/ra/structures.yaml index 7a372e7afc..08516078f9 100644 --- a/mods/ra/structures.yaml +++ b/mods/ra/structures.yaml @@ -818,6 +818,8 @@ SBAG: Building: HP: 100 Armor: none + Wall: + CrushableBy: Wheel, Track FENC: Category: Defense @@ -833,6 +835,8 @@ FENC: Building: HP: 100 Armor: none + Wall: + CrushableBy: Track BRIK: Category: Defense @@ -858,14 +862,21 @@ CYCL: Armor: none RenderBuildingWall: DamageStates: 3 + Wall: + CrushableBy: Track + BARB: Inherits: ^Wall Building: HP: 100 Armor: none + Wall: + CrushableBy: Track WOOD: Inherits: ^Wall Building: HP: 100 - Armor: none \ No newline at end of file + Armor: none + Wall: + CrushableBy: Track