rules-based terrain cost, part 1
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
namespace OpenRA.Traits.Activities
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.GameRules;
|
||||
namespace OpenRA.Traits.Activities
|
||||
{
|
||||
class HeliLand : IActivity
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
namespace OpenRA.Traits.Activities
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
@@ -128,10 +129,7 @@ namespace OpenRA.Traits
|
||||
|
||||
public float GetCost(int2 p, UnitMovementType umt)
|
||||
{
|
||||
// just use the standard walkability from templates.ini. no hackery.
|
||||
|
||||
return TerrainCosts.Cost(umt,
|
||||
Templates[state].TerrainType[Tiles[p]]);
|
||||
return Rules.TerrainTypes[Templates[state].TerrainType[Tiles[p]]].GetCost(umt);
|
||||
}
|
||||
|
||||
static bool IsIntact(Bridge b)
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Traits.Activities;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.Traits.Activities;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
@@ -66,10 +67,7 @@ namespace OpenRA.Traits
|
||||
}
|
||||
|
||||
// HACK: This should make reference to an MCV actor, and use of its Mobile trait
|
||||
public UnitMovementType GetMovementType()
|
||||
{
|
||||
return UnitMovementType.Wheel;
|
||||
}
|
||||
public UnitMovementType GetMovementType() { return UnitMovementType.Wheel; }
|
||||
|
||||
public bool CanEnterCell(int2 a)
|
||||
{
|
||||
@@ -88,10 +86,10 @@ namespace OpenRA.Traits
|
||||
}
|
||||
|
||||
if (!crushable) return false;
|
||||
|
||||
|
||||
return self.World.Map.IsInMap(a.X, a.Y) &&
|
||||
TerrainCosts.Cost(GetMovementType(),
|
||||
self.World.TileSet.GetTerrainType(self.World.Map.MapTiles[a.X, a.Y])) < double.PositiveInfinity;
|
||||
Rules.TerrainTypes[self.World.TileSet.GetTerrainType(self.World.Map.MapTiles[a.X, a.Y])]
|
||||
.GetCost(GetMovementType()) < float.PositiveInfinity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
/*
|
||||
* Crates left to implement:
|
||||
@@ -75,24 +76,15 @@ namespace OpenRA.Traits
|
||||
n -= s.Second;
|
||||
}
|
||||
|
||||
public bool IsPathableCrush(UnitMovementType umt, Player player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsCrushableBy(UnitMovementType umt, Player player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public bool IsPathableCrush(UnitMovementType umt, Player player) { return true; }
|
||||
public bool IsCrushableBy(UnitMovementType umt, Player player) { return true; }
|
||||
|
||||
public IEnumerable<int2> OccupiedCells() { yield return self.Location; }
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (++ticks >= self.Info.Traits.Get<CrateInfo>().Lifetime * 25)
|
||||
{
|
||||
self.World.AddFrameEndTask(w => w.Remove(self));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
using System;
|
||||
using OpenRA.Traits.Activities;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
@@ -131,10 +132,10 @@ namespace OpenRA.Traits
|
||||
}
|
||||
|
||||
if (!crushable) return false;
|
||||
|
||||
|
||||
return self.World.Map.IsInMap(a.X, a.Y) &&
|
||||
TerrainCosts.Cost(GetMovementType(),
|
||||
self.World.TileSet.GetTerrainType(self.World.Map.MapTiles[a.X, a.Y])) < double.PositiveInfinity;
|
||||
Rules.TerrainTypes[self.World.TileSet.GetTerrainType(self.World.Map.MapTiles[a.X, a.Y])]
|
||||
.GetCost(GetMovementType()) < float.PositiveInfinity;
|
||||
}
|
||||
|
||||
public IEnumerable<int2> GetCurrentPath()
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits.Activities;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.GameRules;
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
class SquishByTankInfo : ITraitInfo
|
||||
|
||||
Reference in New Issue
Block a user