Bounce infinite or NaN velocity / position
This commit is contained in:
parent
e4e28cb1b5
commit
2053213558
1 changed files with 40 additions and 0 deletions
|
|
@ -504,6 +504,14 @@ namespace TShockAPI
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!float.IsFinite(pos.X) || !float.IsFinite(pos.Y))
|
||||||
|
{
|
||||||
|
TShock.Log.ConsoleInfo(GetString("Bouncer / OnPlayerUpdate force kicked (attempted to set position to infinity or NaN) from {0}", args.Player.Name));
|
||||||
|
args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true);
|
||||||
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pos.X < 0 || pos.Y < 0 || pos.X >= Main.maxTilesX * 16 - 16 || pos.Y >= Main.maxTilesY * 16 - 16)
|
if (pos.X < 0 || pos.Y < 0 || pos.X >= Main.maxTilesX * 16 - 16 || pos.Y >= Main.maxTilesY * 16 - 16)
|
||||||
{
|
{
|
||||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerUpdate rejected from (position check) {0}", args.Player.Name));
|
TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerUpdate rejected from (position check) {0}", args.Player.Name));
|
||||||
|
|
@ -1072,6 +1080,22 @@ namespace TShockAPI
|
||||||
bool noDelay = args.NoDelay;
|
bool noDelay = args.NoDelay;
|
||||||
short type = args.Type;
|
short type = args.Type;
|
||||||
|
|
||||||
|
if (!float.IsFinite(pos.X) || !float.IsFinite(pos.Y))
|
||||||
|
{
|
||||||
|
TShock.Log.ConsoleInfo(GetString("Bouncer / OnItemDrop force kicked (attempted to set position to infinity or NaN) from {0}", args.Player.Name));
|
||||||
|
args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true);
|
||||||
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!float.IsFinite(vel.X) || !float.IsFinite(vel.Y))
|
||||||
|
{
|
||||||
|
TShock.Log.ConsoleInfo(GetString("Bouncer / OnItemDrop force kicked (attempted to set velocity to infinity or NaN) from {0}", args.Player.Name));
|
||||||
|
args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true);
|
||||||
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// player is attempting to crash clients
|
// player is attempting to crash clients
|
||||||
if (type < -48 || type >= Terraria.ID.ItemID.Count)
|
if (type < -48 || type >= Terraria.ID.ItemID.Count)
|
||||||
{
|
{
|
||||||
|
|
@ -1175,6 +1199,22 @@ namespace TShockAPI
|
||||||
int index = args.Index;
|
int index = args.Index;
|
||||||
float[] ai = args.Ai;
|
float[] ai = args.Ai;
|
||||||
|
|
||||||
|
if (!float.IsFinite(pos.X) || !float.IsFinite(pos.Y))
|
||||||
|
{
|
||||||
|
TShock.Log.ConsoleInfo(GetString("Bouncer / OnNewProjectile force kicked (attempted to set position to infinity or NaN) from {0}", args.Player.Name));
|
||||||
|
args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true);
|
||||||
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!float.IsFinite(vel.X) || !float.IsFinite(vel.Y))
|
||||||
|
{
|
||||||
|
TShock.Log.ConsoleInfo(GetString("Bouncer / OnNewProjectile force kicked (attempted to set velocity to infinity or NaN) from {0}", args.Player.Name));
|
||||||
|
args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true);
|
||||||
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (index > Main.maxProjectiles)
|
if (index > Main.maxProjectiles)
|
||||||
{
|
{
|
||||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from above projectile limit from {0}", args.Player.Name));
|
TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from above projectile limit from {0}", args.Player.Name));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue