fix Context.HasRemotePlayers being true when there's no farmhands

This commit is contained in:
Jesse Plamondon-Willard 2023-06-16 22:38:08 -04:00
parent 3c46bdaeb3
commit 2f1f274b2d
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 3 additions and 3 deletions

View File

@ -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:

View File

@ -88,7 +88,7 @@ namespace StardewModdingAPI
public static bool IsSplitScreen => LocalMultiplayer.IsLocalMultiplayer();
/// <summary>Whether there are players connected over the network.</summary>
public static bool HasRemotePlayers => Context.IsMultiplayer && !Game1.hasLocalClientsOnly;
public static bool HasRemotePlayers => Context.IsMultiplayer && !Game1.hasLocalClientsOnly && Game1.getOnlineFarmers().Count > 1;
/// <summary>Whether the current player is the main player. This is always true in single-player, and true when hosting in multiplayer.</summary>
public static bool IsMainPlayer => Game1.IsMasterGame && Context.ScreenId == 0 && TitleMenu.subMenu is not FarmhandMenu;
@ -97,8 +97,7 @@ namespace StardewModdingAPI
/*********
** Public methods
*********/
/// <summary>Get whether a screen ID is still active.</summary>
/// <param name="id">The screen ID.</param>
/// <summary>Get whether a screen ID is still active.</summary> <param name="id">The screen ID.</param>
public static bool HasScreenId(int id)
{
return Context.ActiveScreenIds.Contains(id);