From fde99208f5ccad74f9931ab2f0330ce17a2d0098 Mon Sep 17 00:00:00 2001 From: MarioE Date: Wed, 20 Nov 2013 17:52:50 -0500 Subject: [PATCH] Don't allow breaking right-clickable tiles, fix /item and /give logic --- TShockAPI/Commands.cs | 8 ++++---- TShockAPI/GetDataHandlers.cs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index e8007ff4..f30ba1ff 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -4202,7 +4202,7 @@ namespace TShockAPI } } - if (args.Player.InventorySlotAvailable || (item.name.Contains("Coin") && item.type != 905) || item.type == 58 || item.type == 184) + if (args.Player.InventorySlotAvailable || (item.type > 70 && item.type < 75) || item.ammo > 0 || item.type == 58 || item.type == 184) { if (itemAmount == 0 || itemAmount > item.maxStack) itemAmount = item.maxStack; @@ -4214,7 +4214,7 @@ namespace TShockAPI } else { - args.Player.SendErrorMessage("The item is banned and the config prevents you from spawning banned items."); + args.Player.SendErrorMessage("You cannot spawn banned items."); } } else @@ -4282,7 +4282,7 @@ namespace TShockAPI else { var plr = players[0]; - if (plr.InventorySlotAvailable || (item.name.Contains("Coin") && item.type != 905) || item.type == 58 || item.type == 184) + if (plr.InventorySlotAvailable || (item.type > 70 && item.type < 75) || item.ammo > 0 || item.type == 58 || item.type == 184) { if (itemAmount == 0 || itemAmount > item.maxStack) itemAmount = item.maxStack; @@ -4293,7 +4293,7 @@ namespace TShockAPI } else { - args.Player.SendErrorMessage("The item is banned and the config prevents spawning banned items."); + args.Player.SendErrorMessage("You cannot spawn banned items."); } } diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 73fc6df0..e7ff8a8f 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1870,7 +1870,7 @@ namespace TShockAPI Item selectedItem = args.Player.SelectedItem; int lastKilledProj = args.Player.LastKilledProjectile; - if (action == EditAction.KillTile && !Main.tileCut[Main.tile[tileX, tileY].type] && !breakableTiles.Contains(Main.tile[tileX, tileY].type)) + if (action == EditAction.KillTile && !Main.tileCut[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 && args.Player.RecentFuse == 0)) @@ -1984,7 +1984,7 @@ namespace TShockAPI } } - if (TShock.Config.AllowCutTilesAndBreakables && (Main.tileCut[Main.tile[tileX, tileY].type] || breakableTiles.Contains(Main.tile[tileX, tileY].type))) + if (TShock.Config.AllowCutTilesAndBreakables && Main.tileCut[Main.tile[tileX, tileY].type]) { return false; }