From 93977782a74b4ff3c694d8e3bffe4f7a3a20532a Mon Sep 17 00:00:00 2001 From: Ectras <40306539+Ectras@users.noreply.github.com> Date: Mon, 15 Oct 2018 23:00:15 +0200 Subject: [PATCH] Updated Description for TerrainSpeeds Added check for speed > 0 --- OpenRA.Mods.Common/Traits/World/Locomotor.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/World/Locomotor.cs b/OpenRA.Mods.Common/Traits/World/Locomotor.cs index bfb48f68fb..b41ff42313 100644 --- a/OpenRA.Mods.Common/Traits/World/Locomotor.cs +++ b/OpenRA.Mods.Common/Traits/World/Locomotor.cs @@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits public readonly BitSet CrushDamageTypes = default(BitSet); [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 TerrainSpeeds; protected static object LoadSpeeds(MiniYaml y) @@ -75,11 +75,14 @@ namespace OpenRA.Mods.Common.Traits foreach (var t in y.ToDictionary()["TerrainSpeeds"].Nodes) { var speed = FieldLoader.GetValue("speed", t.Value.Value); - var nodesDict = t.Value.ToDictionary(); - var cost = nodesDict.ContainsKey("PathingCost") - ? FieldLoader.GetValue("cost", nodesDict["PathingCost"].Value) - : 10000 / speed; - ret.Add(t.Key, new TerrainInfo(speed, cost)); + if (speed > 0) + { + var nodesDict = t.Value.ToDictionary(); + var cost = nodesDict.ContainsKey("PathingCost") + ? FieldLoader.GetValue("cost", nodesDict["PathingCost"].Value) + : 10000 / speed; + ret.Add(t.Key, new TerrainInfo(speed, cost)); + } } return ret;