From 2df4cfca2737959914f9e37ae60981ff6516f9e8 Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Khan Date: Wed, 17 Aug 2022 13:28:49 +0530 Subject: [PATCH] Issue#28 Prepend fish name to fish ponds --- stardew-access/Features/TileInfo.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/stardew-access/Features/TileInfo.cs b/stardew-access/Features/TileInfo.cs index d822ec6..00b0b57 100644 --- a/stardew-access/Features/TileInfo.cs +++ b/stardew-access/Features/TileInfo.cs @@ -317,6 +317,16 @@ namespace stardew_access.Features { string name = building.buildingType.Value; + // Prepend fish name for fish ponds + if (building is FishPond fishPond) + { + if (fishPond.fishType.Value >= 0) + { + name = $"{Game1.objectInformation[fishPond.fishType.Value].Split('/')[4]} {name}"; + } + } + + // Detect doors, input slots, etc. if ((building.humanDoor.Value.X + building.tileX.Value) == x && (building.humanDoor.Value.Y + building.tileY.Value) == y) return (CATEGORY.Doors, name + " Door"); else if ((building.animalDoor.Value.X + building.tileX.Value) == x && (building.animalDoor.Value.Y + building.tileY.Value) == y) @@ -327,7 +337,7 @@ namespace stardew_access.Features return (CATEGORY.Buildings, name + " input"); else if (building is Mill && (building.tileX.Value + 3) == x && (building.tileY.Value + 1) == y) return (CATEGORY.Buildings, name + " output"); - else if (!lessInfo) + else return (CATEGORY.Buildings, name); } } @@ -984,12 +994,10 @@ namespace stardew_access.Features { if (Game1.currentLocation is Mine or MineShaft) { - int? index = null; + if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y] == null) + return false; - if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y] != null) - index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex; - - if (index == 112) + if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex == 112) return true; } }