diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
index 97f8d3f8e2..c7c7b1f5b8 100644
--- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
+++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
@@ -270,6 +270,7 @@
+
diff --git a/OpenRA.Mods.RA/Traits/DemoTruck.cs b/OpenRA.Mods.Common/Traits/Attack/AttackSuicides.cs
similarity index 73%
rename from OpenRA.Mods.RA/Traits/DemoTruck.cs
rename to OpenRA.Mods.Common/Traits/Attack/AttackSuicides.cs
index 93eb4e0672..3674496e5e 100644
--- a/OpenRA.Mods.RA/Traits/DemoTruck.cs
+++ b/OpenRA.Mods.Common/Traits/Attack/AttackSuicides.cs
@@ -14,30 +14,27 @@ using OpenRA.Activities;
using OpenRA.Mods.Common;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Orders;
-using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
-namespace OpenRA.Mods.RA.Traits
+namespace OpenRA.Mods.Common.Traits
{
- class DemoTruckInfo : ITraitInfo, Requires
+ [Desc("Does a suicide attack where it moves next to the target when used in combination with `Explodes`.")]
+ class AttackSuicidesInfo : ITraitInfo, Requires
{
[VoiceReference] public readonly string Voice = "Action";
- public object Create(ActorInitializer init) { return new DemoTruck(init.Self, this); }
+ public object Create(ActorInitializer init) { return new AttackSuicides(init.Self, this); }
}
- class DemoTruck : IIssueOrder, IResolveOrder, IOrderVoice
+ class AttackSuicides : IIssueOrder, IResolveOrder, IOrderVoice
{
- readonly DemoTruckInfo info;
+ readonly AttackSuicidesInfo info;
+ readonly IMove move;
- public DemoTruck(Actor self, DemoTruckInfo info)
+ public AttackSuicides(Actor self, AttackSuicidesInfo info)
{
this.info = info;
- }
-
- static void Explode(Actor self)
- {
- self.World.AddFrameEndTask(w => self.InflictDamage(self, int.MaxValue, null));
+ move = self.Trait();
}
public IEnumerable Orders
@@ -77,11 +74,13 @@ namespace OpenRA.Mods.RA.Traits
self.CancelActivity();
self.SetTargetLine(target, Color.Red);
- self.QueueActivity(new MoveAdjacentTo(self, target));
- self.QueueActivity(new CallFunc(() => Explode(self)));
+
+ self.QueueActivity(move.MoveToTarget(self, target));
+
+ self.QueueActivity(new CallFunc(() => self.Kill(self)));
}
else if (order.OrderString == "Detonate")
- Explode(self);
+ self.Kill(self);
}
}
}
diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs
index 1cac280126..2ed1d10c62 100644
--- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs
+++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs
@@ -2883,6 +2883,12 @@ namespace OpenRA.Mods.Common.UtilityCommands
node.Key = "WithDockedOverlay" + node.Key.Substring(18);
}
+ if (engineVersion < 20160116)
+ {
+ if (node.Key == "DemoTruck")
+ node.Key = "AttackSuicides";
+ }
+
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
}
}
diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
index 938442d852..b0998d18f0 100644
--- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
+++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
@@ -89,7 +89,6 @@
-
diff --git a/mods/ra/maps/drop-zone-battle-of-tikiaki/map.yaml b/mods/ra/maps/drop-zone-battle-of-tikiaki/map.yaml
index 213e0d86e6..50977b74aa 100644
--- a/mods/ra/maps/drop-zone-battle-of-tikiaki/map.yaml
+++ b/mods/ra/maps/drop-zone-battle-of-tikiaki/map.yaml
@@ -344,7 +344,7 @@ Rules:
Explodes:
Weapon: CrateNuke
EmptyWeapon: CrateNuke
- DemoTruck:
+ AttackSuicides:
SHOK:
Health:
HP: 800
diff --git a/mods/ra/maps/drop-zone/map.yaml b/mods/ra/maps/drop-zone/map.yaml
index c6da957031..02a4c9dbc7 100644
--- a/mods/ra/maps/drop-zone/map.yaml
+++ b/mods/ra/maps/drop-zone/map.yaml
@@ -239,7 +239,7 @@ Rules:
Explodes:
Weapon: CrateNuke
EmptyWeapon: CrateNuke
- DemoTruck:
+ AttackSuicides:
SHOK:
Health:
HP: 800
diff --git a/mods/ra/rules/vehicles.yaml b/mods/ra/rules/vehicles.yaml
index 14bd354267..6361c88fd5 100644
--- a/mods/ra/rules/vehicles.yaml
+++ b/mods/ra/rules/vehicles.yaml
@@ -643,7 +643,7 @@ DTRK:
Explodes:
Weapon: MiniNuke
EmptyWeapon: MiniNuke
- DemoTruck:
+ AttackSuicides:
-DamageMultiplier@IRONCURTAIN:
KillsSelf:
UpgradeTypes: invulnerability
diff --git a/mods/ts/rules/aircraft.yaml b/mods/ts/rules/aircraft.yaml
index 02d6fdd1ac..2ae9fad314 100644
--- a/mods/ts/rules/aircraft.yaml
+++ b/mods/ts/rules/aircraft.yaml
@@ -324,7 +324,7 @@ HUNTER:
HP: 500
Armor:
Type: Light
- DemoTruck:
+ AttackSuicides:
Explodes:
Weapon: SuicideBomb
EmptyWeapon: SuicideBomb