mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-02 00:57:26 +00:00
* Nubody (#42419) * Nubody * fix test fails * gibbing * lung test returns * doc comment * hand organ test * giblet test * yaml formatting * returning * relocate * trimming * re-smite * oops thusd tweak * arachnids have slower metabolism i guess * never mind the old behaviour is bad actually * rider whyyy * style changes and allat * fix collision --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> * C# files done * Visual nubody (humanoid appearance refactor) (#42476) * initial visual nubody * oops overlay * im so pheeming rn * conversion... * tests * comeback of the underwear * oops eyes * blabbl * zeds * yaml linted * search and visible count constraints * reordering * preserve previously selected markings colors * fix test * some ui niceties * ordering * make DB changes backwards-compatible/downgrade-friendly * fix things again * fix migration * vulpkanin markings limit increase * wrapping * code cleanup and more code cleanup and more code cleanup and more code cleanup and * fix slop ports * better sampling API * make filter work + use the method i made for its intended purpose * fix test fails real quick * magic mirror cleanup, remove TODO * don't 0-init the organ profile data * remove deltastates --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> * Let vox eat trash again (#42503) * C# complete port * Getting closer * Harpy Nubody Port * Port Feroxi, Kitsune. Fix some yml typos and remove ipcs stuff * Port Oni * Port Rest, except Motorkind * Port Motorkind * Remove more surgery, restore too much deleted stuff * Fix Typos and change some organ names. Need to split eyes next * Harpy HAve Wings again * Some fixes, More Surgeyr Removal, Copying of eye organs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Use correct Body imports * Markings Refactoring, Harpy Layering * Motorkind doesn't crash anymore. Some layer remappings. * Allow Organs to have Markings Displacements again. (#43604) * first shtep * readd markings support --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> * Fix STalk eyes and several layerings * Fix sexed organs (#42554) * Fix markings for several species, fit them for sexed organs and rename some files to fit them for it * Additional IPC-related removals * Vulpkanin eyes are now correct again * Fix Subtle Cultist Marks on species * Fix Asakim Sprites (sexed) and make CD imports work * Migration, error fixes, and Height * Fix humanoid profile voice being broken (#42550) Fix humanoid appearance voice being broken * Change Kitsune SexChanged Event to with ref * Fix asakim issue, Respirator fix * Simplify hands UI code (#42534) * Simplify hands UI code * i remembered about SortedHands in the component * minor cleanup --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> * Set size of Analyzer back to 350, Kitsune can't gib themselves no more. Migration * yml linter errors and an rudimentary onAdd Organ Functionality * Fixing it trying to remove nothing * midpoint migration * Why do you put so many organs everywhere * More missing prototypes * Migration of more organs * Forgot lungs * Move character preview handling into a specialized control (#41252) * Move character preview handling into a specialized control Co-authored-by: Quantum-cross <7065792+Quantum-cross@users.noreply.github.com> * Restore job name that I accidentally removed from character picker buttons * Just resolve dependencies the standard way --------- Co-authored-by: Quantum-cross <7065792+Quantum-cross@users.noreply.github.com> Co-authored-by: Janet Blackquill <uhhadd@gmail.com> * Drop ICharacterProfile/ICharacterAppearance interfaces (#42661) * Ensure profile loading only returns valid species (#42842) (Stable merge) (#42865) Co-authored-by: pathetic meowmeow <uhhadd@gmail.com> * Changes to make it work for us. * No more bald Harpy * OperatingTables instead of null * Adding Delta V Comments, commenting out instead of deleting * Fix broken Height Scale. * Remove HumanoidSilicon Mention * Did an error. Readded, uncommented. * Clean up Marking data structure, add tests for Zombie transformation (#42756) * Clean up Marking data structure, add tests for Zombie transformation * empty * AAAAAAAAAAAAAAAA --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> * Fix markings colour setting (#42771) * Fix: Markings Color For Downstream * Comment out A Leg. Remove Todo * Revert to original hidden species code --------- Co-authored-by: pathetic meowmeow <uhhadd@gmail.com> Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com> Co-authored-by: Absotively <jen@jenpollock.ca> Co-authored-by: Quantum-cross <7065792+Quantum-cross@users.noreply.github.com> Co-authored-by: Myra <vasilis@pikachu.systems>
195 lines
7.7 KiB
C#
195 lines
7.7 KiB
C#
using Content.Server.DoAfter;
|
|
using Content.Server.EUI;
|
|
using Content.Server.Explosion.EntitySystems;
|
|
using Content.Server.Jittering;
|
|
using Content.Server.Lightning;
|
|
using Content.Shared._DV.Psionics.Components.PsionicPowers;
|
|
using Content.Shared._DV.Psionics.Events.PowerActionEvents;
|
|
using Content.Shared._DV.Psionics.Events.PowerDoAfterEvents;
|
|
using Content.Shared._DV.Psionics.Systems.PsionicPowers;
|
|
using Content.Shared.Body;
|
|
using Content.Shared.DoAfter;
|
|
using Content.Shared.Gibbing;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Psionics.Glimmer;
|
|
using Robust.Server.Audio;
|
|
using Robust.Server.Player;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Random;
|
|
|
|
namespace Content.Server._DV.Psionics.Systems.PsionicPowers;
|
|
|
|
public sealed class PsionicEruptionSystem : BasePsionicPowerSystem<PsionicEruptionPowerComponent, PsionicEruptionPowerActionEvent>
|
|
{
|
|
[Dependency] private readonly IPlayerManager _player = default!;
|
|
[Dependency] private readonly IRobustRandom _random = default!;
|
|
[Dependency] private readonly AudioSystem _audio = default!;
|
|
[Dependency] private readonly DoAfterSystem _doAfter = default!;
|
|
[Dependency] private readonly EuiManager _eui = default!;
|
|
[Dependency] private readonly ExplosionSystem _explosion = default!;
|
|
[Dependency] private readonly GibbingSystem _gibbing = default!;
|
|
[Dependency] private readonly GlimmerSystem _glimmer = default!;
|
|
[Dependency] private readonly JitteringSystem _jittering = default!;
|
|
[Dependency] private readonly LightningSystem _lightning = default!;
|
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
|
|
|
private static readonly EntProtoId? Sparks = "EffectSparks";
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<PsionicEruptionPowerComponent, PsionicEruptionDoAfterEvent>(OnDoAfter);
|
|
}
|
|
|
|
protected override void OnPowerInit(Entity<PsionicEruptionPowerComponent> power, ref MapInitEvent args)
|
|
{
|
|
base.OnPowerInit(power, ref args);
|
|
|
|
if (!_player.TryGetSessionByEntity(power, out var session))
|
|
return;
|
|
|
|
_eui.OpenEui(new EruptionWarningEui(), session);
|
|
power.Comp.NextAnnoy = Timing.CurTime + TimeSpan.FromSeconds(60); // Minute grace period
|
|
}
|
|
|
|
protected override void OnPowerUsed(Entity<PsionicEruptionPowerComponent> psionic, ref PsionicEruptionPowerActionEvent args)
|
|
{
|
|
TimeSpan detonateTime;
|
|
|
|
if (_glimmer.GetGlimmerTier(_glimmer.Glimmer) == GlimmerTier.Critical)
|
|
detonateTime = psionic.Comp.MaxDetonateDelay;
|
|
else
|
|
detonateTime = psionic.Comp.MinDetonateDelay;
|
|
|
|
var sparkFrom = detonateTime / 2;
|
|
|
|
// Start the DoAfter.
|
|
var doAfterArgs = new DoAfterArgs(EntityManager, args.Performer, detonateTime, new PsionicEruptionDoAfterEvent(), args.Performer);
|
|
if (!_doAfter.TryStartDoAfter(doAfterArgs, out var doAfterId))
|
|
return;
|
|
|
|
psionic.Comp.SaveDoAfterId(doAfterId.Value); // Save the DoAfterID to reference it later.
|
|
|
|
var message = Loc.GetString("psionic-eruption-begin", ("user", args.Performer));
|
|
Popup.PopupEntity(message, args.Performer, PopupType.LargeCaution);
|
|
_audio.PlayPvs(psionic.Comp.SoundUse, args.Performer, AudioParams.Default.WithVolume(8f).WithMaxDistance(1.5f).WithRolloffFactor(3.5f));
|
|
_jittering.DoJitter(args.Performer, sparkFrom, true, 10, 16);
|
|
|
|
psionic.Comp.NextSpark = Timing.CurTime + sparkFrom;
|
|
AfterPowerUsed(psionic, args.Performer);
|
|
}
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
// Occasionally pester users of the Psionic Eruption power to use it.
|
|
var curTime = Timing.CurTime;
|
|
|
|
var query = EntityQueryEnumerator<PsionicEruptionPowerComponent>();
|
|
while (query.MoveNext(out var psionic, out var comp))
|
|
{
|
|
if (comp.GetDoAfterId() != null)
|
|
{
|
|
if (curTime >= comp.NextSpark)
|
|
CauseSparks(psionic, comp, curTime);
|
|
continue;
|
|
}
|
|
|
|
if (curTime < comp.NextAnnoy)
|
|
continue;
|
|
|
|
_glimmer.Glimmer += _random.Next(1, 5); // Increase glimmer by a random amount.
|
|
|
|
var msg = GetSeverityMessage(psionic, out var messageSize, out var minWait);
|
|
// Prompt the user to use the power.
|
|
Popup.PopupEntity(Loc.GetString(msg, ("user", psionic)), psionic, psionic, messageSize);
|
|
comp.NextAnnoy = curTime + minWait + TimeSpan.FromSeconds(_random.Next(0, 10)); // Add a random delay to the next annoyance.
|
|
}
|
|
}
|
|
|
|
private string GetSeverityMessage(EntityUid psionic, out PopupType messageSize, out TimeSpan minWait)
|
|
{
|
|
string message;
|
|
switch (_glimmer.GetGlimmerTier(_glimmer.Glimmer))
|
|
{
|
|
case GlimmerTier.Minimal:
|
|
default:
|
|
message = "psionic-eruption-annoy-minimal";
|
|
minWait = TimeSpan.FromSeconds(60);
|
|
messageSize = PopupType.Small;
|
|
break;
|
|
case GlimmerTier.Low:
|
|
message = "psionic-eruption-annoy-low";
|
|
minWait = TimeSpan.FromSeconds(45);
|
|
messageSize = PopupType.Small;
|
|
break;
|
|
case GlimmerTier.Moderate:
|
|
message = "psionic-eruption-annoy-moderate";
|
|
minWait = TimeSpan.FromSeconds(30);
|
|
messageSize = PopupType.Small;
|
|
break;
|
|
case GlimmerTier.High:
|
|
message = "psionic-eruption-annoy-high";
|
|
minWait = TimeSpan.FromSeconds(25);
|
|
messageSize = PopupType.Medium;
|
|
Spawn(Sparks, Transform(psionic).Coordinates);
|
|
break;
|
|
case GlimmerTier.Dangerous:
|
|
message = "psionic-eruption-annoy-dangerous";
|
|
minWait = TimeSpan.FromSeconds(20);
|
|
messageSize = PopupType.Large;
|
|
Spawn(Sparks, Transform(psionic).Coordinates);
|
|
break;
|
|
case GlimmerTier.Critical:
|
|
message = "psionic-eruption-annoy-critical";
|
|
minWait = TimeSpan.FromSeconds(10);
|
|
messageSize = PopupType.LargeCaution;
|
|
Spawn(Sparks, Transform(psionic).Coordinates);
|
|
break;
|
|
}
|
|
|
|
return message;
|
|
}
|
|
|
|
private void CauseSparks(EntityUid psionic, PsionicEruptionPowerComponent comp, TimeSpan curTime)
|
|
{
|
|
if (_glimmer.GetGlimmerTier(_glimmer.Glimmer) == GlimmerTier.Critical && _random.Prob(0.125f))
|
|
{
|
|
_lightning.ShootRandomLightnings(psionic, 5f, _random.Next(1, 3));
|
|
}
|
|
_jittering.DoJitter(psionic, TimeSpan.FromSeconds(5), true, 10, 32);
|
|
Spawn(Sparks, Transform(psionic).Coordinates);
|
|
|
|
comp.NextSpark = curTime + TimeSpan.FromMilliseconds(500);
|
|
}
|
|
|
|
private void OnDoAfter(Entity<PsionicEruptionPowerComponent> psionic, ref PsionicEruptionDoAfterEvent args)
|
|
{
|
|
if (args.Handled)
|
|
return;
|
|
args.Handled = true;
|
|
psionic.Comp.RemoveSavedDoAfterId();
|
|
|
|
if (args.Cancelled || !TryComp<BodyComponent>(args.User, out var body))
|
|
return;
|
|
|
|
var pos = _transform.GetMapCoordinates(args.User);
|
|
_gibbing.Gib(args.User, user: args.User);
|
|
|
|
int boom = _glimmer.GetGlimmerTier(_glimmer.Glimmer) switch
|
|
{
|
|
GlimmerTier.Minimal => 4,
|
|
GlimmerTier.Low => 8,
|
|
GlimmerTier.Moderate => 12,
|
|
GlimmerTier.High => 16,
|
|
GlimmerTier.Dangerous => 32,
|
|
GlimmerTier.Critical => 64,
|
|
_ => 0
|
|
};
|
|
_explosion.QueueExplosion(pos, ExplosionSystem.DefaultExplosionPrototypeId, boom, 1, 5, psionic, maxTileBreak: 0);
|
|
}
|
|
}
|