Files
wwdpublic/Content.Server/_EE/Shadowling/ShadowlingChatSystem.cs
Lumminal 16ea61f52f Shadowling Antagonist (SS13 Port and Remake) (#2207)
<!--
Explain this PR in as much detail as applicable

Some example prompts to consider:
How might this affect the game? The codebase?
What might be some alternatives to this?
How/Who does this benefit/hurt [the game/codebase]?
-->

Ports Shadowlings from SS13 to SS14 with a remake to make them fun to
play.

Minimal Design Doc (not up-to-date, read comments in this repo for
updates):

https://github.com/Lumminal/SS14-Design-Docs-Lumminal/blob/main/Shadowling.md

---

- Abilities
  - [X] Hatch
  - [x] Glare
  - [X] Enthrall
  - [x] Veil
  - [x] Shadow Walk
  - [x] Icy Veins
  - [x] Collective Mind
  - [x] Rapid Re-Hatch
  - [x] Destroy Engines
  - [x] Sonic Screech
  - [x] Blindness Smoke
  - [x] Null Charge
  - [x] Black Recuperation
  - [x] Empowered Enthrall
  - [x] Nox Imperii
  - [x] Ascension
  - [x] Annihilate
  - [x] Hypnosis
  - [x] Plane-Shift
  - [x] Lighting Storm
  - [x] Ascendant Broadcast
- Antags
  - [X] Thrall
      - [x] Guise
      - [x] Thrall Darksight
  - [x] Lesser Shadowling
- Passive
  - [x] Light Resistance Scaling
  - [x] Shadowmind
  - [x] Damage on Light
- Other
  - [x] Sounds
  - [x] Sprites
  - [x] Psionic Interactions
  - [x] Handle Edge Cases
---

<details><summary><h1>Media</h1></summary>
<p>

https://www.youtube.com/watch?v=H-Ee5wuRINc

</p>
</details>

---

🆑
- add: The shadows have awakened, and their ascendance is soon to
follow. Do not enter maints.

---------

Signed-off-by: Lumminal <81829924+Lumminal@users.noreply.github.com>
2025-07-20 12:05:11 +10:00

86 lines
2.9 KiB
C#

using System.Linq;
using Content.Server.Administration.Managers;
using Content.Server.Chat.Managers;
using Content.Server.Chat.Systems;
using Content.Server.Language;
using Content.Shared._EE.Shadowling;
using Content.Shared.Chat;
using Content.Shared.Language;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Utility;
namespace Content.Server._EE.Shadowling;
/// <summary>
/// This handles Shadowling/Thrall communication
/// </summary>
public sealed class ShadowlingChatSystem : EntitySystem
{
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly LanguageSystem _language = default!;
/// <inheritdoc/>
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ShadowlingComponent, EntitySpokeEvent>(OnShadowlingSpeak);
SubscribeLocalEvent<ThrallComponent, EntitySpokeEvent>(OnThrallSpeak);
}
private void OnShadowlingSpeak(EntityUid uid, ShadowlingComponent component, EntitySpokeEvent args)
{
if (args.Source != uid || args.Language.ID != component.SlingLanguageId || args.IsWhisper)
return;
SendMessage(args.Source, args.Message, false, args.Language);
}
private void OnThrallSpeak(EntityUid uid, ThrallComponent component, EntitySpokeEvent args)
{
if (args.Source != uid || args.Language.ID != component.SlingLanguageId || args.IsWhisper)
return;
SendMessage(args.Source, args.Message, false, args.Language);
}
private void SendMessage(EntityUid source, string message, bool hideChat, LanguagePrototype language)
{
// Again, this is thanks to blood cult (I didn't wanna touch their code and break stuff so I just copypasted it)
var clients = GetClients(language.ID);
var playerName = Name(source);
var wrappedMessage = Loc.GetString("chat-manager-send-cult-chat-wrap-message",
("channelName", Loc.GetString("chat-manager-shadowling-channel-name")),
("player", playerName),
("message", FormattedMessage.EscapeText(message)));
_chatManager.ChatMessageToMany(ChatChannel.Telepathic,
message,
wrappedMessage,
source,
hideChat,
true,
clients.ToList(),
language.SpeechOverride.Color);
}
private IEnumerable<INetChannel> GetClients(string languageId)
{
return Filter.Empty()
.AddWhereAttachedEntity(entity => CanHear(entity, languageId))
.Recipients
.Union(_adminManager.ActiveAdmins)
.Select(p => p.Channel);
}
private bool CanHear(EntityUid entity, string languageId)
{
var understood = _language.GetUnderstoodLanguages(entity);
return understood.Any(language => language.Id == languageId);
}
}