Checking whether a point is in a region no longer requires to region to be protected.

Renamed some methods to conform to C# conventions.
This commit is contained in:
White 2015-09-06 18:49:57 +09:30
parent 502afb4e6f
commit 2e5eaae0b3
3 changed files with 13 additions and 14 deletions

View file

@ -4335,7 +4335,7 @@ namespace TShockAPI
}
int addAmount;
int.TryParse(args.Parameters[3], out addAmount);
if (TShock.Regions.resizeRegion(args.Parameters[1], addAmount, direction))
if (TShock.Regions.ResizeRegion(args.Parameters[1], addAmount, direction))
{
args.Player.SendInfoMessage("Region Resized Successfully!");
TShock.Regions.Reload();

View file

@ -232,8 +232,7 @@ namespace TShockAPI.DB
foreach (Region region in Regions.ToList())
{
if (x >= region.Area.Left && x <= region.Area.Right &&
y >= region.Area.Top && y <= region.Area.Bottom &&
region.DisableBuild)
y >= region.Area.Top && y <= region.Area.Bottom)
{
return true;
}
@ -247,8 +246,7 @@ namespace TShockAPI.DB
foreach (Region region in Regions.ToList())
{
if (x >= region.Area.Left && x <= region.Area.Right &&
y >= region.Area.Top && y <= region.Area.Bottom &&
region.DisableBuild)
y >= region.Area.Top && y <= region.Area.Bottom)
{
regions.Add(region.Name);
}
@ -262,8 +260,7 @@ namespace TShockAPI.DB
foreach (Region region in Regions.ToList())
{
if (x >= region.Area.Left && x <= region.Area.Right &&
y >= region.Area.Top && y <= region.Area.Bottom &&
region.DisableBuild)
y >= region.Area.Top && y <= region.Area.Bottom)
{
regions.Add(region);
}
@ -276,7 +273,7 @@ namespace TShockAPI.DB
return MergedIDs.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).ToList();
}
public bool resizeRegion(string regionName, int addAmount, int direction)
public bool ResizeRegion(string regionName, int addAmount, int direction)
{
//0 = up
//1 = right
@ -390,7 +387,7 @@ namespace TShockAPI.DB
foreach (var r in Regions)
{
if (r.Name == regionName && r.WorldID == Main.worldID.ToString())
r.setAllowedIDs(mergedIDs);
r.SetAllowedIDs(mergedIDs);
}
return q != 0;
}
@ -613,6 +610,10 @@ namespace TShockAPI.DB
public bool HasPermissionToBuildInRegion(TSPlayer ply)
{
if (!DisableBuild)
{
return true;
}
if (!ply.IsLoggedIn)
{
if (!ply.HasBeenNaggedAboutLoggingIn)
@ -622,15 +623,11 @@ namespace TShockAPI.DB
}
return false;
}
if (!DisableBuild)
{
return true;
}
return AllowedIDs.Contains(ply.User.ID) || AllowedGroups.Contains(ply.Group.Name) || Owner == ply.User.Name;
}
public void setAllowedIDs(String ids)
public void SetAllowedIDs(String ids)
{
String[] id_arr = ids.Split(',');
List<int> id_list = new List<int>();

View file

@ -1967,6 +1967,8 @@ namespace TShockAPI
if (action == EditAction.KillTile && !Main.tileCut[tile.type] && !breakableTiles.Contains(tile.type))
{
//TPlayer.mount.Type 8 => Drill Containment Unit.
// If the tile is an axe tile and they aren't selecting an axe, they're hacking.
if (Main.tileAxe[tile.type] && ((args.Player.TPlayer.mount.Type != 8 && selectedItem.axe == 0) && !ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0))
{