Prevent tile changes from 1 second after an explosive is thrown.
This commit is contained in:
parent
1f7d3eb5e6
commit
4043b660f5
2 changed files with 9 additions and 2 deletions
|
|
@ -251,6 +251,13 @@ namespace TShockAPI
|
||||||
if (!args.Player.TilesDestroyed.ContainsKey(coords))
|
if (!args.Player.TilesDestroyed.ContainsKey(coords))
|
||||||
args.Player.TilesDestroyed.Add(coords, Main.tile[x, y]);
|
args.Player.TilesDestroyed.Add(coords, Main.tile[x, y]);
|
||||||
}
|
}
|
||||||
|
if (args.Player.LastExplosive != null)
|
||||||
|
if ((DateTime.UtcNow - args.Player.LastExplosive).TotalMilliseconds < 1000)
|
||||||
|
{
|
||||||
|
args.Player.SendMessage("Please wait another " + (1000 - (DateTime.UtcNow - args.Player.LastExplosive).TotalMilliseconds).ToString() + " milliseconds before placing/destroying tiles", Color.Red);
|
||||||
|
args.Player.SendTileSquare(x, y);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -320,11 +327,10 @@ namespace TShockAPI
|
||||||
Log.Debug(string.Format("Explosive(PlyXY:{0}_{1}, Type:{2})", args.Player.TileX, args.Player.TileY, type));
|
Log.Debug(string.Format("Explosive(PlyXY:{0}_{1}, Type:{2})", args.Player.TileX, args.Player.TileY, type));
|
||||||
if (ConfigurationManager.DisableBoom && (!args.Player.Group.HasPermission("useexplosives") || !args.Player.Group.HasPermission("ignoregriefdetection")))
|
if (ConfigurationManager.DisableBoom && (!args.Player.Group.HasPermission("useexplosives") || !args.Player.Group.HasPermission("ignoregriefdetection")))
|
||||||
{
|
{
|
||||||
//Lag will still allow the projectile to detonate.
|
|
||||||
//TODO: Stop KillTile for x period of time after projectile packet is received.
|
|
||||||
Main.projectile[ident].type = 0;
|
Main.projectile[ident].type = 0;
|
||||||
NetMessage.SendData((int)PacketTypes.ProjectileNew, args.Player.Index, -1, "", ident);
|
NetMessage.SendData((int)PacketTypes.ProjectileNew, args.Player.Index, -1, "", ident);
|
||||||
args.Player.SendMessage("Explosives are disabled!", Color.Red);
|
args.Player.SendMessage("Explosives are disabled!", Color.Red);
|
||||||
|
args.Player.LastExplosive = DateTime.UtcNow;
|
||||||
//return true;
|
//return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ namespace TShockAPI
|
||||||
public int Index { get; protected set; }
|
public int Index { get; protected set; }
|
||||||
public DateTime LastPvpChange { get; protected set; }
|
public DateTime LastPvpChange { get; protected set; }
|
||||||
public Rectangle TempArea = new Rectangle();
|
public Rectangle TempArea = new Rectangle();
|
||||||
|
public DateTime LastExplosive { get; set; }
|
||||||
|
|
||||||
public bool RealPlayer
|
public bool RealPlayer
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue