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:
parent
502afb4e6f
commit
2e5eaae0b3
3 changed files with 13 additions and 14 deletions
|
|
@ -4335,7 +4335,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
int addAmount;
|
int addAmount;
|
||||||
int.TryParse(args.Parameters[3], out 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!");
|
args.Player.SendInfoMessage("Region Resized Successfully!");
|
||||||
TShock.Regions.Reload();
|
TShock.Regions.Reload();
|
||||||
|
|
|
||||||
|
|
@ -232,8 +232,7 @@ namespace TShockAPI.DB
|
||||||
foreach (Region region in Regions.ToList())
|
foreach (Region region in Regions.ToList())
|
||||||
{
|
{
|
||||||
if (x >= region.Area.Left && x <= region.Area.Right &&
|
if (x >= region.Area.Left && x <= region.Area.Right &&
|
||||||
y >= region.Area.Top && y <= region.Area.Bottom &&
|
y >= region.Area.Top && y <= region.Area.Bottom)
|
||||||
region.DisableBuild)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -247,8 +246,7 @@ namespace TShockAPI.DB
|
||||||
foreach (Region region in Regions.ToList())
|
foreach (Region region in Regions.ToList())
|
||||||
{
|
{
|
||||||
if (x >= region.Area.Left && x <= region.Area.Right &&
|
if (x >= region.Area.Left && x <= region.Area.Right &&
|
||||||
y >= region.Area.Top && y <= region.Area.Bottom &&
|
y >= region.Area.Top && y <= region.Area.Bottom)
|
||||||
region.DisableBuild)
|
|
||||||
{
|
{
|
||||||
regions.Add(region.Name);
|
regions.Add(region.Name);
|
||||||
}
|
}
|
||||||
|
|
@ -262,8 +260,7 @@ namespace TShockAPI.DB
|
||||||
foreach (Region region in Regions.ToList())
|
foreach (Region region in Regions.ToList())
|
||||||
{
|
{
|
||||||
if (x >= region.Area.Left && x <= region.Area.Right &&
|
if (x >= region.Area.Left && x <= region.Area.Right &&
|
||||||
y >= region.Area.Top && y <= region.Area.Bottom &&
|
y >= region.Area.Top && y <= region.Area.Bottom)
|
||||||
region.DisableBuild)
|
|
||||||
{
|
{
|
||||||
regions.Add(region);
|
regions.Add(region);
|
||||||
}
|
}
|
||||||
|
|
@ -276,7 +273,7 @@ namespace TShockAPI.DB
|
||||||
return MergedIDs.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).ToList();
|
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
|
//0 = up
|
||||||
//1 = right
|
//1 = right
|
||||||
|
|
@ -390,7 +387,7 @@ namespace TShockAPI.DB
|
||||||
foreach (var r in Regions)
|
foreach (var r in Regions)
|
||||||
{
|
{
|
||||||
if (r.Name == regionName && r.WorldID == Main.worldID.ToString())
|
if (r.Name == regionName && r.WorldID == Main.worldID.ToString())
|
||||||
r.setAllowedIDs(mergedIDs);
|
r.SetAllowedIDs(mergedIDs);
|
||||||
}
|
}
|
||||||
return q != 0;
|
return q != 0;
|
||||||
}
|
}
|
||||||
|
|
@ -613,6 +610,10 @@ namespace TShockAPI.DB
|
||||||
|
|
||||||
public bool HasPermissionToBuildInRegion(TSPlayer ply)
|
public bool HasPermissionToBuildInRegion(TSPlayer ply)
|
||||||
{
|
{
|
||||||
|
if (!DisableBuild)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!ply.IsLoggedIn)
|
if (!ply.IsLoggedIn)
|
||||||
{
|
{
|
||||||
if (!ply.HasBeenNaggedAboutLoggingIn)
|
if (!ply.HasBeenNaggedAboutLoggingIn)
|
||||||
|
|
@ -622,15 +623,11 @@ namespace TShockAPI.DB
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!DisableBuild)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return AllowedIDs.Contains(ply.User.ID) || AllowedGroups.Contains(ply.Group.Name) || Owner == ply.User.Name;
|
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(',');
|
String[] id_arr = ids.Split(',');
|
||||||
List<int> id_list = new List<int>();
|
List<int> id_list = new List<int>();
|
||||||
|
|
|
||||||
|
|
@ -1967,6 +1967,8 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (action == EditAction.KillTile && !Main.tileCut[tile.type] && !breakableTiles.Contains(tile.type))
|
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 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))
|
if (Main.tileAxe[tile.type] && ((args.Player.TPlayer.mount.Type != 8 && selectedItem.axe == 0) && !ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue