mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-19 06:28:40 +03:00
# Description Removed duplicate using statements, removed unused using statements. this will decrease the number of warnings a small bit, and decrease unused dependency references in general. --- # TODO - [x] Remove double references. - [x] Remove unused references. --- # Changelog 🆑 - remove: double references in code - remove: unused references in code that had double references. Co-authored-by: ilmenwe <no@mail.com> (cherry picked from commit 9b73c88feefff68223f083893505826dc021ddee)
39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
using Content.Shared.Popups;
|
|
using Content.Shared.Power;
|
|
using Content.Shared.Power.Components;
|
|
using Content.Shared.UserInterface;
|
|
using Content.Shared.Wires;
|
|
using ActivatableUISystem = Content.Shared.UserInterface.ActivatableUISystem;
|
|
|
|
namespace Content.Server.Power.EntitySystems;
|
|
|
|
public sealed class ActivatableUIRequiresPowerSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly ActivatableUISystem _activatableUI = default!;
|
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<ActivatableUIRequiresPowerComponent, ActivatableUIOpenAttemptEvent>(OnActivate);
|
|
SubscribeLocalEvent<ActivatableUIRequiresPowerComponent, PowerChangedEvent>(OnPowerChanged);
|
|
}
|
|
|
|
private void OnActivate(EntityUid uid, ActivatableUIRequiresPowerComponent component, ActivatableUIOpenAttemptEvent args)
|
|
{
|
|
if (args.Cancelled) return;
|
|
if (this.IsPowered(uid, EntityManager)) return;
|
|
if (TryComp<WiresPanelComponent>(uid, out var panel) && panel.Open)
|
|
return;
|
|
_popup.PopupCursor(Loc.GetString("base-computer-ui-component-not-powered", ("machine", uid)), args.User);
|
|
args.Cancel();
|
|
}
|
|
|
|
private void OnPowerChanged(EntityUid uid, ActivatableUIRequiresPowerComponent component, ref PowerChangedEvent args)
|
|
{
|
|
if (!args.Powered)
|
|
_activatableUI.CloseAll(uid);
|
|
}
|
|
}
|