diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-09-08 00:10:24 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-09-08 00:10:24 -0400 |
commit | 398c7d66cb707f475b239c9ba5b06154fd518b49 (patch) | |
tree | 0f3b19d09a9070607c60e049aa3fa318af0735d1 | |
parent | 5e43bdbf5cd6dbab36c25287c85d42ccfeea2c83 (diff) | |
download | SMAPI-398c7d66cb707f475b239c9ba5b06154fd518b49.tar.gz SMAPI-398c7d66cb707f475b239c9ba5b06154fd518b49.tar.bz2 SMAPI-398c7d66cb707f475b239c9ba5b06154fd518b49.zip |
fix input handling issues in SMAPI 3.7
This commit reverses one of the input handling changes in 3.7 to fix...
* input being handled twice in some cases (e.g. a left-click to drop a shop item with Better Shop Menu would instantly sell it);
* an issue where Harvest With Scythe would cause the player to skid forward more than usual when scything crops;
* possibly other reported issues including gamepad input lag.
-rw-r--r-- | src/SMAPI/Framework/Input/SInputState.cs | 16 | ||||
-rw-r--r-- | src/SMAPI/Framework/SCore.cs | 4 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/SMAPI/Framework/Input/SInputState.cs b/src/SMAPI/Framework/Input/SInputState.cs index 3dfeb152..f618608a 100644 --- a/src/SMAPI/Framework/Input/SInputState.cs +++ b/src/SMAPI/Framework/Input/SInputState.cs @@ -29,9 +29,6 @@ namespace StardewModdingAPI.Framework.Input /// <summary>Whether there are new overrides in <see cref="CustomPressedKeys"/> or <see cref="CustomReleasedKeys"/> that haven't been applied to the previous state.</summary> private bool HasNewOverrides; - /// <summary>The game tick when the input state was last updated.</summary> - private uint? LastUpdateTick; - /********* ** Accessors @@ -55,14 +52,13 @@ namespace StardewModdingAPI.Framework.Input /********* ** Public methods *********/ - /// <summary>Update the current button states for the given tick. This does nothing if the input has already been updated for this tick (e.g. because SMAPI updated it before the game update).</summary> - public override void Update() - { - // skip if already updated - if (this.LastUpdateTick == SCore.TicksElapsed) - return; - this.LastUpdateTick = SCore.TicksElapsed; + /// <summary>This method is called by the game, and does nothing since SMAPI will already have updated by that point.</summary> + [Obsolete("This method should only be called by the game itself.")] + public override void Update() { } + /// <summary>Update the current button states for the given tick.</summary> + public void TrueUpdate() + { // update base state base.Update(); diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index 52b4b9cf..8be62ccf 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -423,7 +423,7 @@ namespace StardewModdingAPI.Framework private void OnGameInitialized() { // set initial state - this.Input.Update(); + this.Input.TrueUpdate(); // init watchers this.Watchers = new WatcherCore(this.Input, this.Game.GetObservableLocations()); @@ -492,7 +492,7 @@ namespace StardewModdingAPI.Framework // user from doing anything on the overnight shipping screen. SInputState inputState = this.Input; if (this.Game.IsActive) - inputState.Update(); + inputState.TrueUpdate(); /********* ** Special cases |