CatStation/Content.Server/Radio/Components/NotifyOnNonFunctioningComponent.cs
Fildrance 1a5e9acb24
Extract notify on non-functioning from emitter (#45346)
* refactor: extracted notify-on-non-functioning feature from emitter component

* refactor: revert server side PowerStateSystem usage of SubscribeLocalEvent - it is not calling base Initialize, skip SetWorkingState raising event on init

* refactor: ensureAPC is now conditional for powerstate

* refactor: fix double notifiation on destruction and on un-powering for emitter

* refactor: added LocTurnedOff for NotifyOnNonFunctioningComponent, fix double alert on destruction, removed emitter-deconstructed-broadcast as it is unused (cannot deconstruct withou unanchor)

* refactor: modernize server PowerStateSystem subscription

* refactor: update and modernize PowerStatePrototypeTest

* refactor: give APE specific radio message upon unlocking

* refactor: extracted PowerStateSystem.SetPowerLoad to split init from triggering is-working change event

* Update Content.Server/Power/EntitySystems/PowerStateSystem.cs

---------

Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>
2026-08-16 23:08:58 +00:00

66 lines
1.8 KiB
C#

using Content.Server.Radio.EntitySystems;
using Content.Shared.Radio;
using Robust.Shared.Prototypes;
namespace Content.Server.Radio.Components;
/// <summary>
/// Component for attempting to post radio message to chat
/// upon something destructive happens to device.
/// Can be used for singularity containment field emitters
/// or other crucial parts of infrastructure.
/// </summary>
[RegisterComponent]
[Access(typeof(NotifyOnNonFunctioningSystem))]
public sealed partial class NotifyOnNonFunctioningComponent : Component
{
/// <summary>
/// The radio channel to broadcast on when something happens to this device
/// </summary>
[DataField(required: true)]
public ProtoId<RadioChannelPrototype> RadioChannel;
/// <summary>
/// Localized string to use when this device is destroyed.
/// </summary>
[DataField]
public LocId? LocDestroyed;
/// <summary>
/// Localized string to use when this device is deconstructed.
/// </summary>
[DataField]
public LocId? LocDeconstructed;
/// <summary>
/// Localized string to use when this device is unlocked.
/// </summary>
[DataField]
public LocId? LocUnlocked;
/// <summary>
/// Localized string to use when this device have
/// no power supply to keep working.
/// </summary>
[DataField]
public LocId? LocUnpowered;
/// <summary>
/// Localized string to use when this device is turned off.
/// </summary>
[DataField]
public LocId? LocTurnedOff;
/// <summary>
/// Localized string to use when this device is unanchored
/// (and is most likely is not able to function).
/// </summary>
[DataField]
public LocId? LocUnanchored;
/// <summary>
/// Marker, if power is required to send radio message.
/// </summary>
[DataField]
public bool RequirePowered;
}