Added mod config
parent
3b4bea69f2
commit
9607a008e0
|
@ -15,30 +15,30 @@ namespace stardew_access
|
|||
|
||||
helper.ConsoleCommands.Add("readtile", "Toggle read tile feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.readTile = !MainClass.readTile;
|
||||
MainClass.Config.ReadTile = !MainClass.Config.ReadTile;
|
||||
|
||||
MainClass.DebugLog("Read Tile is " + (MainClass.readTile ? "on" : "off"));
|
||||
MainClass.DebugLog("Read Tile is " + (MainClass.Config.ReadTile ? "on" : "off"));
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("snapmouse", "Toggle snap mouse feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.snapMouse = !MainClass.snapMouse;
|
||||
MainClass.Config.SnapMouse = !MainClass.Config.SnapMouse;
|
||||
|
||||
MainClass.DebugLog("Snap Mouse is " + (MainClass.snapMouse ? "on" : "off"));
|
||||
MainClass.DebugLog("Snap Mouse is " + (MainClass.Config.SnapMouse ? "on" : "off"));
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("flooring", "Toggle flooring in read tile.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.readFlooring = !MainClass.readFlooring;
|
||||
MainClass.Config.ReadFlooring = !MainClass.Config.ReadFlooring;
|
||||
|
||||
MainClass.DebugLog("Flooring is " + (MainClass.readFlooring ? "on" : "off"));
|
||||
MainClass.DebugLog("Flooring is " + (MainClass.Config.ReadFlooring ? "on" : "off"));
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("radar", "Toggle radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.radar = !MainClass.radar;
|
||||
MainClass.Config.Radar = !MainClass.Config.Radar;
|
||||
|
||||
MainClass.DebugLog("Radar " + (MainClass.radar ? "on" : "off"));
|
||||
MainClass.DebugLog("Radar " + (MainClass.Config.Radar ? "on" : "off"));
|
||||
});
|
||||
|
||||
#region Radar Feature
|
||||
|
@ -51,9 +51,9 @@ namespace stardew_access
|
|||
|
||||
helper.ConsoleCommands.Add("rstereo", "Toggle stereo sound in radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.radarStereoSound = !MainClass.radarStereoSound;
|
||||
MainClass.Config.RadarStereoSound = !MainClass.Config.RadarStereoSound;
|
||||
|
||||
MainClass.DebugLog("Stereo sound is " + (MainClass.radarStereoSound ? "on" : "off"));
|
||||
MainClass.DebugLog("Stereo sound is " + (MainClass.Config.RadarStereoSound ? "on" : "off"));
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("rfocus", "Toggle focus mode in radar feature.", (string commmand, string[] args) =>
|
||||
|
|
|
@ -330,7 +330,7 @@ namespace stardew_access.Features
|
|||
{
|
||||
string soundName = $"_{post}";
|
||||
|
||||
if (!MainClass.radarStereoSound)
|
||||
if (!MainClass.Config.RadarStereoSound)
|
||||
soundName = $"_mono{soundName}";
|
||||
|
||||
if (category == CATEGORY.Farmers) // Villagers and farmers
|
||||
|
|
|
@ -543,7 +543,7 @@ namespace stardew_access.Features
|
|||
if (toReturn.Contains("feature"))
|
||||
toReturn.Replace("feature", "");
|
||||
}
|
||||
else if (terrain.Get() is Flooring && MainClass.readFlooring)
|
||||
else if (terrain.Get() is Flooring && MainClass.Config.ReadFlooring)
|
||||
{
|
||||
category = CATEGORY.Flooring;
|
||||
Flooring flooring = (Flooring)terrain.Get();
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
namespace stardew_access
|
||||
{
|
||||
class ModConfig
|
||||
internal class ModConfig
|
||||
{
|
||||
public Boolean VerboseCoordinates { get; set; } = true;
|
||||
public Boolean ReadTile { get; set; } = true;
|
||||
public Boolean SnapMouse { get; set; } = true;
|
||||
public Boolean Radar { get; set; } = false;
|
||||
public Boolean RadarStereoSound { get; set; } = true;
|
||||
public Boolean ReadFlooring { get; set; } = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,24 +12,23 @@ namespace stardew_access
|
|||
{
|
||||
public class MainClass : Mod
|
||||
{
|
||||
private ModConfig config;
|
||||
#region Global Vars
|
||||
private static ModConfig config;
|
||||
private Harmony? harmony;
|
||||
public static bool readTile = true;
|
||||
public static bool snapMouse = true;
|
||||
public static bool isNarratingHudMessage = false;
|
||||
public static bool radar = false;
|
||||
public static bool radarDebug = false;
|
||||
public static bool radarStereoSound = true;
|
||||
public static bool readFlooring = false;
|
||||
private static IMonitor monitor;
|
||||
public static string hudMessageQueryKey = "";
|
||||
private static Radar radarFeature;
|
||||
private static IScreenReader? screenReader;
|
||||
private static IModHelper modHelper;
|
||||
|
||||
internal static ModConfig Config { get => config; set => config = value; }
|
||||
public static IModHelper ModHelper { get => modHelper; }
|
||||
public static Radar RadarFeature { get => radarFeature; set => radarFeature = value; }
|
||||
|
||||
public static string hudMessageQueryKey = "";
|
||||
public static bool isNarratingHudMessage = false;
|
||||
public static bool radarDebug = false;
|
||||
#endregion
|
||||
|
||||
public static IScreenReader GetScreenReader()
|
||||
{
|
||||
if (screenReader == null)
|
||||
|
@ -55,7 +54,8 @@ namespace stardew_access
|
|||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
#region Initializations
|
||||
this.config = helper.ReadConfig<ModConfig>();
|
||||
Config = helper.ReadConfig<ModConfig>();
|
||||
|
||||
SetMonitor(base.Monitor); // Inititalize monitor
|
||||
modHelper = helper;
|
||||
|
||||
|
@ -116,13 +116,13 @@ namespace stardew_access
|
|||
|
||||
Other.narrateCurrentLocation();
|
||||
|
||||
if (snapMouse)
|
||||
if (Config.SnapMouse)
|
||||
Other.SnapMouseToPlayer();
|
||||
|
||||
if (!ReadTile.isReadingTile && readTile)
|
||||
if (!ReadTile.isReadingTile && Config.ReadTile)
|
||||
ReadTile.run();
|
||||
|
||||
if (!RadarFeature.isRunning && radar)
|
||||
if (!RadarFeature.isRunning && Config.Radar)
|
||||
RadarFeature.Run();
|
||||
|
||||
if (!isNarratingHudMessage)
|
||||
|
@ -179,7 +179,7 @@ namespace stardew_access
|
|||
if (Equals(e.Button, SButton.K) && !isLeftAltPressed)
|
||||
{
|
||||
string toSpeak;
|
||||
if (this.config.VerboseCoordinates)
|
||||
if (Config.VerboseCoordinates)
|
||||
{
|
||||
toSpeak = $"X: {CurrentPlayer.getPositionX()}, Y: {CurrentPlayer.getPositionY()}";
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ namespace stardew_access
|
|||
{
|
||||
toSpeak = $"{CurrentPlayer.getPositionX()}, {CurrentPlayer.getPositionY()}";
|
||||
}
|
||||
|
||||
|
||||
MainClass.GetScreenReader().Say(toSpeak, true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue