mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
<!-- 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>
116 lines
4.1 KiB
C#
116 lines
4.1 KiB
C#
using Content.Server.Actions;
|
|
using Content.Server.Antag;
|
|
using Content.Server.Language;
|
|
using Content.Server.Mind;
|
|
using Content.Server.Roles;
|
|
using Content.Shared._EE.Shadowling;
|
|
using Content.Shared._EE.Shadowling.Components;
|
|
using Content.Shared._EE.Shadowling.Thrall;
|
|
using Content.Shared.Actions;
|
|
using Content.Shared.Examine;
|
|
using Content.Shared.Overlays.Switchable;
|
|
|
|
namespace Content.Server._EE.Shadowling;
|
|
|
|
|
|
/// <summary>
|
|
/// This handles Thralls antag briefing and abilities
|
|
/// </summary>
|
|
public sealed class ShadowlingThrallSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly AntagSelectionSystem _antag = default!;
|
|
[Dependency] private readonly ActionsSystem _actions = default!;
|
|
[Dependency] private readonly LanguageSystem _language = default!;
|
|
[Dependency] private readonly MindSystem _mind = default!;
|
|
[Dependency] private readonly RoleSystem _roles = default!;
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<ThrallComponent, ComponentStartup>(OnStartup);
|
|
SubscribeLocalEvent<ThrallComponent, ComponentRemove>(OnRemove);
|
|
|
|
SubscribeLocalEvent<ThrallComponent, ExaminedEvent>(OnExamined);
|
|
}
|
|
|
|
private void OnStartup(EntityUid uid, ThrallComponent component, ComponentStartup args)
|
|
{
|
|
// antag stuff
|
|
if (!_mind.TryGetMind(uid, out var mindId, out var mind))
|
|
return;
|
|
|
|
if (mindId == default || !_roles.MindHasRole<ShadowlingRoleComponent>(mindId))
|
|
{
|
|
_roles.MindAddRole(mindId, "MindRoleThrall");
|
|
}
|
|
|
|
if (mind?.Session != null)
|
|
_antag.SendBriefing(uid, Loc.GetString("thrall-role-greeting"), Color.MediumPurple, component.ThrallConverted);
|
|
|
|
_language.AddLanguage(uid, component.SlingLanguageId);
|
|
|
|
|
|
var nightVision = EnsureComp<NightVisionComponent>(uid);
|
|
nightVision.ToggleAction = "ActionThrallDarksight"; // todo: not sure if this is needed, need to test it without it
|
|
|
|
// Remove the night vision action because thrall darksight does the same thing, so why have 2 actions
|
|
if (nightVision.ToggleActionEntity is null)
|
|
return;
|
|
_actions.RemoveAction(nightVision.ToggleActionEntity.Value);
|
|
|
|
// Add Thrall Abilities
|
|
if (!TryComp<ActionsComponent>(uid, out var actions))
|
|
return;
|
|
|
|
EnsureComp<ThrallGuiseComponent>(uid);
|
|
_actions.AddAction(
|
|
uid,
|
|
ref component.ActionThrallDarksightEntity,
|
|
component.ActionThrallDarksight,
|
|
component: actions);
|
|
|
|
_actions.AddAction(
|
|
uid,
|
|
ref component.ActionGuiseEntity,
|
|
component.ActionGuise,
|
|
component: actions);
|
|
}
|
|
|
|
private void OnRemove(EntityUid uid, ThrallComponent component, ComponentRemove args)
|
|
{
|
|
if (_mind.TryGetMind(uid, out var mindId, out _))
|
|
_roles.MindRemoveRole<ShadowlingRoleComponent>(mindId);
|
|
|
|
_actions.RemoveAction(component.ActionThrallDarksightEntity);
|
|
_actions.RemoveAction(component.ActionGuiseEntity);
|
|
|
|
RemComp<NightVisionComponent>(uid);
|
|
RemComp<ThrallGuiseComponent>(uid);
|
|
|
|
if (HasComp<LesserShadowlingComponent>(uid))
|
|
RemCompDeferred<LesserShadowlingComponent>(uid);
|
|
|
|
if (component.Converter == null)
|
|
return;
|
|
|
|
// Adjust lightning resistance for shadowling
|
|
var shadowling = component.Converter.Value;
|
|
var shadowlingComp = EntityManager.GetComponent<ShadowlingComponent>(shadowling);
|
|
var shadowlingSystem = EntityManager.System<ShadowlingSystem>();
|
|
|
|
shadowlingSystem.OnThrallRemoved(shadowling, uid, shadowlingComp);
|
|
}
|
|
|
|
private void OnExamined(EntityUid uid, ThrallComponent component, ExaminedEvent args)
|
|
{
|
|
if (!HasComp<ShadowlingComponent>(args.Examiner))
|
|
return;
|
|
|
|
if (component.Converter == null)
|
|
return;
|
|
|
|
if (component.Converter == args.Examiner)
|
|
args.PushMarkup($"[color=red]{Loc.GetString("shadowling-thrall-examined")}[/color]"); // Indicates that it is your Thrall
|
|
}
|
|
}
|