From d134fece41b7cfe4d8ff1c9176ff0e7f8a05420f Mon Sep 17 00:00:00 2001 From: martimavocado <39881008+martimavocado@users.noreply.github.com> Date: Fri, 9 Feb 2024 21:57:05 +0000 Subject: Added Sensitivity Reducer. #716 --- .../java/at/hannibal2/skyhanni/config/Storage.java | 5 +- .../hannibal2/skyhanni/config/commands/Commands.kt | 5 ++ .../config/features/garden/GardenConfig.java | 5 ++ .../features/garden/SensitivityReducerConfig.java | 69 ++++++++++++++++++++++ 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/garden/SensitivityReducerConfig.java (limited to 'src/main/java/at/hannibal2/skyhanni/config') diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java index 486ec5369..a9364d695 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java @@ -44,7 +44,10 @@ public class Storage { public boolean hasPlayedBefore = false; @Expose - public Float savedMouseSensitivity = .5f; + public Float savedMouselockedSensitivity = .5f; + + @Expose + public Float savedMouseloweredSensitivity = .5f; @Deprecated @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 69b096b31..771bf7055 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -29,6 +29,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.GardenCropTimeCommand import at.hannibal2.skyhanni.features.garden.GardenCropsInCommand import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest +import at.hannibal2.skyhanni.features.garden.SensitivityReducer import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay import at.hannibal2.skyhanni.features.garden.farming.ArmorDropTracker import at.hannibal2.skyhanni.features.garden.farming.CropMoneyDisplay @@ -216,6 +217,10 @@ object Commands { "shmouselock", "Lock/Unlock the mouse so it will no longer rotate the player (for farming)" ) { LockMouseLook.toggleLock() } + registerCommand( + "shsensreduce", + "Lowers the mouse sensitivity for easier small adjustments (for farming)" + ) { SensitivityReducer.manualToggle() } registerCommand( "shresetvermintracker", "Resets the Vermin Tracker" diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java index cdea4e3ee..9ef1fd31b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java @@ -104,6 +104,11 @@ public class GardenConfig { @Accordion public YawPitchDisplayConfig yawPitchDisplay = new YawPitchDisplayConfig(); + @Expose + @ConfigOption(name = "Sensitivity Reducer", desc = "") + @Accordion + public SensitivityReducerConfig sensitivityReducerConfig = new SensitivityReducerConfig(); + @Expose @ConfigOption(name = "Crop Start Location", desc = "") @Accordion diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/SensitivityReducerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/SensitivityReducerConfig.java new file mode 100644 index 000000000..1904dbdc1 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/SensitivityReducerConfig.java @@ -0,0 +1,69 @@ +package at.hannibal2.skyhanni.config.features.garden; + +import at.hannibal2.skyhanni.config.core.config.Position; +import com.google.gson.annotations.Expose; +import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; +import io.github.moulberry.moulconfig.annotations.ConfigEditorKeybind; +import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; +import io.github.moulberry.moulconfig.annotations.ConfigOption; +import io.github.moulberry.moulconfig.observer.Property; +import org.lwjgl.input.Keyboard; + +public class SensitivityReducerConfig { + @Expose + @ConfigOption( + name = "Mode", + desc = "Lowers mouse sensitivity while in the garden.") + @ConfigEditorDropdown() + public Mode mode = Mode.OFF; + + public enum Mode { + OFF("Disabled"), + TOOL("Holding farming tool"), + KEYBIND("Holding Keybind"); + private final String str; + + Mode(String str) { + this.str = str; + } + @Override + public String toString() { + return str; + } + } + + @Expose + @ConfigOption(name = "Keybind", desc = "When selected above, press this key to reduce the mouse sensitivity.") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_N) + public int keybind = Keyboard.KEY_N; + + @Expose + @ConfigOption(name = "Reducing factor", desc = "Changes by how much the sensitivity is lowered by.") + @ConfigEditorSlider(minValue = 1, maxValue = 50, minStep = 1) + public Property reducingFactor = Property.of(15.0F); + + @Expose + @ConfigOption( + name = "Show GUI", + desc = "Shows the GUI element while the feature is enabled.") + @ConfigEditorBoolean + public boolean showGUI = true; + + @Expose + @ConfigOption( + name = "Only in Ground", + desc = "Lower sensitivity when standing on the ground.") + @ConfigEditorBoolean + public Property onGround = Property.of(false); + + @Expose + @ConfigOption( + name = "Disable in Barn", + desc = "Disable reduced sensitivity in barn plot.") + @ConfigEditorBoolean + public Property onlyPlot = Property.of(true); + + @Expose + public Position position = new Position(400, 400, 0.8f); +} -- cgit