Literally Murder IExamine (#7352)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,44 +1,32 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Botany.Systems;
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Fluids.Components;
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Server.Kitchen.Components;
|
||||
using Content.Server.Plants;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Botany;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Botany.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
#pragma warning disable 618
|
||||
public sealed class PlantHolderComponent : Component, IInteractUsing, IInteractHand, IActivate, IExamine
|
||||
public sealed class PlantHolderComponent : Component, IInteractUsing, IInteractHand, IActivate
|
||||
#pragma warning restore 618
|
||||
{
|
||||
public const float HydroponicsSpeedMultiplier = 1f;
|
||||
@@ -51,7 +39,7 @@ namespace Content.Server.Botany.Components
|
||||
|
||||
[ViewVariables] private int _lastProduce;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] private int _missingGas;
|
||||
[ViewVariables(VVAccess.ReadWrite)] public int MissingGas;
|
||||
|
||||
private readonly TimeSpan _cycleDelay = TimeSpan.FromSeconds(15f);
|
||||
|
||||
@@ -255,22 +243,22 @@ namespace Content.Server.Botany.Components
|
||||
|
||||
if (Seed.ConsumeGasses.Count > 0)
|
||||
{
|
||||
_missingGas = 0;
|
||||
MissingGas = 0;
|
||||
|
||||
foreach (var (gas, amount) in Seed.ConsumeGasses)
|
||||
{
|
||||
if (environment.GetMoles(gas) < amount)
|
||||
{
|
||||
_missingGas++;
|
||||
MissingGas++;
|
||||
continue;
|
||||
}
|
||||
|
||||
environment.AdjustMoles(gas, -amount);
|
||||
}
|
||||
|
||||
if (_missingGas > 0)
|
||||
if (MissingGas > 0)
|
||||
{
|
||||
Health -= _missingGas * HydroponicsSpeedMultiplier;
|
||||
Health -= MissingGas * HydroponicsSpeedMultiplier;
|
||||
if (DrawWarnings)
|
||||
_updateSpriteAfterUpdate = true;
|
||||
}
|
||||
@@ -631,7 +619,7 @@ namespace Content.Server.Botany.Components
|
||||
appearanceComponent.SetData(PlantHolderVisuals.NutritionLight, NutritionLevel <= 2);
|
||||
appearanceComponent.SetData(PlantHolderVisuals.AlertLight,
|
||||
WeedLevel >= 5 || PestLevel >= 5 || Toxins >= 40 || ImproperHeat || ImproperLight || ImproperPressure ||
|
||||
_missingGas > 0);
|
||||
MissingGas > 0);
|
||||
appearanceComponent.SetData(PlantHolderVisuals.HarvestLight, Harvest);
|
||||
}
|
||||
|
||||
@@ -847,65 +835,5 @@ namespace Content.Server.Botany.Components
|
||||
// DoHarvest does the sanity checks.
|
||||
DoHarvest(eventArgs.User);
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
if (!inDetailsRange)
|
||||
return;
|
||||
|
||||
if (Seed == null)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("plant-holder-component-nothing-planted-message") + "\n");
|
||||
}
|
||||
else if (!Dead)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("plant-holder-component-something-already-growing-message",
|
||||
("seedName", Seed.DisplayName),
|
||||
("toBeForm", Seed.DisplayName.EndsWith('s') ? "are" : "is"))
|
||||
+ "\n");
|
||||
|
||||
if (Health <= Seed.Endurance / 2)
|
||||
message.AddMarkup(Loc.GetString(
|
||||
"plant-holder-component-something-already-growing-low-health-message",
|
||||
("healthState",
|
||||
Loc.GetString(Age > Seed.Lifespan
|
||||
? "plant-holder-component-plant-old-adjective"
|
||||
: "plant-holder-component-plant-unhealthy-adjective")))
|
||||
+ "\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("plant-holder-component-dead-plant-matter-message") + "\n");
|
||||
}
|
||||
|
||||
if (WeedLevel >= 5)
|
||||
message.AddMarkup(Loc.GetString("plant-holder-component-weed-high-level-message") + "\n");
|
||||
|
||||
if (PestLevel >= 5)
|
||||
message.AddMarkup(Loc.GetString("plant-holder-component-pest-high-level-message") + "\n");
|
||||
|
||||
message.AddMarkup(Loc.GetString($"plant-holder-component-water-level-message",
|
||||
("waterLevel", (int) WaterLevel)) + "\n");
|
||||
message.AddMarkup(Loc.GetString($"plant-holder-component-nutrient-level-message",
|
||||
("nutritionLevel", (int) NutritionLevel)) + "\n");
|
||||
|
||||
if (DrawWarnings)
|
||||
{
|
||||
if (Toxins > 40f)
|
||||
message.AddMarkup(Loc.GetString("plant-holder-component-toxins-high-warning") + "\n");
|
||||
|
||||
if (ImproperLight)
|
||||
message.AddMarkup(Loc.GetString("plant-holder-component-light-improper-warning") + "\n");
|
||||
|
||||
if (ImproperHeat)
|
||||
message.AddMarkup(Loc.GetString("plant-holder-component-heat-improper-warning") + "\n");
|
||||
|
||||
if (ImproperPressure)
|
||||
message.AddMarkup(Loc.GetString("plant-holder-component-pressure-improper-warning") + "\n");
|
||||
|
||||
if (_missingGas > 0)
|
||||
message.AddMarkup(Loc.GetString("plant-holder-component-gas-missing-warning") + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
72
Content.Server/Botany/Systems/PlantHolderSystem.cs
Normal file
72
Content.Server/Botany/Systems/PlantHolderSystem.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using Content.Server.Botany.Components;
|
||||
using Content.Shared.Examine;
|
||||
|
||||
namespace Content.Server.Botany.Systems
|
||||
{
|
||||
public sealed class PlantHolderSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<PlantHolderComponent, ExaminedEvent>(OnExamine);
|
||||
}
|
||||
|
||||
private void OnExamine(EntityUid uid, PlantHolderComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!args.IsInDetailsRange)
|
||||
return;
|
||||
|
||||
if (component.Seed == null)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("plant-holder-component-nothing-planted-message"));
|
||||
}
|
||||
else if (!component.Dead)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("plant-holder-component-something-already-growing-message",
|
||||
("seedName", component.Seed.DisplayName),
|
||||
("toBeForm", component.Seed.DisplayName.EndsWith('s') ? "are" : "is")));
|
||||
|
||||
if (component.Health <= component.Seed.Endurance / 2)
|
||||
args.PushMarkup(Loc.GetString(
|
||||
"plant-holder-component-something-already-growing-low-health-message",
|
||||
("healthState",
|
||||
Loc.GetString(component.Age > component.Seed.Lifespan
|
||||
? "plant-holder-component-plant-old-adjective"
|
||||
: "plant-holder-component-plant-unhealthy-adjective"))));
|
||||
}
|
||||
else
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("plant-holder-component-dead-plant-matter-message"));
|
||||
}
|
||||
|
||||
if (component.WeedLevel >= 5)
|
||||
args.PushMarkup(Loc.GetString("plant-holder-component-weed-high-level-message"));
|
||||
|
||||
if (component.PestLevel >= 5)
|
||||
args.PushMarkup(Loc.GetString("plant-holder-component-pest-high-level-message"));
|
||||
|
||||
args.PushMarkup(Loc.GetString($"plant-holder-component-water-level-message",
|
||||
("waterLevel", (int) component.WaterLevel)));
|
||||
args.PushMarkup(Loc.GetString($"plant-holder-component-nutrient-level-message",
|
||||
("nutritionLevel", (int) component.NutritionLevel)));
|
||||
|
||||
if (component.DrawWarnings)
|
||||
{
|
||||
if (component.Toxins > 40f)
|
||||
args.PushMarkup(Loc.GetString("plant-holder-component-toxins-high-warning"));
|
||||
|
||||
if (component.ImproperLight)
|
||||
args.PushMarkup(Loc.GetString("plant-holder-component-light-improper-warning"));
|
||||
|
||||
if (component.ImproperHeat)
|
||||
args.PushMarkup(Loc.GetString("plant-holder-component-heat-improper-warning"));
|
||||
|
||||
if (component.ImproperPressure)
|
||||
args.PushMarkup(Loc.GetString("plant-holder-component-pressure-improper-warning"));
|
||||
|
||||
if (component.MissingGas > 0)
|
||||
args.PushMarkup(Loc.GetString("plant-holder-component-gas-missing-warning"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Construction.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
#pragma warning disable 618
|
||||
public sealed class MachineBoardComponent : Component, IExamine
|
||||
#pragma warning restore 618
|
||||
public sealed class MachineBoardComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -50,42 +39,6 @@ namespace Content.Server.Construction.Components
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("machine-board-component-on-examine-label") + "\n");
|
||||
foreach (var (part, amount) in Requirements)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("machine-board-component-required-element-entry-text",
|
||||
("amount", amount),
|
||||
("requiredElement", Loc.GetString(part.ToString())))
|
||||
+ "\n");
|
||||
}
|
||||
|
||||
foreach (var (material, amount) in MaterialRequirements)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("machine-board-component-required-element-entry-text",
|
||||
("amount", amount),
|
||||
("requiredElement", Loc.GetString(material.Name)))
|
||||
+ "\n");
|
||||
}
|
||||
|
||||
foreach (var (_, info) in ComponentRequirements)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("machine-board-component-required-element-entry-text",
|
||||
("amount", info.Amount),
|
||||
("requiredElement", Loc.GetString(info.ExamineName)))
|
||||
+ "\n");
|
||||
}
|
||||
|
||||
foreach (var (_, info) in TagRequirements)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("machine-board-component-required-element-entry-text",
|
||||
("amount", info.Amount),
|
||||
("requiredElement", Loc.GetString(info.ExamineName)))
|
||||
+ "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Examine;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Construction.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
#pragma warning disable 618
|
||||
public sealed class MachinePartComponent : Component, IExamine
|
||||
#pragma warning restore 618
|
||||
public sealed class MachinePartComponent : Component
|
||||
{
|
||||
// I'm so sorry for hard-coding this. But trust me, it should make things less painful.
|
||||
public static IReadOnlyDictionary<MachinePart, string> Prototypes { get; } = new Dictionary<MachinePart, string>()
|
||||
@@ -34,11 +24,5 @@ namespace Content.Server.Construction.Components
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("rating")]
|
||||
public int Rating { get; private set; } = 1;
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("machine-part-component-on-examine-rating-text", ("rating", Rating)) + "\n");
|
||||
message.AddMarkup(Loc.GetString("machine-part-component-on-examine-type-text", ("type", PartType)) + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
60
Content.Server/Construction/MachinePartSystem.cs
Normal file
60
Content.Server/Construction/MachinePartSystem.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using Content.Server.Construction.Components;
|
||||
using Content.Shared.Examine;
|
||||
|
||||
namespace Content.Server.Construction
|
||||
{
|
||||
/// <summary>
|
||||
/// Deals with machine parts and machine boards.
|
||||
/// </summary>
|
||||
public sealed class MachinePartSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<MachineBoardComponent, ExaminedEvent>(OnMachineBoardExamined);
|
||||
SubscribeLocalEvent<MachinePartComponent, ExaminedEvent>(OnMachinePartExamined);
|
||||
}
|
||||
|
||||
private void OnMachineBoardExamined(EntityUid uid, MachineBoardComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!args.IsInDetailsRange)
|
||||
return;
|
||||
args.PushMarkup(Loc.GetString("machine-board-component-on-examine-label"));
|
||||
foreach (var (part, amount) in component.Requirements)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("machine-board-component-required-element-entry-text",
|
||||
("amount", amount),
|
||||
("requiredElement", Loc.GetString(part.ToString()))));
|
||||
}
|
||||
|
||||
foreach (var (material, amount) in component.MaterialRequirements)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("machine-board-component-required-element-entry-text",
|
||||
("amount", amount),
|
||||
("requiredElement", Loc.GetString(material.Name))));
|
||||
}
|
||||
|
||||
foreach (var (_, info) in component.ComponentRequirements)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("machine-board-component-required-element-entry-text",
|
||||
("amount", info.Amount),
|
||||
("requiredElement", Loc.GetString(info.ExamineName))));
|
||||
}
|
||||
|
||||
foreach (var (_, info) in component.TagRequirements)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("machine-board-component-required-element-entry-text",
|
||||
("amount", info.Amount),
|
||||
("requiredElement", Loc.GetString(info.ExamineName))));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMachinePartExamined(EntityUid uid, MachinePartComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!args.IsInDetailsRange)
|
||||
return;
|
||||
args.PushMarkup(Loc.GetString("machine-part-component-on-examine-rating-text", ("rating", component.Rating)));
|
||||
args.PushMarkup(Loc.GetString("machine-part-component-on-examine-type-text", ("type", component.PartType)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,16 +76,13 @@ namespace Content.Server.Drone
|
||||
|
||||
private void OnExamined(EntityUid uid, DroneComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (args.IsInDetailsRange)
|
||||
if (TryComp<MindComponent>(uid, out var mind) && mind.HasMind)
|
||||
{
|
||||
if (TryComp<MindComponent>(uid, out var mind) && mind.HasMind)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("drone-active"));
|
||||
}
|
||||
else
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("drone-dormant"));
|
||||
}
|
||||
args.PushMarkup(Loc.GetString("drone-active"));
|
||||
}
|
||||
else
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("drone-dormant"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Radio.Components;
|
||||
using Content.Server.Radio.EntitySystems;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.Examine;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Headset
|
||||
{
|
||||
@@ -19,7 +11,7 @@ namespace Content.Server.Headset
|
||||
[ComponentReference(typeof(IRadio))]
|
||||
[ComponentReference(typeof(IListen))]
|
||||
#pragma warning disable 618
|
||||
public sealed class HeadsetComponent : Component, IListen, IRadio, IExamine
|
||||
public sealed class HeadsetComponent : Component, IListen, IRadio
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
@@ -32,7 +24,7 @@ namespace Content.Server.Headset
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("broadcastChannel")]
|
||||
private int BroadcastFrequency { get; set; } = 1459;
|
||||
public int BroadcastFrequency { get; set; } = 1459;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("listenRange")]
|
||||
@@ -83,14 +75,5 @@ namespace Content.Server.Headset
|
||||
_radioSystem.SpreadMessage(this, speaker, message, BroadcastFrequency);
|
||||
RadioRequested = false;
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
message.AddText(Loc.GetString("examine-radio-frequency", ("frequency", BroadcastFrequency)));
|
||||
message.AddText("\n");
|
||||
message.AddText(Loc.GetString("examine-headset"));
|
||||
message.AddText("\n");
|
||||
message.AddText(Loc.GetString("examine-headset-chat-prefix", ("prefix", ";")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
22
Content.Server/Headset/HeadsetSystem.cs
Normal file
22
Content.Server/Headset/HeadsetSystem.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Content.Shared.Examine;
|
||||
|
||||
namespace Content.Server.Headset
|
||||
{
|
||||
public sealed class HeadsetSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<HeadsetComponent, ExaminedEvent>(OnExamined);
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, HeadsetComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!args.IsInDetailsRange)
|
||||
return;
|
||||
args.PushMarkup(Loc.GetString("examine-radio-frequency", ("frequency", component.BroadcastFrequency)));
|
||||
args.PushMarkup(Loc.GetString("examine-headset"));
|
||||
args.PushMarkup(Loc.GetString("examine-headset-chat-prefix", ("prefix", ";")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Server.NodeContainer.NodeGroups;
|
||||
using Content.Shared.Examine;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.NodeContainer.EntitySystems
|
||||
{
|
||||
@@ -23,6 +23,7 @@ namespace Content.Server.NodeContainer.EntitySystems
|
||||
SubscribeLocalEvent<NodeContainerComponent, ComponentShutdown>(OnShutdownEvent);
|
||||
SubscribeLocalEvent<NodeContainerComponent, AnchorStateChangedEvent>(OnAnchorStateChanged);
|
||||
SubscribeLocalEvent<NodeContainerComponent, RotateEvent>(OnRotateEvent);
|
||||
SubscribeLocalEvent<NodeContainerComponent, ExaminedEvent>(OnExamine);
|
||||
}
|
||||
|
||||
private void OnInitEvent(EntityUid uid, NodeContainerComponent component, ComponentInit args)
|
||||
@@ -92,5 +93,31 @@ namespace Content.Server.NodeContainer.EntitySystems
|
||||
_nodeGroupSystem.QueueReflood(node);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnExamine(EntityUid uid, NodeContainerComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!component.Examinable || !args.IsInDetailsRange)
|
||||
return;
|
||||
|
||||
foreach (var node in component.Nodes.Values)
|
||||
{
|
||||
if (node == null) continue;
|
||||
switch (node.NodeGroupID)
|
||||
{
|
||||
case NodeGroupID.HVPower:
|
||||
args.PushMarkup(
|
||||
Loc.GetString("node-container-component-on-examine-details-hvpower"));
|
||||
break;
|
||||
case NodeGroupID.MVPower:
|
||||
args.PushMarkup(
|
||||
Loc.GetString("node-container-component-on-examine-details-mvpower"));
|
||||
break;
|
||||
case NodeGroupID.Apc:
|
||||
args.PushMarkup(
|
||||
Loc.GetString("node-container-component-on-examine-details-apc"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.NodeContainer.NodeGroups;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Shared.Examine;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.NodeContainer
|
||||
{
|
||||
@@ -15,14 +7,12 @@ namespace Content.Server.NodeContainer
|
||||
/// Creates and maintains a set of <see cref="Node"/>s.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
#pragma warning disable 618
|
||||
public sealed class NodeContainerComponent : Component, IExamine
|
||||
#pragma warning restore 618
|
||||
public sealed class NodeContainerComponent : Component
|
||||
{
|
||||
//HACK: THIS BEING readOnly IS A FILTHY HACK AND I HATE IT --moony
|
||||
[DataField("nodes", readOnly: true)] [ViewVariables] public Dictionary<string, Node> Nodes { get; } = new();
|
||||
|
||||
[DataField("examinable")] private bool _examinable = false;
|
||||
[DataField("examinable")] public bool Examinable = false;
|
||||
|
||||
public T GetNode<T>(string identifier) where T : Node
|
||||
{
|
||||
@@ -40,30 +30,5 @@ namespace Content.Server.NodeContainer
|
||||
node = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
if (!_examinable || !inDetailsRange) return;
|
||||
|
||||
foreach (var node in Nodes.Values)
|
||||
{
|
||||
if (node == null) continue;
|
||||
switch (node.NodeGroupID)
|
||||
{
|
||||
case NodeGroupID.HVPower:
|
||||
message.AddMarkup(
|
||||
Loc.GetString("node-container-component-on-examine-details-hvpower") + "\n");
|
||||
break;
|
||||
case NodeGroupID.MVPower:
|
||||
message.AddMarkup(
|
||||
Loc.GetString("node-container-component-on-examine-details-mvpower") + "\n");
|
||||
break;
|
||||
case NodeGroupID.Apc:
|
||||
message.AddMarkup(
|
||||
Loc.GetString("node-container-component-on-examine-details-apc") + "\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Paper;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Paper
|
||||
{
|
||||
[RegisterComponent]
|
||||
#pragma warning disable 618
|
||||
[ComponentReference(typeof(SharedPaperComponent))]
|
||||
public sealed class PaperComponent : SharedPaperComponent, IExamine, IInteractUsing
|
||||
public sealed class PaperComponent : SharedPaperComponent, IInteractUsing
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
@@ -61,21 +58,6 @@ namespace Content.Server.Paper
|
||||
{
|
||||
UserInterface?.SetState(new PaperBoundUserInterfaceState(Content, Mode));
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
if (!inDetailsRange)
|
||||
return;
|
||||
if (Content == "")
|
||||
return;
|
||||
|
||||
message.AddMarkup(
|
||||
Loc.GetString(
|
||||
"paper-component-examine-detail-has-words"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
||||
{
|
||||
var msg = (PaperInputText) obj.Message;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Paper;
|
||||
|
||||
namespace Content.Server.Paper
|
||||
@@ -9,6 +10,7 @@ namespace Content.Server.Paper
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<PaperComponent, BeforeActivatableUIOpenEvent>(AfterUIOpen);
|
||||
SubscribeLocalEvent<PaperComponent, ExaminedEvent>(OnExamined);
|
||||
}
|
||||
|
||||
private void AfterUIOpen(EntityUid uid, PaperComponent component, BeforeActivatableUIOpenEvent args)
|
||||
@@ -16,5 +18,19 @@ namespace Content.Server.Paper
|
||||
component.Mode = SharedPaperComponent.PaperAction.Read;
|
||||
component.UpdateUserInterface();
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, PaperComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!args.IsInDetailsRange)
|
||||
return;
|
||||
if (component.Content == "")
|
||||
return;
|
||||
|
||||
args.PushMarkup(
|
||||
Loc.GetString(
|
||||
"paper-component-examine-detail-has-words"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.Power.NodeGroups;
|
||||
using Content.Server.Power.Pow3r;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Power.Components
|
||||
{
|
||||
@@ -20,9 +9,7 @@ namespace Content.Server.Power.Components
|
||||
/// so that it can receive power from a <see cref="IApcNet"/>.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
#pragma warning disable 618
|
||||
public sealed class ApcPowerReceiverComponent : Component, IExamine
|
||||
#pragma warning restore 618
|
||||
public sealed class ApcPowerReceiverComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
@@ -89,16 +76,6 @@ namespace Content.Server.Power.Components
|
||||
appearance.SetData(PowerDeviceVisuals.Powered, Powered);
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Adds some markup to the examine text of whatever object is using this component to tell you if it's powered or not, even if it doesn't have an icon state to do this for you.
|
||||
///</summary>
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("power-receiver-component-on-examine-main",
|
||||
("stateText", Loc.GetString( Powered ? "power-receiver-component-on-examine-powered" :
|
||||
"power-receiver-component-on-examine-unpowered"))));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,38 +1,6 @@
|
||||
using Content.Shared.Examine;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Power.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
#pragma warning disable 618
|
||||
public sealed class ExaminableBatteryComponent : Component, IExamine
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
if (!_entityManager.TryGetComponent<BatteryComponent>(Owner, out var batteryComponent))
|
||||
return;
|
||||
if (inDetailsRange)
|
||||
{
|
||||
var effectiveMax = batteryComponent.MaxCharge;
|
||||
if (effectiveMax == 0)
|
||||
effectiveMax = 1;
|
||||
var chargeFraction = batteryComponent.CurrentCharge / effectiveMax;
|
||||
var chargePercentRounded = (int) (chargeFraction * 100);
|
||||
message.AddMarkup(
|
||||
Loc.GetString(
|
||||
"examinable-battery-component-examine-detail",
|
||||
("percent", chargePercentRounded),
|
||||
("markupPercentColor", "green")
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
public sealed class ExaminableBatteryComponent : Component
|
||||
{}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.Pow3r;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Access.Systems;
|
||||
using Content.Shared.APC;
|
||||
@@ -9,10 +7,6 @@ using Content.Shared.Emag.Systems;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -48,7 +42,6 @@ namespace Content.Server.Power.EntitySystems
|
||||
{
|
||||
UpdateApcState(uid, component);
|
||||
}
|
||||
|
||||
private void OnToggleMainBreaker(EntityUid uid, ApcComponent component, ApcToggleMainBreakerMessage args)
|
||||
{
|
||||
TryComp<AccessReaderComponent>(uid, out var access);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Examine;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Power.EntitySystems
|
||||
{
|
||||
@@ -11,10 +11,33 @@ namespace Content.Server.Power.EntitySystems
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ExaminableBatteryComponent, ExaminedEvent>(OnExamine);
|
||||
|
||||
SubscribeLocalEvent<NetworkBatteryPreSync>(PreSync);
|
||||
SubscribeLocalEvent<NetworkBatteryPostSync>(PostSync);
|
||||
}
|
||||
|
||||
private void OnExamine(EntityUid uid, ExaminableBatteryComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!TryComp<BatteryComponent>(uid, out var batteryComponent))
|
||||
return;
|
||||
if (args.IsInDetailsRange)
|
||||
{
|
||||
var effectiveMax = batteryComponent.MaxCharge;
|
||||
if (effectiveMax == 0)
|
||||
effectiveMax = 1;
|
||||
var chargeFraction = batteryComponent.CurrentCharge / effectiveMax;
|
||||
var chargePercentRounded = (int) (chargeFraction * 100);
|
||||
args.PushMarkup(
|
||||
Loc.GetString(
|
||||
"examinable-battery-component-examine-detail",
|
||||
("percent", chargePercentRounded),
|
||||
("markupPercentColor", "green")
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void PreSync(NetworkBatteryPreSync ev)
|
||||
{
|
||||
foreach (var (netBat, bat) in EntityManager.EntityQuery<PowerNetworkBatteryComponent, BatteryComponent>())
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Server.Power.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
using Content.Shared.Examine;
|
||||
namespace Content.Server.Power.EntitySystems
|
||||
{
|
||||
public sealed class PowerReceiverSystem : EntitySystem
|
||||
@@ -8,6 +7,7 @@ namespace Content.Server.Power.EntitySystems
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<ApcPowerReceiverComponent, ExaminedEvent>(OnExamined);
|
||||
|
||||
SubscribeLocalEvent<ApcPowerReceiverComponent, ExtensionCableSystem.ProviderConnectedEvent>(OnProviderConnected);
|
||||
SubscribeLocalEvent<ApcPowerReceiverComponent, ExtensionCableSystem.ProviderDisconnectedEvent>(OnProviderDisconnected);
|
||||
@@ -17,6 +17,16 @@ namespace Content.Server.Power.EntitySystems
|
||||
SubscribeLocalEvent<ApcPowerProviderComponent, ExtensionCableSystem.ReceiverDisconnectedEvent>(OnReceiverDisconnected);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Adds some markup to the examine text of whatever object is using this component to tell you if it's powered or not, even if it doesn't have an icon state to do this for you.
|
||||
///</summary>
|
||||
private void OnExamined(EntityUid uid, ApcPowerReceiverComponent component, ExaminedEvent args)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("power-receiver-component-on-examine-main",
|
||||
("stateText", Loc.GetString( component.Powered ? "power-receiver-component-on-examine-powered" :
|
||||
"power-receiver-component-on-examine-unpowered"))));
|
||||
}
|
||||
|
||||
private void OnProviderShutdown(EntityUid uid, ApcPowerProviderComponent component, ComponentShutdown args)
|
||||
{
|
||||
foreach (var receiver in component.LinkedReceivers)
|
||||
|
||||
@@ -2,16 +2,8 @@ using System.Collections.Generic;
|
||||
using Content.Server.Chat;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.Radio.EntitySystems;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Radio.Components
|
||||
{
|
||||
@@ -21,7 +13,7 @@ namespace Content.Server.Radio.Components
|
||||
[ComponentReference(typeof(IListen))]
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
#pragma warning disable 618
|
||||
public sealed class HandheldRadioComponent : Component, IListen, IRadio, IActivate, IExamine
|
||||
public sealed class HandheldRadioComponent : Component, IListen, IRadio, IActivate
|
||||
#pragma warning restore 618
|
||||
{
|
||||
private ChatSystem _chatSystem = default!;
|
||||
@@ -33,7 +25,7 @@ namespace Content.Server.Radio.Components
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("broadcastChannel")]
|
||||
private int BroadcastFrequency { get; set; } = 1459;
|
||||
public int BroadcastFrequency { get; set; } = 1459;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("listenRange")] public int ListenRange { get; private set; } = 7;
|
||||
|
||||
@@ -104,10 +96,5 @@ namespace Content.Server.Radio.Components
|
||||
{
|
||||
Use(eventArgs.User);
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
message.AddText(Loc.GetString("handheld-radio-component-on-examine",("frequency", BroadcastFrequency)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Server.Radio.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Radio.EntitySystems
|
||||
{
|
||||
@@ -11,6 +10,19 @@ namespace Content.Server.Radio.EntitySystems
|
||||
{
|
||||
private readonly List<string> _messages = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<HandheldRadioComponent, ExaminedEvent>(OnExamine);
|
||||
}
|
||||
|
||||
private void OnExamine(EntityUid uid, HandheldRadioComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!args.IsInDetailsRange)
|
||||
return;
|
||||
args.PushMarkup(Loc.GetString("handheld-radio-component-on-examine",("frequency", component.BroadcastFrequency)));
|
||||
}
|
||||
|
||||
public void SpreadMessage(IRadio source, EntityUid speaker, string message, int channel)
|
||||
{
|
||||
if (_messages.Contains(message)) return;
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameTicking.Rules;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Roles;
|
||||
using Content.Server.Suspicion.Roles;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Suspicion;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Suspicion
|
||||
{
|
||||
[RegisterComponent]
|
||||
#pragma warning disable 618
|
||||
public sealed class SuspicionRoleComponent : SharedSuspicionRoleComponent, IExamine
|
||||
#pragma warning restore 618
|
||||
public sealed class SuspicionRoleComponent : SharedSuspicionRoleComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
@@ -123,27 +113,6 @@ namespace Content.Server.Suspicion
|
||||
|
||||
Dirty();
|
||||
}
|
||||
|
||||
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
if (!IsDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var traitor = IsTraitor();
|
||||
var color = traitor ? "red" : "green";
|
||||
var role = traitor ? "suspicion-role-component-role-traitor" : "suspicion-role-component-role-innocent";
|
||||
var article = traitor ? "generic-article-a" : "generic-article-an";
|
||||
|
||||
var tooltip = Loc.GetString("suspicion-role-component-on-examine-tooltip",
|
||||
("article", Loc.GetString(article)),
|
||||
("colorName", color),
|
||||
("role",Loc.GetString(role)));
|
||||
|
||||
message.AddMarkup(tooltip);
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
if (Role == null)
|
||||
|
||||
32
Content.Server/Suspicion/SuspicionRoleSystem.cs
Normal file
32
Content.Server/Suspicion/SuspicionRoleSystem.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Content.Shared.Examine;
|
||||
|
||||
namespace Content.Server.Suspicion
|
||||
{
|
||||
public sealed class SuspicionRoleSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<SuspicionRoleComponent, ExaminedEvent>(OnExamined);
|
||||
}
|
||||
private void OnExamined(EntityUid uid, SuspicionRoleComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!component.IsDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var traitor = component.IsTraitor();
|
||||
var color = traitor ? "red" : "green";
|
||||
var role = traitor ? "suspicion-role-component-role-traitor" : "suspicion-role-component-role-innocent";
|
||||
var article = traitor ? "generic-article-a" : "generic-article-an";
|
||||
|
||||
var tooltip = Loc.GetString("suspicion-role-component-on-examine-tooltip",
|
||||
("article", Loc.GetString(article)),
|
||||
("colorName", color),
|
||||
("role",Loc.GetString(role)));
|
||||
|
||||
args.PushMarkup(tooltip);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.MobState.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Utility;
|
||||
using static Content.Shared.Interaction.SharedInteractionSystem;
|
||||
|
||||
namespace Content.Shared.Examine
|
||||
{
|
||||
[Obsolete("Use ExaminedEvent instead.")]
|
||||
public interface IExamine
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a status examine value for components appended to the end of the description of the entity
|
||||
/// </summary>
|
||||
/// <param name="message">The message to append to which will be displayed.</param>
|
||||
/// <param name="inDetailsRange">Whether the examiner is within the 'Details' range, allowing you to show information logically only availabe when close to the examined entity.</param>
|
||||
void Examine(FormattedMessage message, bool inDetailsRange);
|
||||
}
|
||||
|
||||
public abstract class ExamineSystemShared : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
@@ -269,21 +251,6 @@ namespace Content.Shared.Examine
|
||||
var examinedEvent = new ExaminedEvent(message, entity, examiner.Value, isInDetailsRange, doNewline);
|
||||
RaiseLocalEvent(entity, examinedEvent);
|
||||
|
||||
//Add component statuses from components that report one
|
||||
foreach (var examineComponent in EntityManager.GetComponents<IExamine>(entity))
|
||||
{
|
||||
var subMessage = new FormattedMessage();
|
||||
examineComponent.Examine(subMessage, isInDetailsRange);
|
||||
if (subMessage.Tags.Count == 0)
|
||||
continue;
|
||||
|
||||
if (doNewline)
|
||||
message.AddText("\n");
|
||||
|
||||
message.AddMessage(subMessage);
|
||||
doNewline = true;
|
||||
}
|
||||
|
||||
message.Pop();
|
||||
|
||||
return message;
|
||||
|
||||
Reference in New Issue
Block a user