Updated Regions.InAreaRegion.Name to allow overlapping regions - For plugins that use this it will require updating the code
This commit is contained in:
parent
62bc28332a
commit
6079d84c9e
2 changed files with 19 additions and 16 deletions
|
|
@ -258,19 +258,20 @@ namespace TShockAPI.DB
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string InAreaRegionName(int x, int y)
|
public List<string> InAreaRegionName(int x, int y)
|
||||||
{
|
{
|
||||||
foreach (Region region in Regions)
|
List<string> regions = new List<string>() { };
|
||||||
{
|
foreach (Region region in Regions)
|
||||||
if (x >= region.Area.Left && x <= region.Area.Right &&
|
{
|
||||||
y >= region.Area.Top && y <= region.Area.Bottom &&
|
if (x >= region.Area.Left && x <= region.Area.Right &&
|
||||||
region.DisableBuild)
|
y >= region.Area.Top && y <= region.Area.Bottom &&
|
||||||
{
|
region.DisableBuild)
|
||||||
return region.Name;
|
{
|
||||||
}
|
regions.Add(region.Name);
|
||||||
}
|
}
|
||||||
return null;
|
}
|
||||||
}
|
return regions;
|
||||||
|
}
|
||||||
|
|
||||||
public static List<string> ListIDs(string MergedIDs)
|
public static List<string> ListIDs(string MergedIDs)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1197,13 +1197,15 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (args.Player.AwaitingName)
|
if (args.Player.AwaitingName)
|
||||||
{
|
{
|
||||||
if (TShock.Regions.InAreaRegionName(tileX, tileY) == null)
|
var protectedregions = TShock.Regions.InAreaRegionName(tileX, tileY);
|
||||||
{
|
if (protectedregions.Count == 0)
|
||||||
|
{
|
||||||
args.Player.SendMessage("Region is not protected", Color.Yellow);
|
args.Player.SendMessage("Region is not protected", Color.Yellow);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
args.Player.SendMessage("Region Name: " + TShock.Regions.InAreaRegionName(tileX, tileY), Color.Yellow);
|
string regionlist = string.Join(",", protectedregions.ToArray());
|
||||||
|
args.Player.SendMessage("Region Name(s): " + regionlist, Color.Yellow);
|
||||||
}
|
}
|
||||||
args.Player.SendTileSquare(tileX, tileY);
|
args.Player.SendTileSquare(tileX, tileY);
|
||||||
args.Player.AwaitingName = false;
|
args.Player.AwaitingName = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue