Migrate most of CheckTilePermission to TSPlayer
TShock.CheckTilePermission(ply, x, y, paint) has been replaced with TSPlayer.HasPaintPermission and TSPlayer.HasBuildPermission respectively. These two methods dramatically simplify the logic required to process build permissions. Still todo after this commit: 1. Implement warnings for when a player fails a permission check on build. This is probably going to be accomplished by a default argument to the HasBuildPermission signature. 2. Create a variant that checks for ice tile permission and use like HasPaintPermission() so as to remove the other TShock.CheckTilePermission method. Annoyingly, all of the existing methods that start with Check seem to "check" if they player _doesn't_ have permission (true = no permission), which makes nearly every call negative.
This commit is contained in:
parent
fbfb509cc9
commit
195a23a7e5
4 changed files with 64 additions and 83 deletions
|
|
@ -2532,7 +2532,7 @@ namespace TShockAPI
|
|||
|
||||
args.Player.ActiveChest = id;
|
||||
|
||||
if (TShock.CheckTilePermission(args.Player, x, y) && TShock.Config.RegionProtectChests)
|
||||
if (!args.Player.HasBuildPermission(x, y) && TShock.Config.RegionProtectChests)
|
||||
{
|
||||
args.Player.SendData(PacketTypes.ChestOpen, "", -1);
|
||||
return true;
|
||||
|
|
@ -2572,7 +2572,7 @@ namespace TShockAPI
|
|||
if (OnSignEvent(id, x, y))
|
||||
return true;
|
||||
|
||||
if (TShock.CheckTilePermission(args.Player, x, y))
|
||||
if (!args.Player.HasBuildPermission(x, y))
|
||||
{
|
||||
args.Player.SendData(PacketTypes.SignNew, "", id);
|
||||
return true;
|
||||
|
|
@ -2897,7 +2897,7 @@ namespace TShockAPI
|
|||
}
|
||||
|
||||
if (args.Player.IsBouncerThrottled() ||
|
||||
TShock.CheckTilePermission(args.Player, x, y, true) ||
|
||||
!args.Player.HasPaintPermission(x, y) ||
|
||||
!args.Player.IsInRange(x, y))
|
||||
{
|
||||
args.Player.SendData(PacketTypes.PaintTile, "", x, y, Main.tile[x, y].color());
|
||||
|
|
@ -2941,7 +2941,7 @@ namespace TShockAPI
|
|||
}
|
||||
|
||||
if (args.Player.IsBouncerThrottled() ||
|
||||
TShock.CheckTilePermission(args.Player, x, y, true) ||
|
||||
!args.Player.HasPaintPermission(x, y) ||
|
||||
!args.Player.IsInRange(x, y))
|
||||
{
|
||||
args.Player.SendData(PacketTypes.PaintWall, "", x, y, Main.tile[x, y].wallColor());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue