Use TPlayer.autoActuate instead of IEnumerable.Any()

This commit is contained in:
ProfessorXZ 2016-07-19 00:21:54 +02:00
parent ffa64e4474
commit f7a1b80337

View file

@ -2047,7 +2047,7 @@ namespace TShockAPI
} }
// Using the actuation accessory can lead to actuator hacking // 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.SendTileSquare(tileX, tileY, 1);
args.Player.SendErrorMessage("You do not have permission to place actuators."); args.Player.SendErrorMessage("You do not have permission to place actuators.");
@ -2110,8 +2110,7 @@ namespace TShockAPI
else if (action == EditAction.PlaceActuator) else if (action == EditAction.PlaceActuator)
{ {
// If they aren't selecting the actuator and don't have the Presserator equipped, they're hacking. // 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.TPlayer.autoActuator)
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); args.Player.SendTileSquare(tileX, tileY, 1);
return true; return true;