Change priority order in getObjectAtTile()

This commit is contained in:
Mohammad Shoaib Khan
2022-10-10 16:14:14 +05:30
parent 5205df8400
commit 8c080e11f0

View File

@@ -695,19 +695,7 @@ namespace stardew_access.Features
// Get object names based on index // Get object names based on index
(string? name, CATEGORY category) correctNameAndCategory = getCorrectNameAndCategoryFromIndex(index, obj.Name); (string? name, CATEGORY category) correctNameAndCategory = getCorrectNameAndCategoryFromIndex(index, obj.Name);
if (correctNameAndCategory.name != null) if (obj is Chest)
toReturn = correctNameAndCategory;
else if (obj.name.ToLower().Equals("stone"))
toReturn.category = CATEGORY.Debris;
else if (obj.name.ToLower().Equals("twig"))
toReturn.category = CATEGORY.Debris;
else if (obj.name.ToLower().Contains("quartz"))
toReturn.category = CATEGORY.MineItems;
else if (obj.name.ToLower().Contains("earth crystal"))
toReturn.category = CATEGORY.MineItems;
else if (obj.name.ToLower().Contains("frozen tear"))
toReturn.category = CATEGORY.MineItems;
else if (obj is Chest)
{ {
Chest chest = (Chest)obj; Chest chest = (Chest)obj;
toReturn = (chest.DisplayName, CATEGORY.Chests); toReturn = (chest.DisplayName, CATEGORY.Chests);
@@ -719,7 +707,7 @@ namespace stardew_access.Features
else if (obj is Sign sign) else if (obj is Sign sign)
{ {
if (sign.displayItem.Value != null) if (sign.displayItem.Value != null)
toReturn.name = $"{obj.DisplayName}, {sign.displayItem.Value.DisplayName}"; toReturn.name = $"{sign.DisplayName}, {sign.displayItem.Value.DisplayName}";
} }
else if (obj is Furniture furniture) else if (obj is Furniture furniture)
{ {
@@ -758,6 +746,18 @@ namespace stardew_access.Features
} }
} }
} }
else if (correctNameAndCategory.name != null)
toReturn = correctNameAndCategory;
else if (obj.name.ToLower().Equals("stone"))
toReturn.category = CATEGORY.Debris;
else if (obj.name.ToLower().Equals("twig"))
toReturn.category = CATEGORY.Debris;
else if (obj.name.ToLower().Contains("quartz"))
toReturn.category = CATEGORY.MineItems;
else if (obj.name.ToLower().Contains("earth crystal"))
toReturn.category = CATEGORY.MineItems;
else if (obj.name.ToLower().Contains("frozen tear"))
toReturn.category = CATEGORY.MineItems;
if (toReturn.category == CATEGORY.Machines) // Fix for `Harvestable table` and `Busy nodes` if (toReturn.category == CATEGORY.Machines) // Fix for `Harvestable table` and `Busy nodes`
{ {