Literally Murder IExamine (#7352)

This commit is contained in:
Rane
2022-04-08 17:17:25 -04:00
committed by GitHub
parent 427f7378c3
commit 7900abb888
27 changed files with 372 additions and 469 deletions

View File

@@ -7,21 +7,17 @@ using Content.Shared.Actions.ActionTypes;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Audio;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Sound;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Player;
using Robust.Shared.Utility;
namespace Content.Server.Atmos.Components
{
[RegisterComponent]
#pragma warning disable 618
public sealed class GasTankComponent : Component, IExamine, IGasMixtureHolder
public sealed class GasTankComponent : Component, IGasMixtureHolder
#pragma warning restore 618
{
[Dependency] private readonly IEntityManager _entMan = default!;
@@ -91,16 +87,6 @@ namespace Content.Server.Atmos.Components
}
}
public void Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddMarkup(Loc.GetString("comp-gas-tank-examine", ("pressure", Math.Round(Air?.Pressure ?? 0))));
if (IsConnected)
{
message.AddText("\n");
message.AddMarkup(Loc.GetString("comp-gas-tank-connected"));
}
}
protected override void Shutdown()
{
base.Shutdown();

View File

@@ -3,9 +3,8 @@ using Content.Server.UserInterface;
using Content.Shared.Actions;
using Content.Shared.Interaction.Events;
using Content.Shared.Toggleable;
using Content.Shared.Verbs;
using Content.Shared.Examine;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
namespace Content.Server.Atmos.EntitySystems
{
@@ -22,6 +21,7 @@ namespace Content.Server.Atmos.EntitySystems
base.Initialize();
SubscribeLocalEvent<GasTankComponent, BeforeActivatableUIOpenEvent>(BeforeUiOpen);
SubscribeLocalEvent<GasTankComponent, GetActionsEvent>(OnGetActions);
SubscribeLocalEvent<GasTankComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<GasTankComponent, ToggleActionEvent>(OnActionToggle);
SubscribeLocalEvent<GasTankComponent, DroppedEvent>(OnDropped);
}
@@ -42,6 +42,14 @@ namespace Content.Server.Atmos.EntitySystems
args.Actions.Add(component.ToggleAction);
}
private void OnExamined(EntityUid uid, GasTankComponent component, ExaminedEvent args)
{
if (args.IsInDetailsRange)
args.PushMarkup(Loc.GetString("comp-gas-tank-examine", ("pressure", Math.Round(component.Air?.Pressure ?? 0))));
if (component.IsConnected)
args.PushMarkup(Loc.GetString("comp-gas-tank-connected"));
}
private void OnActionToggle(EntityUid uid, GasTankComponent component, ToggleActionEvent args)
{
if (args.Handled)