option to overload Region.InArea() with x,y for more accurate Region detection.
This commit is contained in:
parent
bd878ee63c
commit
217d001baf
1 changed files with 14 additions and 2 deletions
|
|
@ -236,7 +236,7 @@ namespace TShockAPI.DB
|
||||||
}
|
}
|
||||||
for (int i = 0; i < Regions.Count; i++)
|
for (int i = 0; i < Regions.Count; i++)
|
||||||
{
|
{
|
||||||
if (Regions[i].InArea(new Rectangle(x, y, 0, 0)) && !Regions[i].HasPermissionToBuildInRegion(ply))
|
if (Regions[i].InArea(x,y) && !Regions[i].HasPermissionToBuildInRegion(ply))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -531,6 +531,18 @@ namespace TShockAPI.DB
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool InArea(int x, int y) //overloaded with x,y
|
||||||
|
{
|
||||||
|
|
||||||
|
if (x >= Area.Left && x <= Area.Right && y >= Area.Top && y <= Area.Bottom)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool HasPermissionToBuildInRegion(TSPlayer ply)
|
public bool HasPermissionToBuildInRegion(TSPlayer ply)
|
||||||
{
|
{
|
||||||
if (!ply.IsLoggedIn)
|
if (!ply.IsLoggedIn)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue