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).

This commit is contained in:
ricky 2011-06-17 13:42:39 +10:00
parent 4ac4571bb1
commit e1aa43179b

View file

@ -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++;