diff --git a/stardew-access/Features/Radar.cs b/stardew-access/Features/Radar.cs index 3b4fded..558da81 100644 --- a/stardew-access/Features/Radar.cs +++ b/stardew-access/Features/Radar.cs @@ -166,7 +166,7 @@ namespace stardew_access.Features { Vector2 dir = new Vector2(item.X + dirX[i], item.Y + dirY[i]); - if (!searched.Contains(dir) && Game1.currentLocation.isTileOnMap(dir)) + if (!searched.Contains(dir) && (TileInfo.isWarpPointAtTile((int)dir.X, (int)dir.Y) || Game1.currentLocation.isTileOnMap(dir))) { toSearch.Enqueue(dir); searched.Add(dir); diff --git a/stardew-access/Features/TileInfo.cs b/stardew-access/Features/TileInfo.cs index 55c7029..51c78d6 100644 --- a/stardew-access/Features/TileInfo.cs +++ b/stardew-access/Features/TileInfo.cs @@ -279,6 +279,9 @@ namespace stardew_access.Features { Rectangle rect = new Rectangle(x * 64 + 1, y * 64 + 1, 62, 62); + // Check whether the position is a warp point, if so then return false, sometimes warp points are 1 tile off the map for example in coops and barns + if (isWarpPointAtTile(x, y)) return false; + if (Game1.currentLocation.isCollidingPosition(rect, Game1.viewport, true, 0, glider: false, Game1.player, pathfinding: true)) { return true; @@ -290,6 +293,18 @@ namespace stardew_access.Features return false; } + public static Boolean isWarpPointAtTile(int x, int y) + { + if (Game1.currentLocation == null) return false; + + foreach (Warp warpPoint in Game1.currentLocation.warps) + { + if (warpPoint.X == x && warpPoint.Y == y) return true; + } + + return false; + } + public static string? getFarmAnimalAt(GameLocation? location, int x, int y) { if (location == null) diff --git a/stardew-access/Features/TileViewer.cs b/stardew-access/Features/TileViewer.cs index 822d057..1c6ceaf 100644 --- a/stardew-access/Features/TileViewer.cs +++ b/stardew-access/Features/TileViewer.cs @@ -278,6 +278,9 @@ namespace stardew_access.Features private static bool isPositionOnMap(Vector2 position) { + // Check whether the position is a warp point, if so then return true, sometimes warp points are 1 tile off the map for example in coops and barns + if (TileInfo.isWarpPointAtTile((int)(position.X / Game1.tileSize), (int)(position.Y / Game1.tileSize))) return true; + //position does not take viewport into account since the entire map needs to be checked. Map map = Game1.currentLocation.map; if (position.X < 0 || position.X > map.Layers[0].DisplayWidth) return false; diff --git a/stardew-access/manifest.json b/stardew-access/manifest.json index d638b17..494cb2e 100644 --- a/stardew-access/manifest.json +++ b/stardew-access/manifest.json @@ -1,7 +1,7 @@ { "Name": "Stardew Access", "Author": "Mohammad Shoaib", - "Version": "1.3.3", + "Version": "1.3.4", "Description": "An accessibility mod with screen reader support!", "UniqueID": "shoaib.stardewaccess", "EntryDll": "stardew-access.dll",