From 82ad4cef0ddca024db6df6d80358e54d965538dc Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 30 Apr 2018 21:46:05 -0400 Subject: fix input freeze on shipping screen (#482) --- src/SMAPI/Framework/SGame.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/SMAPI') diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index a580d3eb..d9e90896 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -210,6 +210,17 @@ namespace StardewModdingAPI.Framework { try { + /********* + ** Update input + *********/ + // This should *always* run, even when suppressing mod events, since the game uses + // this too. For example, doing this after mod event suppression would prevent the + // user from doing anything on the overnight shipping screen. + SInputState previousInputState = this.Input.Clone(); + SInputState inputState = this.Input; + if (this.IsActive) + inputState.TrueUpdate(); + /********* ** Skip conditions *********/ @@ -388,12 +399,8 @@ namespace StardewModdingAPI.Framework /********* ** Input events (if window has focus) *********/ - if (Game1.game1.IsActive) + if (this.IsActive) { - SInputState previousInputState = this.Input.Clone(); - SInputState inputState = this.Input; - inputState.TrueUpdate(); - // raise events bool isChatInput = Game1.IsChatting || (Context.IsMultiplayer && Context.IsWorldReady && Game1.activeClickableMenu == null && Game1.currentMinigame == null && inputState.IsAnyDown(Game1.options.chatButton)); if (!isChatInput) -- cgit