crushable walls
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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<LineBuild>
|
||||
{
|
||||
public readonly int Range = 5;
|
||||
}
|
||||
|
||||
public class LineBuild {}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
|
||||
@@ -18,8 +18,39 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
public class WallInfo : TraitInfo<Wall> {}
|
||||
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<UnitInfluence>().Add(self, this);
|
||||
}
|
||||
|
||||
public IEnumerable<int2> 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<WallInfo>().CrushableBy.Contains(umt);
|
||||
}
|
||||
|
||||
public bool IsPathableCrush(UnitMovementType umt, Player player)
|
||||
{
|
||||
return IsCrushableBy(umt, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -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<ResourceLayer>();
|
||||
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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
Armor: none
|
||||
Wall:
|
||||
CrushableBy: Track
|
||||
|
||||
Reference in New Issue
Block a user