From b8e9c19481977eadb778aa2e0e5bf556e9975376 Mon Sep 17 00:00:00 2001
From: shoaib11120 <shoaib.khan20@outlook.com>
Date: Wed, 15 Dec 2021 19:50:56 +0530
Subject: [PATCH] Added command to roggle snap mouse feature

---
 stardew-access/ModEntry.cs | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/stardew-access/ModEntry.cs b/stardew-access/ModEntry.cs
index 149d9b9..db6c2cb 100644
--- a/stardew-access/ModEntry.cs
+++ b/stardew-access/ModEntry.cs
@@ -16,7 +16,7 @@ namespace stardew_access
     public class MainClass : Mod
     {
         private Harmony? harmony;
-        private static bool isReadingTile = false, readTile = false;
+        private static bool isReadingTile = false, readTile = false, snapMouse = false;
         private static Vector2 prevTile;
         public static IMonitor? monitor;
         AutoHotkeyEngine ahk;
@@ -106,10 +106,22 @@ namespace stardew_access
 
             #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;
+
+                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.GameLoop.UpdateTicked += this.onUpdateTicked;
         }
@@ -121,7 +133,8 @@ namespace stardew_access
 
             MenuPatch.resetGlobalVars();
 
-            SnapMouseToPlayer();
+            if(snapMouse)
+                SnapMouseToPlayer();
 
             if(!isReadingTile && readTile)
                 ReadTile();