Skip to content

Commit

Permalink
фиксы. Нашёл временное решение проблемы с галлюцинациями и призраками.
Browse files Browse the repository at this point in the history
  • Loading branch information
FaDeOkno committed Aug 14, 2024
1 parent 5543980 commit 70d865b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
6 changes: 4 additions & 2 deletions Content.Client/ADT/Bark/Systems/SpeechBarksSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TransformComponent>(entity) || !HasComp<TransformComponent>(_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)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<EyeComponent>(uid, out var eye))
return;
UpdatePreset(component);
Expand All @@ -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<EyeComponent>(uid, out var eye))
return;
_eye.SetVisibilityMask(uid, eye.VisibilityMask | (ushort)VisibilityFlags.BaseHallucination, eye);
Expand Down
12 changes: 6 additions & 6 deletions Content.Server/ADT/Phantom/EntitySystems/PhantomSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ private void OnStatusEnded(EntityUid uid, PhantomComponent component, StatusEffe
/// <param name="args">Event</param>
private void OnRequestStyleMenu(EntityUid uid, PhantomComponent component, OpenPhantomStylesMenuActionEvent args)
{
if (_entityManager.TryGetComponent<ActorComponent?>(uid, out var actorComponent))
if (_mindSystem.TryGetMind(uid, out _, out var mind) && mind.Session != null)
{
var ev = new RequestPhantomStyleMenuEvent(GetNetEntity(uid));

Expand All @@ -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);
}
}

Expand Down Expand Up @@ -348,7 +348,7 @@ private void OnRequestFreedomMenu(EntityUid uid, PhantomComponent component, Fre
return;
}

if (_entityManager.TryGetComponent<ActorComponent?>(uid, out var actorComponent))
if (_mindSystem.TryGetMind(uid, out _, out var mind) && mind.Session != null)
{
var ev = new RequestPhantomFreedomMenuEvent(GetNetEntity(uid));

Expand All @@ -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;
Expand Down Expand Up @@ -423,7 +423,7 @@ private void OnRequestVesselMenu(EntityUid uid, PhantomComponent component, Haun
return;

}
if (_entityManager.TryGetComponent<ActorComponent?>(uid, out var actorComponent))
if (_mindSystem.TryGetMind(uid, out _, out var mind) && mind.Session != null)
{
var ev = new RequestPhantomVesselMenuEvent(GetNetEntity(uid), new());

Expand Down Expand Up @@ -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;
Expand Down
9 changes: 8 additions & 1 deletion Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public void DispatchStationAnnouncement(
#endregion

#region Private API

private void SendEntitySpeak(
EntityUid source,
string originalMessage,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Eye/VisibilityFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

}
}

0 comments on commit 70d865b

Please sign in to comment.