Files
tbd-station-14/Content.Server/Destructible/Thresholds/Behaviors/PopupBehavior.cs
SlamBamActionman f544c91298 Revert Exterminator pending newmed/redesign (#26978)
* Reverts Exterminator

* Includes commented out parts + sprites

* Readd stuff, comment out yaml

* Popup ads

* review

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2024-04-28 15:45:54 +10:00

31 lines
946 B
C#

using Content.Shared.Popups;
namespace Content.Server.Destructible.Thresholds.Behaviors;
/// <summary>
/// Shows a popup for everyone.
/// </summary>
[DataDefinition]
public sealed partial class PopupBehavior : IThresholdBehavior
{
/// <summary>
/// Locale id of the popup message.
/// </summary>
[DataField("popup", required: true)]
public string Popup;
/// <summary>
/// Type of popup to show.
/// </summary>
[DataField("popupType")]
public PopupType PopupType;
public void Execute(EntityUid uid, DestructibleSystem system, EntityUid? cause = null)
{
var popup = system.EntityManager.System<SharedPopupSystem>();
// popup is placed at coords since the entity could be deleted after, no more popup then
var coords = system.EntityManager.GetComponent<TransformComponent>(uid).Coordinates;
popup.PopupCoordinates(Loc.GetString(Popup), coords, PopupType);
}
}