From e1aa43179b6a9031dd230988259d6a60251e7864 Mon Sep 17 00:00:00 2001 From: ricky Date: Fri, 17 Jun 2011 13:42:39 +1000 Subject: [PATCH] Added an optional bool arg to /butcher to toggle whether to kill friendly monsters (bunnies/goldfish). Default is killFriendly (/butcher false to save all goldfish and bunnies). --- TShockAPI/Commands.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index fdc5f67d..2a47663b 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -969,10 +969,14 @@ namespace TShockAPI private static void Butcher(CommandArgs args) { + bool killFriendly = true; + if (args.Parameters.Count == 1) + bool.TryParse(args.Parameters[0], out killFriendly); + int killcount = 0; for (int i = 0; i < Main.npc.Length; i++) { - if (!Main.npc[i].townNPC && Main.npc[i].active) + if ( Main.npc[i].active && !Main.npc[i].townNPC && (!Main.npc[i].friendly || killFriendly)) { TSPlayer.Server.StrikeNPC(i, 99999, 90f, 1); killcount++;