Literally Murder IExamine (#7352)
This commit is contained in:
@@ -5,7 +5,6 @@ using Content.Server.GameTicking;
|
||||
using Content.Server.Players;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Morgue;
|
||||
using Content.Shared.Popups;
|
||||
@@ -13,13 +12,7 @@ using Content.Shared.Sound;
|
||||
using Content.Shared.Standing;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Morgue.Components
|
||||
{
|
||||
@@ -29,7 +22,7 @@ namespace Content.Server.Morgue.Components
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
[ComponentReference(typeof(IStorageComponent))]
|
||||
#pragma warning disable 618
|
||||
public sealed class CrematoriumEntityStorageComponent : MorgueEntityStorageComponent, IExamine, ISuicideAct
|
||||
public sealed class CrematoriumEntityStorageComponent : MorgueEntityStorageComponent, ISuicideAct
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entities = default!;
|
||||
@@ -45,28 +38,6 @@ namespace Content.Server.Morgue.Components
|
||||
|
||||
private CancellationTokenSource? _cremateCancelToken;
|
||||
|
||||
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
if (!_entities.TryGetComponent<AppearanceComponent>(Owner, out var appearance)) return;
|
||||
|
||||
if (inDetailsRange)
|
||||
{
|
||||
if (appearance.TryGetData(CrematoriumVisuals.Burning, out bool isBurning) && isBurning)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-is-burning", ("owner", Owner)) + "\n");
|
||||
}
|
||||
|
||||
if (appearance.TryGetData(MorgueVisuals.HasContents, out bool hasContents) && hasContents)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-has-contents"));
|
||||
}
|
||||
else
|
||||
{
|
||||
message.AddText(Loc.GetString("crematorium-entity-storage-component-on-examine-details-empty"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanOpen(EntityUid user, bool silent = false)
|
||||
{
|
||||
if (Cooking)
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Directions;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Morgue;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Popups;
|
||||
@@ -13,17 +10,10 @@ using Content.Shared.Standing;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Morgue.Components
|
||||
{
|
||||
@@ -32,9 +22,7 @@ namespace Content.Server.Morgue.Components
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
[ComponentReference(typeof(IStorageComponent))]
|
||||
[Virtual]
|
||||
#pragma warning disable 618
|
||||
public class MorgueEntityStorageComponent : EntityStorageComponent, IExamine
|
||||
#pragma warning restore 618
|
||||
public class MorgueEntityStorageComponent : EntityStorageComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
@@ -179,30 +167,5 @@ namespace Content.Server.Morgue.Components
|
||||
SoundSystem.Play(Filter.Pvs(Owner), _occupantHasSoulAlarmSound.GetSound(), Owner);
|
||||
}
|
||||
}
|
||||
|
||||
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
if (!_entMan.TryGetComponent<AppearanceComponent>(Owner, out var appearance)) return;
|
||||
|
||||
if (inDetailsRange)
|
||||
{
|
||||
if (appearance.TryGetData(MorgueVisuals.HasSoul, out bool hasSoul) && hasSoul)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("morgue-entity-storage-component-on-examine-details-body-has-soul"));
|
||||
}
|
||||
else if (appearance.TryGetData(MorgueVisuals.HasMob, out bool hasMob) && hasMob)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("morgue-entity-storage-component-on-examine-details-body-has-no-soul"));
|
||||
}
|
||||
else if (appearance.TryGetData(MorgueVisuals.HasContents, out bool hasContents) && hasContents)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("morgue-entity-storage-component-on-examine-details-has-contents"));
|
||||
}
|
||||
else
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("morgue-entity-storage-component-on-examine-details-empty"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
using Content.Server.Morgue.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Morgue;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Verbs;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.Morgue
|
||||
{
|
||||
@@ -19,6 +18,8 @@ namespace Content.Server.Morgue
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CrematoriumEntityStorageComponent, GetVerbsEvent<AlternativeVerb>>(AddCremateVerb);
|
||||
SubscribeLocalEvent<CrematoriumEntityStorageComponent, ExaminedEvent>(OnCrematoriumExamined);
|
||||
SubscribeLocalEvent<MorgueEntityStorageComponent, ExaminedEvent>(OnMorgueExamined);
|
||||
}
|
||||
|
||||
private void AddCremateVerb(EntityUid uid, CrematoriumEntityStorageComponent component, GetVerbsEvent<AlternativeVerb> args)
|
||||
@@ -34,6 +35,53 @@ namespace Content.Server.Morgue
|
||||
args.Verbs.Add(verb);
|
||||
}
|
||||
|
||||
private void OnCrematoriumExamined(EntityUid uid, CrematoriumEntityStorageComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
return;
|
||||
|
||||
if (args.IsInDetailsRange)
|
||||
{
|
||||
if (appearance.TryGetData(CrematoriumVisuals.Burning, out bool isBurning) && isBurning)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-is-burning", ("owner", uid)));
|
||||
}
|
||||
|
||||
if (appearance.TryGetData(MorgueVisuals.HasContents, out bool hasContents) && hasContents)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-has-contents"));
|
||||
}
|
||||
else
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-empty"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMorgueExamined(EntityUid uid, MorgueEntityStorageComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!TryComp<AppearanceComponent>(uid, out var appearance)) return;
|
||||
|
||||
if (args.IsInDetailsRange)
|
||||
{
|
||||
if (appearance.TryGetData(MorgueVisuals.HasSoul, out bool hasSoul) && hasSoul)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("morgue-entity-storage-component-on-examine-details-body-has-soul"));
|
||||
}
|
||||
else if (appearance.TryGetData(MorgueVisuals.HasMob, out bool hasMob) && hasMob)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("morgue-entity-storage-component-on-examine-details-body-has-no-soul"));
|
||||
}
|
||||
else if (appearance.TryGetData(MorgueVisuals.HasContents, out bool hasContents) && hasContents)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("morgue-entity-storage-component-on-examine-details-has-contents"));
|
||||
}
|
||||
else
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("morgue-entity-storage-component-on-examine-details-empty"));
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
_accumulatedFrameTime += frameTime;
|
||||
|
||||
Reference in New Issue
Block a user