Added a check to see if player has recently lit a fuse
This will prevent cheat detection from wrongly triggering if the player uses a fused explosive and quickly switches to another weapon before the explosive detonates. I also commented out a block where we force explosives server-side, this would usually cause dynamite to explode in the wrong position when it bounced around too much.
This commit is contained in:
parent
6e29a3b0ca
commit
584950bc6f
3 changed files with 19 additions and 8 deletions
|
|
@ -1796,19 +1796,19 @@ namespace TShockAPI
|
|||
if (type == 0 && Main.tile[tileX, tileY].type != 127 && !Main.tileCut[Main.tile[tileX, tileY].type] && !rightClickKill.Contains(Main.tile[tileX, tileY].type))
|
||||
{
|
||||
// If the tile is an axe tile and they aren't selecting an axe, they're hacking.
|
||||
if (Main.tileAxe[Main.tile[tileX, tileY].type] && (selectedItem.axe == 0 && selectedItem.explosive == 0))
|
||||
if (Main.tileAxe[Main.tile[tileX, tileY].type] && (selectedItem.axe == 0 && selectedItem.explosive == 0 && args.Player.RecentFuse == 0))
|
||||
{
|
||||
args.Player.SendTileSquare(tileX, tileY);
|
||||
return true;
|
||||
}
|
||||
// If the tile is a hammer tile and they aren't selecting an hammer, they're hacking.
|
||||
else if (Main.tileHammer[Main.tile[tileX, tileY].type] && (selectedItem.hammer == 0 && selectedItem.explosive == 0))
|
||||
else if (Main.tileHammer[Main.tile[tileX, tileY].type] && (selectedItem.hammer == 0 && selectedItem.explosive == 0 && args.Player.RecentFuse == 0))
|
||||
{
|
||||
args.Player.SendTileSquare(tileX, tileY);
|
||||
return true;
|
||||
}
|
||||
// If the tile is a pickaxe tile and they aren't selecting an pickaxe, they're hacking.
|
||||
else if ((!Main.tileAxe[Main.tile[tileX, tileY].type] && !Main.tileHammer[Main.tile[tileX, tileY].type]) && (selectedItem.pick == 0 && selectedItem.explosive == 0))
|
||||
else if ((!Main.tileAxe[Main.tile[tileX, tileY].type] && !Main.tileHammer[Main.tile[tileX, tileY].type]) && (selectedItem.pick == 0 && selectedItem.explosive == 0 && args.Player.RecentFuse == 0))
|
||||
{
|
||||
args.Player.SendTileSquare(tileX, tileY);
|
||||
|
||||
|
|
@ -1818,7 +1818,7 @@ namespace TShockAPI
|
|||
else if (action == EditAction.KillWall)
|
||||
{
|
||||
// If they aren't selecting an hammer, they're hacking.
|
||||
if (selectedItem.hammer == 0 && selectedItem.explosive == 0)
|
||||
if (selectedItem.hammer == 0 && selectedItem.explosive == 0 && args.Player.RecentFuse == 0)
|
||||
{
|
||||
args.Player.SendTileSquare(tileX, tileY);
|
||||
return true;
|
||||
|
|
@ -2246,12 +2246,14 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
// force all explosives server-side.
|
||||
// force all explosives server-side. -- DOES NOT WORK DUE TO LATENCY
|
||||
if (hasPermission && (type == 28 || type == 29 || type == 37))
|
||||
{
|
||||
args.Player.RemoveProjectile(ident, owner);
|
||||
Projectile.NewProjectile(pos.X, pos.Y, vel.X, vel.Y, type, dmg, knockback);
|
||||
return true;
|
||||
// Denotes that the player has recently set a fuse - used for cheat detection.
|
||||
args.Player.RecentFuse = 10;
|
||||
// args.Player.RemoveProjectile(ident, owner);
|
||||
// Projectile.NewProjectile(pos.X, pos.Y, vel.X, vel.Y, type, dmg, knockback);
|
||||
// return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,11 @@ namespace TShockAPI
|
|||
/// The number of projectiles created by the player in the last second.
|
||||
/// </summary>
|
||||
public int ProjectileThreshold { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A timer to keep track of whether or not the player has recently thrown an explosive
|
||||
// </summary>
|
||||
public int RecentFuse = 0;
|
||||
|
||||
/// <summary>
|
||||
/// A queue of tiles destroyed by the player for reverting.
|
||||
|
|
|
|||
|
|
@ -672,6 +672,10 @@ namespace TShockAPI
|
|||
{
|
||||
player.TilePlaceThreshold = 0;
|
||||
}
|
||||
|
||||
if (player.RecentFuse >0)
|
||||
player.RecentFuse--;
|
||||
|
||||
if (player.TileLiquidThreshold >= Config.TileLiquidThreshold)
|
||||
{
|
||||
player.Disable("Reached TileLiquid threshold.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue