diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
index 706fd30499..44ee1075e0 100644
--- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
+++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
@@ -488,7 +488,8 @@
-
+
+
@@ -723,4 +724,4 @@ cd "$(SolutionDir)"
-->
-
\ No newline at end of file
+
diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs
index d0cc2dfe45..fb3e763aee 100644
--- a/OpenRA.Mods.Common/Traits/Mobile.cs
+++ b/OpenRA.Mods.Common/Traits/Mobile.cs
@@ -692,12 +692,14 @@ namespace OpenRA.Mods.Common.Traits
{
readonly MobileInfo unitType;
readonly bool rejectMove;
+ readonly IDisableMove[] moveDisablers;
public bool OverrideSelection { get { return false; } }
public MoveOrderTargeter(Actor self, MobileInfo unitType)
{
this.unitType = unitType;
rejectMove = !self.AcceptsOrder("Move");
+ moveDisablers = self.TraitsImplementing().ToArray();
}
public string OrderID { get { return "Move"; } }
@@ -716,7 +718,9 @@ namespace OpenRA.Mods.Common.Traits
cursor = self.World.Map.Contains(location) ?
(self.World.Map.GetTerrainInfo(location).CustomCursor ?? unitType.Cursor) : unitType.BlockedCursor;
- if ((!explored && !unitType.MoveIntoShroud) || (explored && unitType.MovementCostForCell(self.World, location) == int.MaxValue))
+ if ((!explored && !unitType.MoveIntoShroud)
+ || (explored && unitType.MovementCostForCell(self.World, location) == int.MaxValue)
+ || moveDisablers.Any(d => d.MoveDisabled(self)))
cursor = unitType.BlockedCursor;
return true;
diff --git a/OpenRA.Mods.Common/Traits/Upgrades/DisableMovementOnUpgrade.cs b/OpenRA.Mods.Common/Traits/Upgrades/DisableMovementOnUpgrade.cs
new file mode 100644
index 0000000000..7d92a4f600
--- /dev/null
+++ b/OpenRA.Mods.Common/Traits/Upgrades/DisableMovementOnUpgrade.cs
@@ -0,0 +1,28 @@
+#region Copyright & License Information
+/*
+ * Copyright 2007-2015 The OpenRA Developers (see AUTHORS)
+ * This file is part of OpenRA, which is free software. It is made
+ * available to you under the terms of the GNU General Public License
+ * as published by the Free Software Foundation. For more information,
+ * see COPYING.
+ */
+#endregion
+
+using OpenRA.Traits;
+
+namespace OpenRA.Mods.Common.Traits
+{
+ [Desc("Disable the ability to move and turn of the actor when this trait is enabled by an upgrade.")]
+ public class DisableMovementInfo : UpgradableTraitInfo
+ {
+ public override object Create(ActorInitializer init) { return new DisableMovementOnUpgrade(this); }
+ }
+
+ public class DisableMovementOnUpgrade : UpgradableTrait, IDisableMove
+ {
+ public DisableMovementOnUpgrade(DisableMovementInfo info)
+ : base(info) { }
+
+ public bool MoveDisabled(Actor self) { return !IsTraitDisabled; }
+ }
+}
diff --git a/OpenRA.Mods.Common/Traits/Upgrades/DisableUpgrade.cs b/OpenRA.Mods.Common/Traits/Upgrades/DisableOnUpgrade.cs
similarity index 74%
rename from OpenRA.Mods.Common/Traits/Upgrades/DisableUpgrade.cs
rename to OpenRA.Mods.Common/Traits/Upgrades/DisableOnUpgrade.cs
index b02beb2978..c2a917ec3e 100644
--- a/OpenRA.Mods.Common/Traits/Upgrades/DisableUpgrade.cs
+++ b/OpenRA.Mods.Common/Traits/Upgrades/DisableOnUpgrade.cs
@@ -13,14 +13,14 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Disable the actor when this trait is enabled by an upgrade.")]
- public class DisableUpgradeInfo : UpgradableTraitInfo
+ public class DisableOnUpgradeInfo : UpgradableTraitInfo
{
- public override object Create(ActorInitializer init) { return new DisableUpgrade(this); }
+ public override object Create(ActorInitializer init) { return new DisableOnUpgrade(this); }
}
- public class DisableUpgrade : UpgradableTrait, IDisable, IDisableMove
+ public class DisableOnUpgrade : UpgradableTrait, IDisable, IDisableMove
{
- public DisableUpgrade(DisableUpgradeInfo info)
+ public DisableOnUpgrade(DisableOnUpgradeInfo info)
: base(info) { }
public bool Disabled { get { return !IsTraitDisabled; } }
diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs
index 0eb364fba4..9b6c7461d0 100644
--- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs
+++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs
@@ -2741,6 +2741,12 @@ namespace OpenRA.Mods.Common.UtilityCommands
node.Value.Value = RenameD2kActors(node.Value.Value);
}
+ if (engineVersion < 20150925)
+ {
+ if (node.Key == "DisableUpgrade")
+ node.Key = "DisableOnUpgrade";
+ }
+
UpgradeActors(engineVersion, ref node.Value.Nodes, node, depth + 1);
}
}
diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml
index e19d4f97aa..6aa7f72081 100644
--- a/mods/ts/rules/defaults.yaml
+++ b/mods/ts/rules/defaults.yaml
@@ -54,7 +54,7 @@
UpgradeTypes: empdisable
UpgradeMinEnabledLevel: 1
Palette: disabled
- DisableUpgrade@EMPDISABLE:
+ DisableOnUpgrade@EMPDISABLE:
UpgradeTypes: empdisable
UpgradeMinEnabledLevel: 1
TimedUpgradeBar@EMPDISABLE:
diff --git a/mods/ts/rules/shared-vehicles.yaml b/mods/ts/rules/shared-vehicles.yaml
index db55a596f2..01256b59f0 100644
--- a/mods/ts/rules/shared-vehicles.yaml
+++ b/mods/ts/rules/shared-vehicles.yaml
@@ -140,7 +140,7 @@ LPST:
StartSequence: make
UpgradeTypes: deployed
UpgradeMinEnabledLevel: 1
- DisableUpgrade:
+ DisableOnUpgrade:
UpgradeTypes: deployed
UpgradeMinEnabledLevel: 1
DetectCloaked: