CatStation/Content.Server/Morgue/CrematoriumSystem.cs
Whatstone a88d2c5164
Cleanup: Resolve remaining PopupSystem warnings in Content.Shared (#44685)
* PopupClient to PopupEntity/Coordinates

* PopupPredictedX to PopupEntity/Cursor/Coordinates

* The rest of the damn owl

* nullability fixes

* Buckle cleanup

* cleanup, address PR comments

* ExecutionSystem: one popup method

* correct my filthy lies

* Apply most of ajcm's suggestions

* return user to SharedItemRecallSystem.cs

* Fix lingering Ensnarable broadcast popups

* targeted drain popups

* fix lingering untargeted Guardian popups

I read the comment on GuardianHostRecall.  Oops.

* target stethoscope popups

* fix the PDA vibration popup

* Fix target for encryption key removal popup

* anomaly scanner: args.User, not uid

* disposal unit comment, bcast pda vibration popup
2026-07-16 21:54:33 +00:00

58 lines
1.8 KiB
C#

using Content.Server.Ghost;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction.Events;
using Content.Shared.Morgue;
using Content.Shared.Morgue.Components;
using Content.Shared.Popups;
using Robust.Shared.Player;
namespace Content.Server.Morgue;
public sealed partial class CrematoriumSystem : SharedCrematoriumSystem
{
[Dependency] private GhostSystem _ghostSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CrematoriumComponent, SuicideByEnvironmentEvent>(OnSuicideByEnvironment);
}
private void OnSuicideByEnvironment(Entity<CrematoriumComponent> ent, ref SuicideByEnvironmentEvent args)
{
if (args.Handled)
return;
var victim = args.Victim;
if (HasComp<ActorComponent>(victim) && Mind.TryGetMind(victim, out var mindId, out var mind))
{
_ghostSystem.OnGhostAttempt(mindId, false, mind: mind);
if (mind.OwnedEntity is { Valid: true } entity)
{
Popup.PopupEntity(Loc.GetString("crematorium-entity-storage-component-suicide-message"), entity, entity);
}
}
Popup.PopupEntity(Loc.GetString("crematorium-entity-storage-component-suicide-message-others",
("victim", Identity.Entity(victim, EntityManager))),
victim,
Filter.PvsExcept(victim),
true,
PopupType.LargeCaution);
if (EntityStorage.CanInsert(victim, ent.Owner))
{
EntityStorage.CloseStorage(ent.Owner);
Standing.Down(victim, false);
EntityStorage.Insert(victim, ent.Owner);
}
else
{
EntityStorage.CloseStorage(ent.Owner);
Del(victim);
}
Cremate(ent.AsNullable());
args.Handled = true;
}
}