Files
wwdpublic/Content.Server/_EE/Nightmare/Systems/LightEaterSystem.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

96 lines
3.1 KiB
C#

using System.Linq;
using Content.Server.Hands.Systems;
using Content.Server.Light.Components;
using Content.Server.PowerCell;
using Content.Shared._EE.Nightmare;
using Content.Shared._EE.Nightmare.Components;
using Content.Shared.Inventory;
using Content.Shared.Light.Components;
using Content.Shared.Silicons.Borgs.Components;
using Content.Shared.Weapons.Melee.Events;
namespace Content.Server._EE.Nightmare.Systems;
/// <summary>
/// This handles the Light Eater system.
/// Light Eater is an armblade that ashes any light that it attacks.
/// </summary>
public sealed class LightEaterSystem : EntitySystem
{
[Dependency] private readonly PowerCellSystem _powerCellSystem = default!;
[Dependency] private readonly HandsSystem _handsSystem = default!;
/// <inheritdoc/>
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<LightEaterUserComponent, ToggleLightEaterEvent>(OnToggleLightEater);
SubscribeLocalEvent<LightEaterComponent, MeleeHitEvent>(OnMeleeHit);
}
private void OnToggleLightEater(EntityUid uid, LightEaterUserComponent component, ToggleLightEaterEvent args)
{
component.Activated = !component.Activated;
if (!component.Activated)
{
var lightEater = Spawn(component.LightEaterProto, Transform(uid).Coordinates);
component.LightEaterEntity = lightEater;
if (!_handsSystem.TryPickupAnyHand(uid, lightEater, true))
{
QueueDel(component.LightEaterEntity);
}
}
else
{
if (component.LightEaterEntity != null)
QueueDel(component.LightEaterEntity);
}
}
private void OnMeleeHit(EntityUid uid, LightEaterComponent component, MeleeHitEvent args)
{
if (!args.IsHit
|| !args.HitEntities.Any())
return;
foreach (var target in args.HitEntities)
{
if (HasComp<PoweredLightComponent>(target))
{
Spawn("Ash", Transform(target).Coordinates);
QueueDel(target);
continue;
}
if (TryComp<InventoryComponent>(target, out var inv))
{
foreach (var container in inv.Containers)
{
foreach (var containerItem in container.ContainedEntities)
{
if (HasComp<HandheldLightComponent>(containerItem))
{
// not checking for point lights cuz of pda lights
Spawn("Ash", Transform(target).Coordinates);
QueueDel(containerItem);
}
}
}
}
if (HasComp<BorgChassisComponent>(target))
{
if (!_powerCellSystem.TryGetBatteryFromSlot(target, out var battery))
continue;
_powerCellSystem.SetDrawEnabled(target, false);
}
// could add more interactions in the future here
}
}
}