From 342b91ff804c682717c25c6908d1033b799445b6 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 22 Apr 2023 11:55:39 -0400 Subject: [PATCH] add multiplayer player type to window titles --- docs/release-notes.md | 1 + src/SMAPI/Framework/SCore.cs | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index d091d153..49545d50 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -9,6 +9,7 @@ ## Upcoming release * For players: + * In multiplayer, the game/SMAPI window titles now show whether you're the main player or a farmhand. * Fixed logged SMAPI errors not having line numbers on Linux/macOS. ## 3.18.3 diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index abba7f3b..d16f7248 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -852,6 +852,9 @@ namespace StardewModdingAPI.Framework this.Monitor.Log(context); + // add context to window titles + this.UpdateWindowTitles(); + // raise events this.OnLoadStageChanged(LoadStage.Ready); events.SaveLoaded.RaiseEmpty(); @@ -1203,6 +1206,7 @@ namespace StardewModdingAPI.Framework case LoadStage.None: this.JustReturnedToTitle = true; + this.UpdateWindowTitles(); break; case LoadStage.Loaded: @@ -1450,15 +1454,14 @@ namespace StardewModdingAPI.Framework string consoleTitle = $"SMAPI {Constants.ApiVersion} - running Stardew Valley {Constants.GameVersion}"; string gameTitle = $"Stardew Valley {Constants.GameVersion} - running SMAPI {Constants.ApiVersion}"; + string suffix = ""; if (this.ModRegistry.AreAllModsLoaded) - { - int modsLoaded = this.ModRegistry.GetAll().Count(); - consoleTitle += $" with {modsLoaded} mods"; - gameTitle += $" with {modsLoaded} mods"; - } + suffix += $" with {this.ModRegistry.GetAll().Count()} mods"; + if (Context.IsMultiplayer) + suffix += $" [{(Context.IsMainPlayer ? "main player" : "farmhand")}]"; - this.Game.Window.Title = gameTitle; - this.LogManager.SetConsoleTitle(consoleTitle); + this.Game.Window.Title = gameTitle + suffix; + this.LogManager.SetConsoleTitle(consoleTitle + suffix); } /// Log a warning if software known to cause issues is installed.