cleaning up more stuff with crematoriums and morgues (#11384)
This commit is contained in:
@@ -2,17 +2,16 @@ using Content.Server.Morgue.Components;
|
||||
using Content.Shared.Morgue;
|
||||
using Content.Shared.Examine;
|
||||
using Robust.Server.GameObjects;
|
||||
using Content.Server.Popups;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Storage;
|
||||
|
||||
namespace Content.Server.Morgue;
|
||||
|
||||
public sealed partial class MorgueSystem : EntitySystem
|
||||
public sealed class MorgueSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -32,7 +31,7 @@ public sealed partial class MorgueSystem : EntitySystem
|
||||
return;
|
||||
|
||||
appearance.TryGetData(MorgueVisuals.Contents, out MorgueContents contents);
|
||||
|
||||
|
||||
var text = contents switch
|
||||
{
|
||||
MorgueContents.HasSoul => "morgue-entity-storage-component-on-examine-details-body-has-soul",
|
||||
@@ -54,25 +53,25 @@ public sealed partial class MorgueSystem : EntitySystem
|
||||
|
||||
if (storage.Contents.ContainedEntities.Count == 0)
|
||||
{
|
||||
app.SetData(MorgueVisuals.Contents, MorgueContents.Empty);
|
||||
_appearance.SetData(uid, MorgueVisuals.Contents, MorgueContents.Empty);
|
||||
return;
|
||||
}
|
||||
|
||||
var hasMob = false;
|
||||
|
||||
|
||||
foreach (var ent in storage.Contents.ContainedEntities)
|
||||
{
|
||||
if (!hasMob && HasComp<SharedBodyComponent>(ent))
|
||||
hasMob = true;
|
||||
|
||||
if (TryComp<ActorComponent?>(ent, out var actor) && actor.PlayerSession != null)
|
||||
if (HasComp<ActorComponent?>(ent))
|
||||
{
|
||||
app.SetData(MorgueVisuals.Contents, MorgueContents.HasSoul);
|
||||
_appearance.SetData(uid, MorgueVisuals.Contents, MorgueContents.HasSoul, app);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
app.SetData(MorgueVisuals.Contents, hasMob ? MorgueContents.HasMob : MorgueContents.HasContents);
|
||||
_appearance.SetData(uid, MorgueVisuals.Contents, hasMob ? MorgueContents.HasMob : MorgueContents.HasContents, app);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -86,7 +85,7 @@ public sealed partial class MorgueSystem : EntitySystem
|
||||
{
|
||||
comp.AccumulatedFrameTime += frameTime;
|
||||
|
||||
CheckContents(comp.Owner, comp, storage, appearance);
|
||||
CheckContents(comp.Owner, comp, storage);
|
||||
|
||||
if (comp.AccumulatedFrameTime < comp.BeepTime)
|
||||
continue;
|
||||
@@ -95,7 +94,7 @@ public sealed partial class MorgueSystem : EntitySystem
|
||||
|
||||
if (comp.DoSoulBeep && appearance.TryGetData(MorgueVisuals.Contents, out MorgueContents contents) && contents == MorgueContents.HasSoul)
|
||||
{
|
||||
SoundSystem.Play(comp.OccupantHasSoulAlarmSound.GetSound(), Filter.Pvs(comp.Owner), comp.Owner);
|
||||
_audio.PlayPvs(comp.OccupantHasSoulAlarmSound, comp.Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user