From 34e5590490a82055de700fd5d27c5dfe67dfffcd Mon Sep 17 00:00:00 2001 From: _nebula <41904486+misternebula@users.noreply.github.com> Date: Thu, 27 Jul 2023 19:34:45 +0100 Subject: [PATCH] make annoucements call different method --- QSB/DeathSync/Messages/PlayerDeathMessage.cs | 2 +- QSB/HUD/MultiplayerHUDManager.cs | 9 ++++++++- QSB/Player/Messages/PlayerJoinMessage.cs | 2 +- QSB/Player/Messages/PlayerKickMessage.cs | 6 +++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/QSB/DeathSync/Messages/PlayerDeathMessage.cs b/QSB/DeathSync/Messages/PlayerDeathMessage.cs index 376f7c09..142fa4f8 100644 --- a/QSB/DeathSync/Messages/PlayerDeathMessage.cs +++ b/QSB/DeathSync/Messages/PlayerDeathMessage.cs @@ -42,7 +42,7 @@ public class PlayerDeathMessage : QSBMessage var deathMessage = Necronomicon.GetPhrase(Data, NecronomiconIndex); if (deathMessage != null) { - MultiplayerHUDManager.Instance.WriteMessage(string.Format(deathMessage, playerName), Color.grey); + MultiplayerHUDManager.Instance.WriteSystemMessage(string.Format(deathMessage, playerName), Color.grey); } RespawnManager.Instance.OnPlayerDeath(player); diff --git a/QSB/HUD/MultiplayerHUDManager.cs b/QSB/HUD/MultiplayerHUDManager.cs index 04c6f2a2..702c8faa 100644 --- a/QSB/HUD/MultiplayerHUDManager.cs +++ b/QSB/HUD/MultiplayerHUDManager.cs @@ -83,6 +83,13 @@ internal class MultiplayerHUDManager : MonoBehaviour, IAddComponentOnStart private readonly ListStack<(string msg, Color color)> _messages = new(false); private float _lastMessageTime; + // this just exists so i can patch this in my tts addon + // perks of being a qsb dev :-) + public void WriteSystemMessage(string message, Color color) + { + WriteMessage(message, color); + } + public void WriteMessage(string message, Color color) { // dont write messages when not ready @@ -453,7 +460,7 @@ internal class MultiplayerHUDManager : MonoBehaviour, IAddComponentOnStart Destroy(player.HUDBox?.gameObject); Destroy(player.MinimapPlayerMarker); - WriteMessage(string.Format(QSBLocalization.Current.PlayerLeftTheGame, player.Name), Color.yellow); + WriteSystemMessage(string.Format(QSBLocalization.Current.PlayerLeftTheGame, player.Name), Color.yellow); } private PlanetTrigger CreateTrigger(string parentPath, HUDIcon icon) diff --git a/QSB/Player/Messages/PlayerJoinMessage.cs b/QSB/Player/Messages/PlayerJoinMessage.cs index f7af042b..005777b1 100644 --- a/QSB/Player/Messages/PlayerJoinMessage.cs +++ b/QSB/Player/Messages/PlayerJoinMessage.cs @@ -127,7 +127,7 @@ public class PlayerJoinMessage : QSBMessage var player = QSBPlayerManager.GetPlayer(From); player.Name = PlayerName; - MultiplayerHUDManager.Instance.WriteMessage(string.Format(QSBLocalization.Current.PlayerJoinedTheGame, player.Name), Color.green); + MultiplayerHUDManager.Instance.WriteSystemMessage(string.Format(QSBLocalization.Current.PlayerJoinedTheGame, player.Name), Color.green); DebugLog.DebugWrite($"{player} joined. qsbVersion:{QSBVersion}, gameVersion:{GameVersion}, dlcInstalled:{DlcInstalled}", MessageType.Info); } diff --git a/QSB/Player/Messages/PlayerKickMessage.cs b/QSB/Player/Messages/PlayerKickMessage.cs index 84834b5e..ec074623 100644 --- a/QSB/Player/Messages/PlayerKickMessage.cs +++ b/QSB/Player/Messages/PlayerKickMessage.cs @@ -36,15 +36,15 @@ internal class PlayerKickMessage : QSBMessage { if (QSBPlayerManager.PlayerExists(PlayerId)) { - MultiplayerHUDManager.Instance.WriteMessage(string.Format(QSBLocalization.Current.PlayerWasKicked, QSBPlayerManager.GetPlayer(PlayerId).Name), Color.red); + MultiplayerHUDManager.Instance.WriteSystemMessage(string.Format(QSBLocalization.Current.PlayerWasKicked, QSBPlayerManager.GetPlayer(PlayerId).Name), Color.red); return; } - MultiplayerHUDManager.Instance.WriteMessage(string.Format(QSBLocalization.Current.PlayerWasKicked, PlayerId), Color.red); + MultiplayerHUDManager.Instance.WriteSystemMessage(string.Format(QSBLocalization.Current.PlayerWasKicked, PlayerId), Color.red); return; } - MultiplayerHUDManager.Instance.WriteMessage(string.Format(QSBLocalization.Current.KickedFromServer, Data), Color.red); + MultiplayerHUDManager.Instance.WriteSystemMessage(string.Format(QSBLocalization.Current.KickedFromServer, Data), Color.red); MenuManager.Instance.OnKicked(Data); NetworkClient.Disconnect();