Add some more hacking checks

This commit is contained in:
MarioE 2013-11-07 23:13:41 -05:00
parent 8c3ae80184
commit 1a242bca6b
2 changed files with 40 additions and 12 deletions

View file

@ -1742,7 +1742,14 @@ namespace TShockAPI
KillTileNoItem,
PlaceWire,
KillWire,
PoundTile
PoundTile,
PlaceActuator,
KillActuator,
PlaceWire2,
KillWire2,
PlaceWire3,
KillWire3,
SlopeTile
}
public enum EditType
{
@ -1927,19 +1934,38 @@ namespace TShockAPI
}
}
}
else if (action == EditAction.PlaceWire)
else if (action == EditAction.PlaceWire || action == EditAction.PlaceWire2 || action == EditAction.PlaceWire3)
{
// If they aren't selecting the wrench, they're hacking.
if (args.TPlayer.inventory[args.TPlayer.selectedItem].type != 509)
// If they aren't selecting a wrench, they're hacking.
if (selectedItem.type != 509 && selectedItem.type != 850 && selectedItem.type != 851)
{
args.Player.SendTileSquare(tileX, tileY, 1);
return true;
}
}
else if (action == EditAction.KillWire)
else if (action == EditAction.KillActuator || action == EditAction.KillWire ||
action == EditAction.KillWire2 || action == EditAction.KillWire3)
{
// If they aren't selecting the wire cutter, they're hacking.
if (args.TPlayer.inventory[args.TPlayer.selectedItem].type != 510)
if (selectedItem.type != 510)
{
args.Player.SendTileSquare(tileX, tileY, 1);
return true;
}
}
else if (action == EditAction.PlaceActuator)
{
// If they aren't selecting the actuator, they're hacking.
if (selectedItem.type != 849)
{
args.Player.SendTileSquare(tileX, tileY, 1);
return true;
}
}
else if (action == EditAction.PoundTile || action == EditAction.SlopeTile)
{
// If they aren't selecting a hammer, they're hacking.
if (selectedItem.hammer == 0)
{
args.Player.SendTileSquare(tileX, tileY, 1);
return true;

View file

@ -596,7 +596,6 @@ namespace TShockAPI
Lighting.lightMode = 2;
ComputeMaxStyles();
FixChestStacks();
StatTracker = new StatTracker();
}
@ -607,13 +606,16 @@ namespace TShockAPI
for (int i = 0; i < Main.maxItemTypes; i++)
{
item.netDefaults(i);
if (GetDataHandlers.MaxPlaceStyles.ContainsKey(item.createTile))
if (item.placeStyle > 0)
{
if (item.placeStyle > GetDataHandlers.MaxPlaceStyles[item.createTile])
GetDataHandlers.MaxPlaceStyles[item.createTile] = item.placeStyle;
if (GetDataHandlers.MaxPlaceStyles.ContainsKey(item.createTile))
{
if (item.placeStyle > GetDataHandlers.MaxPlaceStyles[item.createTile])
GetDataHandlers.MaxPlaceStyles[item.createTile] = item.placeStyle;
}
else
GetDataHandlers.MaxPlaceStyles.Add(item.createTile, item.placeStyle);
}
else
GetDataHandlers.MaxPlaceStyles.Add(item.createTile, item.placeStyle);
}
}
private void FixChestStacks()