From ce69a5ad98bfc6cd0fe4b9a80af94c16705464e2 Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Date: Sun, 1 May 2022 14:26:08 +0530 Subject: [PATCH] Added SearchLocation() to API --- stardew-access/API.cs | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/stardew-access/API.cs b/stardew-access/API.cs index 0362154..1a2f9fa 100644 --- a/stardew-access/API.cs +++ b/stardew-access/API.cs @@ -16,13 +16,13 @@ namespace stardew_access.ScreenReader /// The starting point. /// The limiting factor or simply radius of the search area. /// A dictionary with all the detected tiles along with the name of the object on it and it's category. - public Dictionary SearchNearbyTiles(Vector2 center, int limit) + public Dictionary SearchNearbyTiles(Vector2 center, int limit) { /* * How to use the Dictionary to get the name and category of a tile:- * - * string? objectName = detectedTiles.GetValueOrDefault(center).Item1; - * string? objectCategory = detectedTiles.GetValueOrDefault(center).Item2; + * string tileName = detectedTiles.GetValueOrDefault(tilePosition).name; + * string tileCategory = detectedTiles.GetValueOrDefault(tilePosition).category; * * Here detectedTiles is the Dictionary returned by this method */ @@ -30,12 +30,30 @@ namespace stardew_access.ScreenReader return new Radar().SearchNearbyTiles(center, limit, false); } + /// + /// Search the entire location using Breadth First Search algorithm(BFS). + /// + /// A dictionary with all the detected tiles along with the name of the object on it and it's category. + public Dictionary SearchLocation() + { + /* + * How to use the Dictionary to get the name and category of a tile:- + * + * string tileName = detectedTiles.GetValueOrDefault(tilePosition).name; + * string tileCategory = detectedTiles.GetValueOrDefault(tilePosition).category; + * + * Here detectedTiles is the Dictionary returned by this method + */ + + return new Radar().SearchLocation(); + } + /// /// Check the tile for any object /// /// The tile where we want to check the name and category of object if any - /// Name of the object as the first item (Item1) and category as the second item (Item2). Returns null if no object found. - public (string?, string?) GetNameWithCategoryNameAtTile(Vector2 tile) + /// Name of the object as the first item (name) and category as the second item (category). Returns null if no object found. + public (string? name, string? category) GetNameWithCategoryNameAtTile(Vector2 tile) { return TileInfo.getNameWithCategoryNameAtTile(tile); }