From 23991600b62e204cdbf838d48a2c127edb8fe694 Mon Sep 17 00:00:00 2001 From: ProfessorXZ Date: Mon, 18 Jul 2016 23:33:44 +0200 Subject: [PATCH 1/3] Fixes The Presserator not placing actuators --- TShockAPI/GetDataHandlers.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index cd398d9c..23051601 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2101,8 +2101,9 @@ namespace TShockAPI } else if (action == EditAction.PlaceActuator) { - // If they aren't selecting the actuator, they're hacking. - if (selectedItem.type != ItemID.Actuator) + // If they aren't selecting the actuator and don't have the Presserator equipped, they're hacking. + // ActuationAccessorry = The Presserator + if (selectedItem.type != ItemID.Actuator && !args.Player.Accessories.Any(accessory => accessory.type == ItemID.ActuationAccessory)) { args.Player.SendTileSquare(tileX, tileY, 1); return true; From ffa64e4474e5dbd8c2c358bf7b018afbfd759c4b Mon Sep 17 00:00:00 2001 From: ProfessorXZ Date: Tue, 19 Jul 2016 00:02:52 +0200 Subject: [PATCH 2/3] Fixes #1241 --- TShockAPI/GetDataHandlers.cs | 12 ++++++++++-- TShockAPI/TShock.cs | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 23051601..6d64915b 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2045,6 +2045,14 @@ namespace TShockAPI args.Player.SendTileSquare(tileX, tileY, 4); return true; } + + // Using the actuation accessory can lead to actuator hacking + if (TShock.Itembans.ItemIsBanned("Actuator", args.Player) && args.Player.Accessories.Any(accessory => accessory != null && accessory.stack > 0 && accessory.type == ItemID.ActuationAccessory)) + { + args.Player.SendTileSquare(tileX, tileY, 1); + args.Player.SendErrorMessage("You do not have permission to place actuators."); + return true; + } if (TShock.Itembans.ItemIsBanned(selectedItem.name, args.Player) || editData >= (action == EditAction.PlaceTile ? Main.maxTileSets : Main.maxWallTypes)) { args.Player.SendTileSquare(tileX, tileY, 4); @@ -2102,8 +2110,8 @@ namespace TShockAPI else if (action == EditAction.PlaceActuator) { // If they aren't selecting the actuator and don't have the Presserator equipped, they're hacking. - // ActuationAccessorry = The Presserator - if (selectedItem.type != ItemID.Actuator && !args.Player.Accessories.Any(accessory => accessory.type == ItemID.ActuationAccessory)) + // ActuationAccessory = The Presserator + if (selectedItem.type != ItemID.Actuator && !args.Player.Accessories.Any(accessory => accessory != null && accessory.stack > 0 && accessory.type == ItemID.ActuationAccessory)) { args.Player.SendTileSquare(tileX, tileY, 1); return true; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 88e236d5..0b49203a 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1341,7 +1341,7 @@ namespace TShockAPI } catch (Exception ex) { - Log.ConsoleError("An exeption occurred executing a command."); + Log.ConsoleError("An exception occurred executing a command."); Log.Error(ex.ToString()); } } From f7a1b80337b340270df119dfd11f791c95550c49 Mon Sep 17 00:00:00 2001 From: ProfessorXZ Date: Tue, 19 Jul 2016 00:21:54 +0200 Subject: [PATCH 3/3] Use TPlayer.autoActuate instead of IEnumerable.Any() --- TShockAPI/GetDataHandlers.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 6d64915b..146bea59 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2047,7 +2047,7 @@ namespace TShockAPI } // Using the actuation accessory can lead to actuator hacking - if (TShock.Itembans.ItemIsBanned("Actuator", args.Player) && args.Player.Accessories.Any(accessory => accessory != null && accessory.stack > 0 && accessory.type == ItemID.ActuationAccessory)) + if (TShock.Itembans.ItemIsBanned("Actuator", args.Player) && args.Player.TPlayer.autoActuator) { args.Player.SendTileSquare(tileX, tileY, 1); args.Player.SendErrorMessage("You do not have permission to place actuators."); @@ -2110,8 +2110,7 @@ namespace TShockAPI else if (action == EditAction.PlaceActuator) { // If they aren't selecting the actuator and don't have the Presserator equipped, they're hacking. - // ActuationAccessory = The Presserator - if (selectedItem.type != ItemID.Actuator && !args.Player.Accessories.Any(accessory => accessory != null && accessory.stack > 0 && accessory.type == ItemID.ActuationAccessory)) + if (selectedItem.type != ItemID.Actuator && !args.Player.TPlayer.autoActuator) { args.Player.SendTileSquare(tileX, tileY, 1); return true;