From a4647cf529127a2f2f1f8d3ad7c9ec8bbff84c02 Mon Sep 17 00:00:00 2001 From: Remuchi <72476615+Remuchi@users.noreply.github.com> Date: Fri, 14 Jun 2024 18:47:15 +0700 Subject: [PATCH] =?UTF-8?q?[Fix]=20=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20Popup=20(#354)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: теперь попапы не видно в чате через всю станцию и стены * fix: use examine system instead of interaction --- Content.Client/Popups/PopupSystem.cs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Content.Client/Popups/PopupSystem.cs b/Content.Client/Popups/PopupSystem.cs index d9f47c0799..d24e2aff72 100644 --- a/Content.Client/Popups/PopupSystem.cs +++ b/Content.Client/Popups/PopupSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using Content.Client.UserInterface.Systems.Chat; using Content.Shared.Examine; using Content.Shared.Chat; using Content.Shared.GameTicking; @@ -10,7 +11,6 @@ using Robust.Client.Player; using Robust.Client.UserInterface; using Robust.Shared.Configuration; using Robust.Shared.Map; -using Robust.Shared.Network; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Replays; @@ -31,7 +31,6 @@ namespace Content.Client.Popups [Dependency] private readonly IReplayRecordingManager _replayRecording = default!; [Dependency] private readonly ExamineSystemShared _examine = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; - [Dependency] private readonly IClientNetManager _clientNet = default!; public IReadOnlyList WorldLabels => _aliveWorldLabels; public IReadOnlyList CursorLabels => _aliveCursorLabels; @@ -94,6 +93,13 @@ namespace Content.Client.Popups _aliveWorldLabels.Add(label); + // START WhiteDream + if (!_isLogging) + return; + + if (!_examine.InRangeUnOccluded(_playerManager.LocalEntity!.Value, coordinates, 10)) + return; + var fontSizeDict = new Dictionary { { PopupType.Medium, "12" }, @@ -103,14 +109,16 @@ namespace Content.Client.Popups }; var fontsize = fontSizeDict.GetValueOrDefault(type, "10"); - var fontcolor = type is PopupType.LargeCaution or PopupType.MediumCaution or PopupType.SmallCaution ? "c62828" : "aeabc4"; + var fontcolor = type is PopupType.LargeCaution or PopupType.MediumCaution or PopupType.SmallCaution + ? "c62828" + : "aeabc4"; - if (_isLogging) - { - var wrappedMEssage = $"[font size={fontsize}][color=#{fontcolor}]{message}[/color][/font]"; - var chatMsg = new ChatMessage(ChatChannel.Emotes, message, wrappedMEssage, GetNetEntity(EntityUid.Invalid), null); - _clientNet.DispatchLocalNetMessage(new MsgChatMessage { Message = chatMsg }); - } + var wrappedMEssage = $"[font size={fontsize}][color=#{fontcolor}]{message}[/color][/font]"; + var chatMsg = new ChatMessage(ChatChannel.Emotes, message, wrappedMEssage, + GetNetEntity(EntityUid.Invalid), null); + _uiManager.GetUIController().ProcessChatMessage(chatMsg); + + // END WhiteDream } #region Abstract Method Implementations