Added command to roggle snap mouse feature

master
shoaib11120 2021-12-15 19:50:56 +05:30
parent 5fa584a75a
commit b8e9c19481
1 changed files with 16 additions and 3 deletions

View File

@ -16,7 +16,7 @@ namespace stardew_access
public class MainClass : Mod public class MainClass : Mod
{ {
private Harmony? harmony; private Harmony? harmony;
private static bool isReadingTile = false, readTile = false; private static bool isReadingTile = false, readTile = false, snapMouse = false;
private static Vector2 prevTile; private static Vector2 prevTile;
public static IMonitor? monitor; public static IMonitor? monitor;
AutoHotkeyEngine ahk; AutoHotkeyEngine ahk;
@ -106,10 +106,22 @@ namespace stardew_access
#endregion #endregion
helper.ConsoleCommands.Add("read_tile", "Toggle read tile feature", (string arg1, string[] arg2) => { #region Custom Commands
helper.ConsoleCommands.Add("read_tile", "Toggle read tile feature", (string arg1, string[] arg2) =>
{
readTile = !readTile; readTile = !readTile;
monitor.Log("Read Tile is " + (readTile ? "on" : "off"), LogLevel.Info);
}); });
helper.ConsoleCommands.Add("snap_mouse", "Toggle snap mouse feature", (string arg1, string[] arg2) =>
{
snapMouse = !snapMouse;
monitor.Log("Snap Mouse is " + (snapMouse ? "on" : "off"), LogLevel.Info);
});
#endregion
helper.Events.Input.ButtonPressed += this.OnButtonPressed; helper.Events.Input.ButtonPressed += this.OnButtonPressed;
helper.Events.GameLoop.UpdateTicked += this.onUpdateTicked; helper.Events.GameLoop.UpdateTicked += this.onUpdateTicked;
} }
@ -121,7 +133,8 @@ namespace stardew_access
MenuPatch.resetGlobalVars(); MenuPatch.resetGlobalVars();
SnapMouseToPlayer(); if(snapMouse)
SnapMouseToPlayer();
if(!isReadingTile && readTile) if(!isReadingTile && readTile)
ReadTile(); ReadTile();