diff --git a/Content.Client/ADT/Bark/Systems/SpeechBarksSystem.cs b/Content.Client/ADT/Bark/Systems/SpeechBarksSystem.cs index 305e1e100e..ba5247a95f 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 27b5440296..4b376ffa32 100644 --- a/Content.Server/ADT/Hallucinations/Systems/HallucinationsSystem.cs +++ b/Content.Server/ADT/Hallucinations/Systems/HallucinationsSystem.cs @@ -50,7 +50,7 @@ private void OnHallucinationsInit(EntityUid uid, HallucinationsComponent compone UpdatePreset(component); _eye.SetVisibilityMask(uid, eye.VisibilityMask | (ushort)VisibilityFlags.BaseHallucination, eye); - _eye.SetVisibilityMask(uid, eye.VisibilityMask | component.Layer, eye); + //_eye.SetVisibilityMask(uid, eye.VisibilityMask | component.Layer, eye); _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(uid):player} began to hallucinate."); } @@ -62,7 +62,7 @@ private void OnHallucinationsDiseaseInit(EntityUid uid, HallucinationsDiseaseCom return; _eye.SetVisibilityMask(uid, eye.VisibilityMask | (ushort)VisibilityFlags.BaseHallucination, eye); - _eye.SetVisibilityMask(uid, eye.VisibilityMask | component.Layer, eye); + //_eye.SetVisibilityMask(uid, eye.VisibilityMask | component.Layer, eye); _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(uid):player} began to hallucinate."); } @@ -87,7 +87,7 @@ private void OnHallucinationsShutdown(EntityUid uid, HallucinationsComponent com return; _eye.SetVisibilityMask(uid, eye.VisibilityMask & ~(ushort)VisibilityFlags.BaseHallucination, eye); - _eye.SetVisibilityMask(uid, eye.VisibilityMask & ~component.Layer, eye); + //_eye.SetVisibilityMask(uid, eye.VisibilityMask & ~component.Layer, eye); _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(uid):player} stopped hallucinating."); } @@ -98,7 +98,7 @@ private void OnHallucinationsDiseaseShutdown(EntityUid uid, HallucinationsDiseas return; _eye.SetVisibilityMask(uid, eye.VisibilityMask & ~(ushort)VisibilityFlags.BaseHallucination, eye); - _eye.SetVisibilityMask(uid, eye.VisibilityMask & ~component.Layer, eye); + //_eye.SetVisibilityMask(uid, eye.VisibilityMask & ~component.Layer, eye); _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(uid):player} stopped hallucinating."); } diff --git a/Content.Server/ADT/Phantom/EntitySystems/PhantomSystem.cs b/Content.Server/ADT/Phantom/EntitySystems/PhantomSystem.cs index 9a9cd3058c..6a69c00c70 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/ADT/Poltergeist/Systems/PoltergeistSystem.cs b/Content.Server/ADT/Poltergeist/Systems/PoltergeistSystem.cs index 447e18372f..d4a5fc17d8 100644 --- a/Content.Server/ADT/Poltergeist/Systems/PoltergeistSystem.cs +++ b/Content.Server/ADT/Poltergeist/Systems/PoltergeistSystem.cs @@ -53,19 +53,19 @@ public override void Initialize() SubscribeLocalEvent(OnTrySpeak); SubscribeLocalEvent(OnSinguloConsumeAttempt); - SubscribeLocalEvent(OnMobState); - } - private void OnMobState(EntityUid uid, PotentialPoltergeistComponent component, MobStateChangedEvent args) - { - if (args.NewMobState == MobState.Dead); - { - if (_mindSystem.TryGetMind(uid, out var mindId, out var mind)) - { - var poltergei = Spawn("ADTMobPoltergeist", Transform(uid).Coordinates); - _mindSystem.TransferTo(mindId, poltergei); - } - } + // SubscribeLocalEvent(OnMobState); } + // private void OnMobState(EntityUid uid, PotentialPoltergeistComponent component, MobStateChangedEvent args) + // { + // if (args.NewMobState == MobState.Dead); + // { + // if (_mindSystem.TryGetMind(uid, out var mindId, out var mind)) + // { + // var poltergei = Spawn("ADTMobPoltergeist", Transform(uid).Coordinates); + // _mindSystem.TransferTo(mindId, poltergei); + // } + // } + // } private void OnMapInit(EntityUid uid, PoltergeistComponent component, MapInitEvent args) { diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index ee690aabcf..b5318048f6 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.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index b68c279b3e..733d49a5e9 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -6,6 +6,7 @@ using Content.Server.Roles.Jobs; using Content.Server.Warps; using Content.Shared.Actions; +using Content.Shared.ADT.Poltergeist; using Content.Shared.Examine; using Content.Shared.Eye; using Content.Shared.Follower; @@ -447,7 +448,14 @@ private bool IsValidSpawnPosition(EntityCoordinates? spawnPosition) _minds.TransferTo(mind.Owner, null, createGhost: false, mind: mind.Comp); return null; } - + // ADT Poltergeist start + if (HasComp(mind.Comp.OwnedEntity)) + { + var polter = SpawnAtPosition("ADTMobPoltergeist", spawnPosition.Value); + _minds.TransferTo(mind.Owner, polter, mind: mind.Comp); + return polter; + } + // ADT Poltergeist end var ghost = SpawnAtPosition(GameTicker.ObserverPrototypeName, spawnPosition.Value); var ghostComponent = Comp(ghost); diff --git a/Content.Shared/Eye/VisibilityFlags.cs b/Content.Shared/Eye/VisibilityFlags.cs index 54ee8dede0..82bdb234bd 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 } } diff --git a/Resources/Prototypes/ADT/StatusEffects/starvation.yml b/Resources/Prototypes/ADT/StatusEffects/starvation.yml new file mode 100644 index 0000000000..41ad270d8a --- /dev/null +++ b/Resources/Prototypes/ADT/StatusEffects/starvation.yml @@ -0,0 +1,2 @@ +- type: statusEffect + id: ADTStarvation diff --git a/Resources/Prototypes/Entities/Mobs/Species/base.yml b/Resources/Prototypes/Entities/Mobs/Species/base.yml index 90617c7f39..1f140417fc 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/base.yml @@ -133,6 +133,7 @@ - StaminaModifier - Flashed - ADTHallucinations + - ADTStarvation - type: Body prototype: Human requiredLegs: 2