diff --git a/OpenRA.Mods.Common/Commands/ChatCommands.cs b/OpenRA.Mods.Common/Commands/ChatCommands.cs index eb4073f921..25e3594cbe 100644 --- a/OpenRA.Mods.Common/Commands/ChatCommands.cs +++ b/OpenRA.Mods.Common/Commands/ChatCommands.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Commands var command = Commands.FirstOrDefault(x => x.Key == name); if (command.Value != null) - command.Value.InvokeCommand(name.ToLowerInvariant(), message.Substring(1 + name.Length)); + command.Value.InvokeCommand(name.ToLowerInvariant(), message.Substring(1 + name.Length).Trim()); else Game.Debug("{0} is not a valid command.", name); diff --git a/OpenRA.Mods.Common/Commands/DevCommands.cs b/OpenRA.Mods.Common/Commands/DevCommands.cs index 57f2ef709f..3f9b259039 100644 --- a/OpenRA.Mods.Common/Commands/DevCommands.cs +++ b/OpenRA.Mods.Common/Commands/DevCommands.cs @@ -10,6 +10,7 @@ #endregion using System; +using System.Collections.Generic; using System.Globalization; using System.Linq; using OpenRA.Graphics; @@ -54,6 +55,8 @@ namespace OpenRA.Mods.Common.Commands register("crash", "crashes the game."); register("levelup", "adds a specified number of levels to the selected actors."); register("poweroutage", "causes owners of selected actors to have a 5 second power outage."); + register("kill", "kills selected actors."); + register("dispose", "disposes selected actors."); } public void InvokeCommand(string name, string arg) @@ -129,6 +132,36 @@ namespace OpenRA.Mods.Common.Commands foreach (var player in world.Selection.Actors.Select(a => a.Owner.PlayerActor).Distinct()) world.IssueOrder(new Order("PowerOutage", player, false) { ExtraData = 250 }); break; + + case "kill": + var args = arg.Split(' '); + var damageTypes = new HashSet(); + + foreach (var damageType in args) + damageTypes.Add(damageType); + + foreach (var actor in world.Selection.Actors) + { + if (actor.IsDead) + continue; + + var health = actor.TraitOrDefault(); + if (health != null) + health.InflictDamage(actor, actor, new Damage(health.HP, damageTypes), true); + } + + break; + + case "dispose": + foreach (var actor in world.Selection.Actors) + { + if (actor.Disposed) + continue; + + actor.Dispose(); + } + + break; } }