Files
wwdpublic/Content.Server/_EE/Shadowling/Systems/Abilities/CollectiveMind/ShadowlingNullChargeSystem.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

94 lines
2.9 KiB
C#

using Content.Server.DoAfter;
using Content.Server.Popups;
using Content.Server.Power.Components;
using Content.Shared._EE.Shadowling;
using Content.Shared.DoAfter;
using Content.Shared.Popups;
using Robust.Server.GameObjects;
namespace Content.Server._EE.Shadowling;
/// <summary>
/// This handles the Null Charge ability.
/// Null Charge is an ability that disables an APC until it gets fixed.
/// </summary>
public sealed class ShadowlingNullChargeSystem : EntitySystem
{
/// <inheritdoc/>
[Dependency] private readonly DoAfterSystem _doAfter = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ShadowlingNullChargeComponent, NullChargeEvent>(OnNullCharge);
SubscribeLocalEvent<ShadowlingNullChargeComponent, NullChargeDoAfterEvent>(OnNullChargeAfter);
}
private void OnNullCharge(EntityUid uid, ShadowlingNullChargeComponent component, NullChargeEvent args)
{
if (args.Handled)
return;
if (!IsApcInRange(uid, component.Range))
return;
var doAfterArgs = new DoAfterArgs(
EntityManager,
uid,
component.NullChargeToComplete,
new NullChargeDoAfterEvent(),
uid);
_popupSystem.PopupEntity(Loc.GetString("shadowling-null-charge-start"), uid, uid, PopupType.MediumCaution);
_doAfter.TryStartDoAfter(doAfterArgs);
}
private void OnNullChargeAfter(EntityUid uid, ShadowlingNullChargeComponent component, NullChargeDoAfterEvent args)
{
if (args.Cancelled)
return;
bool apcAffected = false;
foreach (var apc in _lookup.GetEntitiesInRange(uid, component.Range))
{
if (apcAffected)
break;
if (!TryComp<ApcComponent>(apc, out var apcComponent))
continue;
if (!TryComp<PowerNetworkBatteryComponent>(apc, out var battery))
continue;
if (apcComponent.MainBreakerEnabled)
{
apcComponent.MainBreakerEnabled = false;
battery.CanDischarge = false;
apcAffected = true;
}
}
if (apcAffected)
_popupSystem.PopupEntity(Loc.GetString("shadowling-null-charge-success"), uid, uid, PopupType.Medium);
var effectEnt = Spawn(component.NullChargeEffect, _transformSystem.GetMapCoordinates(uid));
_transformSystem.SetParent(effectEnt, uid);
}
private bool IsApcInRange(EntityUid uid, float range)
{
foreach (var target in _lookup.GetEntitiesInRange(uid, range))
{
if (HasComp<ApcComponent>(target))
return true;
}
return false;
}
}