Files
wwdpublic/Content.Client/Power/ActivatableUIRequiresPowerSystem.cs
Pieter-Jan Briers ec7e1213f8 Fix powered machines working unpowered if the panel is open. (#32135)
(cherry picked from commit 8385de8769fe8835e9ed74641d5c42bae6dc125c)
2026-02-11 19:19:18 +03:00

25 lines
827 B
C#

using Content.Client.Power.EntitySystems;
using Content.Shared.Popups;
using Content.Shared.Power.Components;
using Content.Shared.Power.EntitySystems;
using Content.Shared.UserInterface;
using Content.Shared.Wires;
namespace Content.Client.Power;
public sealed class ActivatableUIRequiresPowerSystem : SharedActivatableUIRequiresPowerSystem
{
[Dependency] private readonly SharedPopupSystem _popup = default!;
protected override void OnActivate(Entity<ActivatableUIRequiresPowerComponent> ent, ref ActivatableUIOpenAttemptEvent args)
{
if (args.Cancelled || this.IsPowered(ent.Owner, EntityManager))
{
return;
}
_popup.PopupClient(Loc.GetString("base-computer-ui-component-not-powered", ("machine", ent.Owner)), args.User, args.User);
args.Cancel();
}
}