From 70d865b2d2348f5442b3d6d24b7bab0152ab6cc1 Mon Sep 17 00:00:00 2001 From: FaDeOkno Date: Wed, 14 Aug 2024 16:43:40 +0400 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=D1=8B.=20=D0=9D=D0=B0?= =?UTF-8?q?=D1=88=D1=91=D0=BB=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D0=BE=D0=B5=20=D1=80=D0=B5=D1=88=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC=D1=8B=20=D1=81=20?= =?UTF-8?q?=D0=B3=D0=B0=D0=BB=D0=BB=D1=8E=D1=86=D0=B8=D0=BD=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=D0=BC=D0=B8=20=D0=B8=20=D0=BF=D1=80=D0=B8=D0=B7?= =?UTF-8?q?=D1=80=D0=B0=D0=BA=D0=B0=D0=BC=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Client/ADT/Bark/Systems/SpeechBarksSystem.cs | 6 ++++-- .../Hallucinations/Systems/HallucinationsSystem.cs | 4 ++-- .../ADT/Phantom/EntitySystems/PhantomSystem.cs | 12 ++++++------ Content.Server/Chat/Systems/ChatSystem.cs | 9 ++++++++- Content.Shared/Eye/VisibilityFlags.cs | 2 +- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Content.Client/ADT/Bark/Systems/SpeechBarksSystem.cs b/Content.Client/ADT/Bark/Systems/SpeechBarksSystem.cs index 305e1e100e9..ba5247a95f7 100644 --- a/Content.Client/ADT/Bark/Systems/SpeechBarksSystem.cs +++ b/Content.Client/ADT/Bark/Systems/SpeechBarksSystem.cs @@ -111,14 +111,16 @@ private async void OnEntitySpoke(PlaySpeechBarksEvent ev) break; var entity = GetEntity(ev.Source.Value); if (entity == EntityUid.Invalid || _player.LocalEntity == null) - continue; + break; if (Deleted(entity) || Terminating(entity)) - continue; + break; if (!HasComp(entity) || !HasComp(_player.LocalEntity.Value)) continue; if (Transform(entity).Coordinates.TryDistance(EntityManager, Transform(_player.LocalEntity.Value).Coordinates, out var distance) && distance > SharedChatSystem.VoiceRange) continue; + if (Transform(entity).ParentUid == EntityUid.Invalid) + continue; _audio.PlayEntity(audioResource.AudioStream, entity, audioParams.WithPitchScale(_random.NextFloat(ev.Pitch - 0.1f, ev.Pitch + 0.1f))); diff --git a/Content.Server/ADT/Hallucinations/Systems/HallucinationsSystem.cs b/Content.Server/ADT/Hallucinations/Systems/HallucinationsSystem.cs index 82e3ce991bd..4b376ffa321 100644 --- a/Content.Server/ADT/Hallucinations/Systems/HallucinationsSystem.cs +++ b/Content.Server/ADT/Hallucinations/Systems/HallucinationsSystem.cs @@ -44,7 +44,7 @@ public override void Initialize() private void OnHallucinationsInit(EntityUid uid, HallucinationsComponent component, MapInitEvent args) { - //component.Layer = _random.Next(100, 150); + component.Layer = _random.Next(100, 150); if (!_entityManager.TryGetComponent(uid, out var eye)) return; UpdatePreset(component); @@ -57,7 +57,7 @@ private void OnHallucinationsInit(EntityUid uid, HallucinationsComponent compone private void OnHallucinationsDiseaseInit(EntityUid uid, HallucinationsDiseaseComponent component, MapInitEvent args) { - //component.Layer = _random.Next(100, 150); + component.Layer = _random.Next(100, 150); if (!_entityManager.TryGetComponent(uid, out var eye)) return; _eye.SetVisibilityMask(uid, eye.VisibilityMask | (ushort)VisibilityFlags.BaseHallucination, eye); diff --git a/Content.Server/ADT/Phantom/EntitySystems/PhantomSystem.cs b/Content.Server/ADT/Phantom/EntitySystems/PhantomSystem.cs index 9a9cd3058cb..6a69c00c704 100644 --- a/Content.Server/ADT/Phantom/EntitySystems/PhantomSystem.cs +++ b/Content.Server/ADT/Phantom/EntitySystems/PhantomSystem.cs @@ -293,7 +293,7 @@ private void OnStatusEnded(EntityUid uid, PhantomComponent component, StatusEffe /// Event private void OnRequestStyleMenu(EntityUid uid, PhantomComponent component, OpenPhantomStylesMenuActionEvent args) { - if (_entityManager.TryGetComponent(uid, out var actorComponent)) + if (_mindSystem.TryGetMind(uid, out _, out var mind) && mind.Session != null) { var ev = new RequestPhantomStyleMenuEvent(GetNetEntity(uid)); @@ -304,7 +304,7 @@ private void OnRequestStyleMenu(EntityUid uid, PhantomComponent component, OpenP ev.Prototypes.Add(prototype.ID); } ev.Prototypes.Sort(); - RaiseNetworkEvent(ev, actorComponent.PlayerSession); + RaiseNetworkEvent(ev, mind.Session); } } @@ -348,7 +348,7 @@ private void OnRequestFreedomMenu(EntityUid uid, PhantomComponent component, Fre return; } - if (_entityManager.TryGetComponent(uid, out var actorComponent)) + if (_mindSystem.TryGetMind(uid, out _, out var mind) && mind.Session != null) { var ev = new RequestPhantomFreedomMenuEvent(GetNetEntity(uid)); @@ -367,7 +367,7 @@ private void OnRequestFreedomMenu(EntityUid uid, PhantomComponent component, Fre } } ev.Prototypes.Sort(); - RaiseNetworkEvent(ev, actorComponent.PlayerSession); + RaiseNetworkEvent(ev, mind.Session); } args.Handled = true; @@ -423,7 +423,7 @@ private void OnRequestVesselMenu(EntityUid uid, PhantomComponent component, Haun return; } - if (_entityManager.TryGetComponent(uid, out var actorComponent)) + if (_mindSystem.TryGetMind(uid, out _, out var mind) && mind.Session != null) { var ev = new RequestPhantomVesselMenuEvent(GetNetEntity(uid), new()); @@ -477,7 +477,7 @@ private void OnRequestVesselMenu(EntityUid uid, PhantomComponent component, Haun ev.Vessels.Add((netEnt, profile, meta.EntityName)); } ev.Vessels.Sort(); - RaiseNetworkEvent(ev, actorComponent.PlayerSession); + RaiseNetworkEvent(ev, mind.Session); } args.Handled = true; diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index ee690aabcfb..b5318048f68 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -398,7 +398,7 @@ public void DispatchStationAnnouncement( #endregion #region Private API - + private void SendEntitySpeak( EntityUid source, string originalMessage, @@ -460,6 +460,10 @@ private void SendEntitySpeak( } // ADT Languages end + if (string.IsNullOrEmpty(FormattedMessage.EscapeText(coloredMessage))) // ADT Chat fix + return; + + name = FormattedMessage.EscapeText(name); var wrappedMessage = Loc.GetString(speech.Bold ? "chat-manager-entity-say-bold-wrap-message" : "chat-manager-entity-say-wrap-message", ("entityName", name), @@ -597,6 +601,9 @@ private void SendEntityWhisper( language = _language.GetCurrentLanguage(source); // ADT Languages end + if (string.IsNullOrEmpty(FormattedMessage.EscapeText(coloredMessage))) // ADT Chat fix + return; + foreach (var (session, data) in GetRecipients(source, WhisperMuffledRange)) { EntityUid listener; diff --git a/Content.Shared/Eye/VisibilityFlags.cs b/Content.Shared/Eye/VisibilityFlags.cs index 54ee8dede03..82bdb234bd5 100644 --- a/Content.Shared/Eye/VisibilityFlags.cs +++ b/Content.Shared/Eye/VisibilityFlags.cs @@ -10,7 +10,7 @@ public enum VisibilityFlags : int Normal = 1 << 0, Ghost = 1 << 1, // ADT Phantom PhantomVessel = 2 << 1, // ADT Phantom - BaseHallucination = 3 << 1, // ADT Phantom + BaseHallucination = 4 << 1, // ADT Phantom } }