Updated Description for TerrainSpeeds
Added check for speed > 0
This commit is contained in:
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public readonly BitSet<DamageType> CrushDamageTypes = default(BitSet<DamageType>);
|
public readonly BitSet<DamageType> CrushDamageTypes = default(BitSet<DamageType>);
|
||||||
|
|
||||||
[FieldLoader.LoadUsing("LoadSpeeds", true)]
|
[FieldLoader.LoadUsing("LoadSpeeds", true)]
|
||||||
[Desc("Set Water: 0 for ground units and lower the value on rough terrain.")]
|
[Desc("Lower the value on rough terrain. Leave out entries for impassable terrain.")]
|
||||||
public readonly Dictionary<string, TerrainInfo> TerrainSpeeds;
|
public readonly Dictionary<string, TerrainInfo> TerrainSpeeds;
|
||||||
|
|
||||||
protected static object LoadSpeeds(MiniYaml y)
|
protected static object LoadSpeeds(MiniYaml y)
|
||||||
@@ -75,11 +75,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
foreach (var t in y.ToDictionary()["TerrainSpeeds"].Nodes)
|
foreach (var t in y.ToDictionary()["TerrainSpeeds"].Nodes)
|
||||||
{
|
{
|
||||||
var speed = FieldLoader.GetValue<int>("speed", t.Value.Value);
|
var speed = FieldLoader.GetValue<int>("speed", t.Value.Value);
|
||||||
var nodesDict = t.Value.ToDictionary();
|
if (speed > 0)
|
||||||
var cost = nodesDict.ContainsKey("PathingCost")
|
{
|
||||||
? FieldLoader.GetValue<int>("cost", nodesDict["PathingCost"].Value)
|
var nodesDict = t.Value.ToDictionary();
|
||||||
: 10000 / speed;
|
var cost = nodesDict.ContainsKey("PathingCost")
|
||||||
ret.Add(t.Key, new TerrainInfo(speed, cost));
|
? FieldLoader.GetValue<int>("cost", nodesDict["PathingCost"].Value)
|
||||||
|
: 10000 / speed;
|
||||||
|
ret.Add(t.Key, new TerrainInfo(speed, cost));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user