From 2f1f274b2dbc41e41098bed384b0014cfa62e756 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 16 Jun 2023 22:38:08 -0400 Subject: [PATCH] fix Context.HasRemotePlayers being true when there's no farmhands --- docs/release-notes.md | 1 + src/SMAPI/Context.cs | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index 34090bf8..832feb92 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -14,6 +14,7 @@ * Fixed install error if a game folder has an invalid symlink. * For mod authors: + * Fixed `Context.HasRemotePlayers` being true when there's no farmhands connected. * Fixed error loading a mod if it sets `"MinimumApiVersion": null` explicitly. * For SMAPI toolkit users: diff --git a/src/SMAPI/Context.cs b/src/SMAPI/Context.cs index 978459e8..3e3ee784 100644 --- a/src/SMAPI/Context.cs +++ b/src/SMAPI/Context.cs @@ -88,7 +88,7 @@ namespace StardewModdingAPI public static bool IsSplitScreen => LocalMultiplayer.IsLocalMultiplayer(); /// Whether there are players connected over the network. - public static bool HasRemotePlayers => Context.IsMultiplayer && !Game1.hasLocalClientsOnly; + public static bool HasRemotePlayers => Context.IsMultiplayer && !Game1.hasLocalClientsOnly && Game1.getOnlineFarmers().Count > 1; /// Whether the current player is the main player. This is always true in single-player, and true when hosting in multiplayer. public static bool IsMainPlayer => Game1.IsMasterGame && Context.ScreenId == 0 && TitleMenu.subMenu is not FarmhandMenu; @@ -97,8 +97,7 @@ namespace StardewModdingAPI /********* ** Public methods *********/ - /// Get whether a screen ID is still active. - /// The screen ID. + /// Get whether a screen ID is still active. The screen ID. public static bool HasScreenId(int id) { return Context.ActiveScreenIds.Contains(id);