Added ice workaround for players who want to use ice even with canbuild off.

This feature is only half done as players still get warned when their ice breaks.
This commit is contained in:
Zack Piispanen 2012-01-20 23:36:27 -05:00
parent dac1e6c282
commit efee7caed2
3 changed files with 39 additions and 1 deletions

View file

@ -205,6 +205,8 @@ namespace TShockAPI
[Description("Ignores all no clip checks for players")] public bool IgnoreNoClip = false;
[Description("Allow Ice placement even when user does not have canbuild")] public bool AllowIce = false;
public static ConfigFile Read(string path)
{
if (!File.Exists(path))

View file

@ -1263,7 +1263,7 @@ namespace TShockAPI
return true;
}
if (TShock.CheckTilePermission(args.Player, tileX, tileY))
if (TShock.CheckTilePermission(args.Player, tileX, tileY, tiletype))
{
args.Player.SendTileSquare(tileX, tileY);
return true;

View file

@ -1086,6 +1086,42 @@ namespace TShockAPI
return false;
}
public static bool CheckTilePermission( TSPlayer player, int tileX, int tileY, byte tileType )
{
if (!player.Group.HasPermission(Permissions.canbuild) && !(TShock.Config.AllowIce && tileType == 127) )
{
player.SendMessage("You do not have permission to build!", Color.Red);
return true;
}
if (!player.Group.HasPermission(Permissions.editspawn) && !Regions.CanBuild(tileX, tileY, player) &&
Regions.InArea(tileX, tileY))
{
player.SendMessage("Region protected from changes.", Color.Red);
return true;
}
if (Config.DisableBuild)
{
if (!player.Group.HasPermission(Permissions.editspawn))
{
player.SendMessage("World protected from changes.", Color.Red);
return true;
}
}
if (Config.SpawnProtection)
{
if (!player.Group.HasPermission(Permissions.editspawn))
{
var flag = CheckSpawn(tileX, tileY);
if (flag)
{
player.SendMessage("Spawn protected from changes.", Color.Red);
return true;
}
}
}
return false;
}
public static bool CheckTilePermission(TSPlayer player, int tileX, int tileY)
{
if (!player.Group.HasPermission(Permissions.canbuild))