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:
parent
4ac4571bb1
commit
e1aa43179b
1 changed files with 5 additions and 1 deletions
|
|
@ -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++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue