Added warp point detection

master
Mohammad Shoaib Khan 2022-11-07 20:07:25 +05:30
parent c4ce0a5280
commit ec7148e613
No known key found for this signature in database
GPG Key ID: 3EE32C9DFF520699
1 changed files with 27 additions and 0 deletions

View File

@ -40,6 +40,7 @@ namespace stardew_access.Features
bool isColliding = isCollidingAtTile(x, y); bool isColliding = isCollidingAtTile(x, y);
var terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict; var terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict;
string? door = getDoorAtTile(x, y); string? door = getDoorAtTile(x, y);
string? warp = getWarpPointAtTile(x, y);
(CATEGORY? category, string? name) dynamicTile = getDynamicTilesInfo(x, y, lessInfo); (CATEGORY? category, string? name) dynamicTile = getDynamicTilesInfo(x, y, lessInfo);
string? junimoBundle = getJunimoBundleAt(x, y); string? junimoBundle = getJunimoBundleAt(x, y);
string? resourceClump = getResourceClumpAtTile(x, y, lessInfo); string? resourceClump = getResourceClumpAtTile(x, y, lessInfo);
@ -113,6 +114,11 @@ namespace stardew_access.Features
toReturn = bush; toReturn = bush;
category = CATEGORY.Bush; category = CATEGORY.Bush;
} }
else if (warp != null)
{
toReturn = warp;
category = CATEGORY.Doors;
}
else if (door != null) else if (door != null)
{ {
toReturn = door; toReturn = door;
@ -1164,6 +1170,27 @@ namespace stardew_access.Features
return false; return false;
} }
public static string? getWarpPointAtTile(int x, int y)
{
try
{
if (Game1.currentLocation == null) return null;
foreach (Warp warpPoint in Game1.currentLocation.warps)
{
if (warpPoint.X != x || warpPoint.Y != y) continue;
return $"{warpPoint.TargetName} Entrance";
}
}
catch (Exception e)
{
MainClass.ErrorLog($"Error while detecting warp points.\n{e.Message}");
}
return null;
}
public static string? getDoorAtTile(int x, int y) public static string? getDoorAtTile(int x, int y)
{ {
Point tilePoint = new Point(x, y); Point tilePoint = new Point(x, y);