Added more commands and fixed bug

master
shoaib11120 2022-01-19 13:14:05 +05:30
parent 222385daf9
commit 603c3e43a0
2 changed files with 34 additions and 6 deletions

View File

@ -2,7 +2,6 @@
using StardewValley; using StardewValley;
using StardewValley.Objects; using StardewValley.Objects;
using StardewValley.TerrainFeatures; using StardewValley.TerrainFeatures;
using System.Diagnostics;
namespace stardew_access.Game namespace stardew_access.Game
{ {
@ -112,7 +111,7 @@ namespace stardew_access.Game
playSoundAt(position, objectName); playSoundAt(position, objectName);
} }
} }
else else if(obj is not Furniture)
{ {
playSoundAt(position, objectName); playSoundAt(position, objectName);
} }
@ -196,9 +195,11 @@ namespace stardew_access.Game
public void playSoundAt(Vector2 position, String? searchQuery) public void playSoundAt(Vector2 position, String? searchQuery)
{ {
if (searchQuery == null || !exclusions.Contains(searchQuery)) if (searchQuery == null || !exclusions.Contains(searchQuery.ToLower().Trim()))
{ {
MainClass.monitor.Log($"Object:{searchQuery}\tPosition: X={position.X} Y={position.Y}", StardewModdingAPI.LogLevel.Debug); if(MainClass.radarDebug)
MainClass.monitor.Log($"Object:{searchQuery.ToLower().Trim()}\tPosition: X={position.X} Y={position.Y}", StardewModdingAPI.LogLevel.Debug);
Game1.currentLocation.localSoundAt("sa_poi", position); Game1.currentLocation.localSoundAt("sa_poi", position);
} }
} }

View File

@ -17,7 +17,7 @@ namespace stardew_access
public class MainClass : Mod public class MainClass : Mod
{ {
private Harmony? harmony; private Harmony? harmony;
private static bool readTile = true, snapMouse = true, isNarratingHudMessage = false, radar = false; public static bool readTile = true, snapMouse = true, isNarratingHudMessage = false, radar = false, radarDebug = true;
public static IMonitor? monitor; public static IMonitor? monitor;
AutoHotkeyEngine ahk; AutoHotkeyEngine ahk;
public static string hudMessageQueryKey = ""; public static string hudMessageQueryKey = "";
@ -240,7 +240,14 @@ namespace stardew_access
{ {
radar = !radar; radar = !radar;
monitor.Log("Radar " + (snapMouse ? "on" : "off"), LogLevel.Info); monitor.Log("Radar " + (radar ? "on" : "off"), LogLevel.Info);
});
helper.ConsoleCommands.Add("r_debug", "Toggle debugging in radar feature", (string commmand, string[] args) =>
{
radarDebug = !radarDebug;
monitor.Log("Radar debugging " + (radarDebug ? "on" : "off"), LogLevel.Info);
}); });
helper.ConsoleCommands.Add("r_ex", "Exclude an object key to radar", (string commmand, string[] args) => helper.ConsoleCommands.Add("r_ex", "Exclude an object key to radar", (string commmand, string[] args) =>
@ -286,6 +293,26 @@ namespace stardew_access
} }
}); });
helper.ConsoleCommands.Add("r_list", "List all the exclusions in the radar feature.", (string commmand, string[] args) =>
{
if (radarFeature.exclusions.Count>0)
{
for(int i = 0;i < radarFeature.exclusions.Count; i++)
{
monitor.Log($"{i+1}) {radarFeature.exclusions[i]}", LogLevel.Info);
}
}
else
{
monitor.Log("No exclusions found.", LogLevel.Info);
}
});
helper.ConsoleCommands.Add("r_count", "Number of exclusions in the radar feature.", (string commmand, string[] args) =>
{
monitor.Log($"There are {radarFeature.exclusions.Count} exclusiond in the radar feature.", LogLevel.Info);
});
helper.ConsoleCommands.Add("ref_sr", "Refresh screen reader", (string commmand, string[] args) => helper.ConsoleCommands.Add("ref_sr", "Refresh screen reader", (string commmand, string[] args) =>
{ {
ScreenReader.initializeScreenReader(); ScreenReader.initializeScreenReader();