mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 14:07:53 +03:00
<!-- This is a semi-strict format, you can add/remove sections as needed but the order/format should be kept the same Remove these comments before submitting --> <!-- 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]? --> This PR ports https://github.com/Goob-Station/Goob-Station/pull/2409 https://github.com/Goob-Station/Goob-Station/pull/2591 https://github.com/Goob-Station/Goob-Station/pull/2599 This PR was initially intended to be merged into White Dream repo, so my changes are marked as WD edit. <!-- A list of everything you have to do before this PR is "complete" You probably won't have to complete everything before merging but it's good to leave future references --> - [ ] Port pain numbness - [ ] Port nullrods - [ ] Port tile movement --- <!-- This is default collapsed, readers click to expand it and see all your media The PR media section can get very large at times, so this is a good way to keep it clean The title is written using HTML tags The title must be within the <summary> tags or you won't see it --> <details><summary><h1>Media</h1></summary> <p>     </p> </details> --- <!-- You can add an author after the `🆑` to change the name that appears in the changelog (ex: `🆑 Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> 🆑 - add: Ported Devil antag from Goobstation --------- Signed-off-by: Kai5 <68296202+Kai518@users.noreply.github.com> Signed-off-by: VMSolidus <evilexecutive@gmail.com> Co-authored-by: Solstice <solsticeofthewinter@gmail.com> Co-authored-by: VMSolidus <evilexecutive@gmail.com>
132 lines
4.5 KiB
C#
132 lines
4.5 KiB
C#
// SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
|
|
// SPDX-FileCopyrightText: 2025 Solstice <solsticeofthewinter@gmail.com>
|
|
// SPDX-FileCopyrightText: 2025 SolsticeOfTheWinter <solsticeofthewinter@gmail.com>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
using Content.Shared._Goobstation.DelayedDeath;
|
|
using Content.Shared._Goobstation.CheatDeath;
|
|
using Content.Server._Shitmed.DelayedDeath;
|
|
using Content.Server.Actions;
|
|
using Content.Server.Administration.Systems;
|
|
using Content.Server.Jittering;
|
|
using Content.Shared.Examine;
|
|
using Content.Shared.IdentityManagement;
|
|
using Content.Shared.Mobs.Systems;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Traits.Assorted;
|
|
using Robust.Shared.Network;
|
|
|
|
namespace Content.Server._Goobstation.Devil.CheatDeath;
|
|
|
|
public sealed partial class CheatDeathSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly RejuvenateSystem _rejuvenateSystem = default!;
|
|
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
|
[Dependency] private readonly ActionsSystem _actionsSystem = default!;
|
|
[Dependency] private readonly JitteringSystem _jitter = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<CheatDeathComponent, MapInitEvent>(OnInit);
|
|
SubscribeLocalEvent<CheatDeathComponent, ComponentRemove>(OnRemoval);
|
|
|
|
SubscribeLocalEvent<CheatDeathComponent, CheatDeathEvent>(OnDeathCheatAttempt);
|
|
|
|
SubscribeLocalEvent<CheatDeathComponent, ExaminedEvent>(OnExamined);
|
|
|
|
SubscribeLocalEvent<CheatDeathComponent, DelayedDeathEvent>(OnDelayedDeath);
|
|
}
|
|
|
|
private void OnInit(Entity<CheatDeathComponent> ent, ref MapInitEvent args)
|
|
{
|
|
_actionsSystem.AddAction(ent, ref ent.Comp.ActionEntity, ent.Comp.ActionCheatDeath);
|
|
}
|
|
|
|
private void OnRemoval(Entity<CheatDeathComponent> ent, ref ComponentRemove args)
|
|
{
|
|
_actionsSystem.RemoveAction(ent, ent.Comp.ActionEntity);
|
|
}
|
|
|
|
private void OnExamined(Entity<CheatDeathComponent> ent, ref ExaminedEvent args)
|
|
{
|
|
if (args.Examined != args.Examiner)
|
|
return;
|
|
|
|
if (ent.Comp.InfiniteRevives)
|
|
{
|
|
var unlimited = Loc.GetString("cheat-death-component-remaining-revives-unlimited");
|
|
args.PushMarkup(unlimited);
|
|
|
|
return;
|
|
}
|
|
|
|
var remaining = Loc.GetString("cheat-death-component-remaining-revives", ("amount", ent.Comp.ReviveAmount));
|
|
args.PushMarkup(remaining);
|
|
|
|
}
|
|
|
|
private void OnDelayedDeath(Entity<CheatDeathComponent> ent, ref DelayedDeathEvent args)
|
|
{
|
|
if (ent.Comp.InfiniteRevives)
|
|
{
|
|
args.Cancelled = true;
|
|
return;
|
|
}
|
|
|
|
RemComp(ent.Owner, ent.Comp);
|
|
}
|
|
|
|
private void OnDeathCheatAttempt(Entity<CheatDeathComponent> ent, ref CheatDeathEvent args)
|
|
{
|
|
if (args.Handled)
|
|
return;
|
|
|
|
if (!_mobStateSystem.IsDead(ent) && !ent.Comp.CanCheatStanding)
|
|
{
|
|
var failPopup = Loc.GetString("action-cheat-death-fail-not-dead");
|
|
_popupSystem.PopupEntity(failPopup, ent, ent, PopupType.LargeCaution);
|
|
|
|
return;
|
|
}
|
|
|
|
// If the entity is out of revives, or if they are unrevivable, return.
|
|
// if (ent.Comp.ReviveAmount <= 0 || HasComp<UnrevivableComponent>(ent))
|
|
// {
|
|
// var failPopup = Loc.GetString("action-cheat-death-fail-no-lives");
|
|
// _popupSystem.PopupEntity(failPopup, ent, ent, PopupType.LargeCaution);
|
|
//
|
|
// return;
|
|
// }
|
|
|
|
// Show popup
|
|
if (_mobStateSystem.IsDead(ent) && !ent.Comp.CanCheatStanding)
|
|
{
|
|
var popup = Loc.GetString("action-cheated-death-dead", ("name", Name(ent)));
|
|
_popupSystem.PopupEntity(popup, ent, PopupType.LargeCaution);
|
|
}
|
|
else
|
|
{
|
|
var popup = Loc.GetString("action-cheated-death-alive", ("name", Name(ent)));
|
|
_popupSystem.PopupEntity(popup, ent, PopupType.LargeCaution);
|
|
}
|
|
|
|
// Revive entity
|
|
_rejuvenateSystem.PerformRejuvenate(ent);
|
|
_jitter.DoJitter(ent, TimeSpan.FromSeconds(5), true);
|
|
|
|
// Decrement remaining revives.
|
|
if (!ent.Comp.InfiniteRevives)
|
|
ent.Comp.ReviveAmount--;
|
|
|
|
// remove comp if at zero
|
|
if (ent.Comp.ReviveAmount <= 0 && !ent.Comp.InfiniteRevives)
|
|
RemComp(ent.Owner, ent.Comp);
|
|
|
|
args.Handled = true;
|
|
}
|
|
}
|