Added /clear npc (/butcher without item drops)
This commit is contained in:
parent
4bd522f1db
commit
acfc770c8a
1 changed files with 26 additions and 3 deletions
|
|
@ -1836,8 +1836,8 @@ namespace TShockAPI
|
||||||
var plr = players[0];
|
var plr = players[0];
|
||||||
if (plr.Teleport(args.Player.TileX*16, args.Player.TileY*16 ))
|
if (plr.Teleport(args.Player.TileX*16, args.Player.TileY*16 ))
|
||||||
{
|
{
|
||||||
plr.SendInfoMessage(string.Format("You were teleported to {0}.", args.Player.Name));
|
plr.SendInfoMessage("You were teleported to {0}.", args.Player.Name);
|
||||||
args.Player.SendSuccessMessage(string.Format("You brought {0} here.", plr.Name));
|
args.Player.SendSuccessMessage("You teleported {0} here.", plr.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3795,7 +3795,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
if (args.Parameters.Count != 1 && args.Parameters.Count != 2)
|
if (args.Parameters.Count != 1 && args.Parameters.Count != 2)
|
||||||
{
|
{
|
||||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /clear <item/projectile> [radius]");
|
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /clear <item/npc/projectile> [radius]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3830,6 +3830,26 @@ namespace TShockAPI
|
||||||
args.Player.SendSuccessMessage("Deleted {0} items within a radius of {1}.", cleared, radius);
|
args.Player.SendSuccessMessage("Deleted {0} items within a radius of {1}.", cleared, radius);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "npc":
|
||||||
|
case "npcs":
|
||||||
|
{
|
||||||
|
int cleared = 0;
|
||||||
|
for (int i = 0; i < Main.maxNPCs; i++)
|
||||||
|
{
|
||||||
|
float dX = Main.npc[i].position.X - args.Player.X;
|
||||||
|
float dY = Main.npc[i].position.Y - args.Player.Y;
|
||||||
|
|
||||||
|
if (Main.npc[i].active && dX * dX + dY * dY <= radius * radius * 256f)
|
||||||
|
{
|
||||||
|
Main.npc[i].active = false;
|
||||||
|
Main.npc[i].type = 0;
|
||||||
|
TSPlayer.All.SendData(PacketTypes.NpcUpdate, "", i);
|
||||||
|
cleared++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args.Player.SendSuccessMessage("Deleted {0} NPCs within a radius of {1}.", cleared, radius);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "proj":
|
case "proj":
|
||||||
case "projectile":
|
case "projectile":
|
||||||
case "projectiles":
|
case "projectiles":
|
||||||
|
|
@ -3851,6 +3871,9 @@ namespace TShockAPI
|
||||||
args.Player.SendSuccessMessage("Deleted {0} projectiles within a radius of {1}.", cleared, radius);
|
args.Player.SendSuccessMessage("Deleted {0} projectiles within a radius of {1}.", cleared, radius);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
args.Player.SendErrorMessage("Invalid clear option!");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue