Add support for all rope coil types.

This commit is contained in:
Olink 2020-05-29 17:03:48 -04:00
parent 079541d4c9
commit 50337a1d2f
2 changed files with 20 additions and 6 deletions

View file

@ -295,14 +295,15 @@ namespace TShockAPI
{
args.Player.LastKilledProjectile = 0;
}
else if (editData == TileID.MysticSnakeRope)
else if (CoilTileIds.Contains(editData))
{
//projectile should be the same X coordinate as all tile places
if (!args.Player.RecentlyCreatedProjectiles.Any(p => Main.projectile[p.Index].type == ProjectileID.MysticSnakeCoil &&
Math.Abs((int)(Main.projectile[p.Index].position.X / 16f) - tileX) <= Math.Abs(Main.projectile[p.Index].velocity.X)))
if (!args.Player.RecentlyCreatedProjectiles.Any(p => GetDataHandlers.projectileCreatesTile.ContainsKey(Main.projectile[p.Index].type) &&
Math.Abs((int)(Main.projectile[p.Index].position.X / 16f) - tileX) <= Math.Abs(Main.projectile[p.Index].velocity.X) &&
GetDataHandlers.projectileCreatesTile[Main.projectile[p.Index].type] == editData))
{
TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (inconceivable mystic snake rope) {0} {1} {2}", args.Player.Name, action, editData);
Console.WriteLine("Bouncer / OnTileEdit rejected from (inconceivable mystic snake rope) {0} {1} {2}", args.Player.Name, action, editData);
TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (inconceivable rope coil) {0} {1} {2}", args.Player.Name, action, editData);
Console.WriteLine("Bouncer / OnTileEdit rejected from (inconceivable rope coil) {0} {1} {2}", args.Player.Name, action, editData);
args.Player.SendTileSquare(tileX, tileY, 1);
args.Handled = true;
return;