From 8ef05bc2e3d9f487f113d024c9a40aeb03b93b43 Mon Sep 17 00:00:00 2001 From: SinZ Date: Tue, 7 Jun 2022 14:58:14 +1000 Subject: [PATCH 1/2] Only add locations that aren't null This fixes errors on host when a farmhand is in certain cutscene maps like RSV CableCar --- PauseInMultiplayer/PauseInMultiplayer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PauseInMultiplayer/PauseInMultiplayer.cs b/PauseInMultiplayer/PauseInMultiplayer.cs index 29f23b0..d40ceff 100644 --- a/PauseInMultiplayer/PauseInMultiplayer.cs +++ b/PauseInMultiplayer/PauseInMultiplayer.cs @@ -535,7 +535,8 @@ private void GameLoop_UpdateTicking(object? sender, StardewModdingAPI.Events.Upd //pause all Monsters List farmerLocations = new List(); foreach (Farmer f in Game1.getOnlineFarmers()) - farmerLocations.Add(f.currentLocation); + if (f.currentLocation != null) + farmerLocations.Add(f.currentLocation); foreach (GameLocation l in farmerLocations) { foreach (Character c in l.characters) From 30f1f0bf591188d3dad9b8d9eb892fac7d0c0820 Mon Sep 17 00:00:00 2001 From: SinZ Date: Sat, 18 Feb 2023 10:59:44 +1100 Subject: [PATCH 2/2] Add setting for Any Pause Pauses --- PauseInMultiplayer/PauseInMultiplayer.cs | 27 ++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/PauseInMultiplayer/PauseInMultiplayer.cs b/PauseInMultiplayer/PauseInMultiplayer.cs index d40ceff..928c113 100644 --- a/PauseInMultiplayer/PauseInMultiplayer.cs +++ b/PauseInMultiplayer/PauseInMultiplayer.cs @@ -180,6 +180,14 @@ private void GameLoop_GameLaunched(object? sender, StardewModdingAPI.Events.Game setValue: value => this.config.AnyCutscenePauses = value ); + configMenu.AddBoolOption( + mod: this.ModManifest, + name: () => "Any player pauses", + tooltip: () => "(host only)\nWhen enabled, time will pause if any player is in a pausable state.", + getValue: () => this.config.AnyPausePauses, + setValue: value => this.config.AnyPausePauses = value + ); + } @@ -703,11 +711,20 @@ private bool shouldPause() return true; } - //normal pause logic (terminates via false) - foreach (string pauseTime in pauseTimeAll.Values) - if (pauseTime == "false") return false; + if (config.AnyPausePauses) + { + foreach (string pauseTime in pauseTimeAll.Values) + if (pauseTime == "true") return true; + + return false; + } + else + { + foreach (string pauseTime in pauseTimeAll.Values) + if (pauseTime == "false") return false; - return true; + return true; + } } else { @@ -766,6 +783,8 @@ class ModConfig public bool LockMonsters { get; set; } = true; public bool AnyCutscenePauses { get; set; } = false; + + public bool AnyPausePauses { get; set; } = false; public bool EnableVotePause { get; set; } = true;