Added some paint boundary checks, fixed OnPaintWall typo, fixed paint rollback
This commit is contained in:
parent
d7103b815e
commit
c12b592d60
1 changed files with 18 additions and 6 deletions
|
|
@ -3207,14 +3207,20 @@ namespace TShockAPI
|
|||
var y = args.Data.ReadInt32();
|
||||
var t = args.Data.ReadInt8();
|
||||
|
||||
if (OnPaintTile(x, y, t))
|
||||
if (x < 0 || y < 0 || x >= Main.maxTilesX || y >= Main.maxTilesY || t > Main.numTileColors)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (OnPaintTile(x, y, t))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Not selecting paintbrush or paint scraper or the spectre versions? Hacking.
|
||||
if (args.Player.SelectedItem.type != 1071 && args.Player.SelectedItem.type != 1100 &&
|
||||
args.Player.SelectedItem.type != 1543 && args.Player.SelectedItem.type != 1545)
|
||||
{
|
||||
args.Player.SendData(PacketTypes.PaintTile, "", x, y, 0);
|
||||
args.Player.SendData(PacketTypes.PaintTile, "", x, y, Main.tile[x, y].color());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3222,7 +3228,7 @@ namespace TShockAPI
|
|||
TShock.CheckTilePermission(args.Player, x, y, true) ||
|
||||
TShock.CheckRangePermission(args.Player, x, y))
|
||||
{
|
||||
args.Player.SendData(PacketTypes.PaintTile, "", x, y, 0);
|
||||
args.Player.SendData(PacketTypes.PaintTile, "", x, y, Main.tile[x, y].color());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3239,14 +3245,20 @@ namespace TShockAPI
|
|||
var y = args.Data.ReadInt32();
|
||||
var t = args.Data.ReadInt8();
|
||||
|
||||
if (OnPaintTile(x, y, t))
|
||||
if (x < 0 || y < 0 || x >= Main.maxTilesX || y >= Main.maxTilesY || t > Main.numTileColors)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (OnPaintWall(x, y, t))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Not selecting paint roller or paint scraper or the spectre versions? Hacking.
|
||||
if (args.Player.SelectedItem.type != 1071 && args.Player.SelectedItem.type != 1100 &&
|
||||
args.Player.SelectedItem.type != 1544 && args.Player.SelectedItem.type != 1545)
|
||||
{
|
||||
args.Player.SendData(PacketTypes.PaintWall, "", x, y, 0);
|
||||
args.Player.SendData(PacketTypes.PaintWall, "", x, y, Main.tile[x, y].wallColor());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3254,7 +3266,7 @@ namespace TShockAPI
|
|||
TShock.CheckTilePermission(args.Player, x, y, true) ||
|
||||
TShock.CheckRangePermission(args.Player, x, y))
|
||||
{
|
||||
args.Player.SendData(PacketTypes.PaintWall, "", x, y, 0);
|
||||
args.Player.SendData(PacketTypes.PaintWall, "", x, y, Main.tile[x, y].wallColor());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue