+++ /dev/null
-using Content.Server.Lock.Components;
-using Content.Server.Popups;
-using Content.Shared.UserInterface;
-using Content.Shared.Lock;
-using Content.Server.UserInterface;
-using ActivatableUISystem = Content.Shared.UserInterface.ActivatableUISystem;
-
-namespace Content.Server.Lock.EntitySystems;
-public sealed class ActivatableUIRequiresLockSystem : EntitySystem
-{
- [Dependency] private readonly ActivatableUISystem _activatableUI = default!;
- [Dependency] private readonly PopupSystem _popupSystem = default!;
-
- public override void Initialize()
- {
- base.Initialize();
-
- SubscribeLocalEvent<ActivatableUIRequiresLockComponent, ActivatableUIOpenAttemptEvent>(OnUIOpenAttempt);
- SubscribeLocalEvent<ActivatableUIRequiresLockComponent, LockToggledEvent>(LockToggled);
- }
-
- private void OnUIOpenAttempt(EntityUid uid, ActivatableUIRequiresLockComponent component, ActivatableUIOpenAttemptEvent args)
- {
- if (args.Cancelled)
- return;
-
- if (TryComp<LockComponent>(uid, out var lockComp) && lockComp.Locked != component.requireLocked)
- {
- args.Cancel();
- if (lockComp.Locked)
- _popupSystem.PopupEntity(Loc.GetString("entity-storage-component-locked-message"), uid, args.User);
- }
- }
-
- private void LockToggled(EntityUid uid, ActivatableUIRequiresLockComponent component, LockToggledEvent args)
- {
- if (!TryComp<LockComponent>(uid, out var lockComp) || lockComp.Locked == component.requireLocked)
- return;
-
- _activatableUI.CloseAll(uid);
- }
-}
-
using Content.Server.Explosion.EntitySystems;
using Content.Server.Hands.Systems;
using Content.Server.PowerCell;
-using Content.Shared.UserInterface;
using Content.Shared.Access.Systems;
using Content.Shared.Alert;
using Content.Shared.Database;
SubscribeLocalEvent<BorgChassisComponent, MobStateChangedEvent>(OnMobStateChanged);
SubscribeLocalEvent<BorgChassisComponent, PowerCellChangedEvent>(OnPowerCellChanged);
SubscribeLocalEvent<BorgChassisComponent, PowerCellSlotEmptyEvent>(OnPowerCellSlotEmpty);
- SubscribeLocalEvent<BorgChassisComponent, ActivatableUIOpenAttemptEvent>(OnUIOpenAttempt);
SubscribeLocalEvent<BorgChassisComponent, GetCharactedDeadIcEvent>(OnGetDeadIC);
SubscribeLocalEvent<BorgBrainComponent, MindAddedMessage>(OnBrainMindAdded);
UpdateUI(uid, component);
}
- private void OnUIOpenAttempt(EntityUid uid, BorgChassisComponent component, ActivatableUIOpenAttemptEvent args)
- {
- // borgs can't view their own ui
- if (args.User == uid)
- args.Cancel();
- }
-
private void OnGetDeadIC(EntityUid uid, BorgChassisComponent component, ref GetCharactedDeadIcEvent args)
{
args.Dead = true;
using Content.Server.Construction;
using Content.Server.Construction.Components;
using Content.Server.Power.Components;
-using Content.Server.UserInterface;
using Content.Shared.DoAfter;
using Content.Shared.GameTicking;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Content.Shared.Tools.Components;
-using Content.Shared.UserInterface;
using Content.Shared.Wires;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
-using ActivatableUISystem = Content.Shared.UserInterface.ActivatableUISystem;
namespace Content.Server.Wires;
public sealed class WiresSystem : SharedWiresSystem
{
[Dependency] private readonly IPrototypeManager _protoMan = default!;
- [Dependency] private readonly ActivatableUISystem _activatableUI = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
SubscribeLocalEvent<WiresComponent, TimedWireEvent>(OnTimedWire);
SubscribeLocalEvent<WiresComponent, PowerChangedEvent>(OnWiresPowered);
SubscribeLocalEvent<WiresComponent, WireDoAfterEvent>(OnDoAfter);
- SubscribeLocalEvent<ActivatableUIRequiresPanelComponent, ActivatableUIOpenAttemptEvent>(OnAttemptOpenActivatableUI);
- SubscribeLocalEvent<ActivatableUIRequiresPanelComponent, PanelChangedEvent>(OnActivatableUIPanelChanged);
SubscribeLocalEvent<WiresPanelSecurityComponent, WiresPanelSecurityEvent>(SetWiresPanelSecurity);
}
_uiSystem.CloseUi(ent.Owner, WiresUiKey.Key);
}
- private void OnAttemptOpenActivatableUI(EntityUid uid, ActivatableUIRequiresPanelComponent component, ActivatableUIOpenAttemptEvent args)
- {
- if (args.Cancelled || !TryComp<WiresPanelComponent>(uid, out var wires))
- return;
-
- if (component.RequireOpen != wires.Open)
- args.Cancel();
- }
-
- private void OnActivatableUIPanelChanged(EntityUid uid, ActivatableUIRequiresPanelComponent component, ref PanelChangedEvent args)
- {
- if (args.Open == component.RequireOpen)
- return;
-
- _activatableUI.CloseAll(uid);
- }
-
private void OnMapInit(EntityUid uid, WiresComponent component, MapInitEvent args)
{
if (!string.IsNullOrEmpty(component.LayoutId))
-namespace Content.Server.Lock.Components;
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Lock;
/// <summary>
/// This is used for activatable UIs that require the entity to have a lock in a certain state.
/// </summary>
-[RegisterComponent]
+[RegisterComponent, NetworkedComponent, Access(typeof(LockSystem))]
public sealed partial class ActivatableUIRequiresLockComponent : Component
{
/// <summary>
/// TRUE: the lock must be locked to access the UI.
/// FALSE: the lock must be unlocked to access the UI.
/// </summary>
- [DataField("requireLocked"), ViewVariables(VVAccess.ReadWrite)]
- public bool requireLocked = false;
+ [DataField]
+ public bool RequireLocked;
}
using Content.Shared.Popups;
using Content.Shared.Storage;
using Content.Shared.Storage.Components;
+using Content.Shared.UserInterface;
using Content.Shared.Verbs;
using Content.Shared.Wires;
using JetBrains.Annotations;
public sealed class LockSystem : EntitySystem
{
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
+ [Dependency] private readonly ActivatableUISystem _activatableUI = default!;
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedPopupSystem _sharedPopupSystem = default!;
SubscribeLocalEvent<LockedWiresPanelComponent, LockToggleAttemptEvent>(OnLockToggleAttempt);
SubscribeLocalEvent<LockedWiresPanelComponent, AttemptChangePanelEvent>(OnAttemptChangePanel);
SubscribeLocalEvent<LockedAnchorableComponent, UnanchorAttemptEvent>(OnUnanchorAttempt);
+
+ SubscribeLocalEvent<ActivatableUIRequiresLockComponent, ActivatableUIOpenAttemptEvent>(OnUIOpenAttempt);
+ SubscribeLocalEvent<ActivatableUIRequiresLockComponent, LockToggledEvent>(LockToggled);
}
private void OnStartup(EntityUid uid, LockComponent lockComp, ComponentStartup args)
args.User);
args.Cancel();
}
+
+ private void OnUIOpenAttempt(EntityUid uid, ActivatableUIRequiresLockComponent component, ActivatableUIOpenAttemptEvent args)
+ {
+ if (args.Cancelled)
+ return;
+
+ if (TryComp<LockComponent>(uid, out var lockComp) && lockComp.Locked != component.RequireLocked)
+ {
+ args.Cancel();
+ if (lockComp.Locked)
+ _sharedPopupSystem.PopupEntity(Loc.GetString("entity-storage-component-locked-message"), uid, args.User);
+ }
+ }
+
+ private void LockToggled(EntityUid uid, ActivatableUIRequiresLockComponent component, LockToggledEvent args)
+ {
+ if (!TryComp<LockComponent>(uid, out var lockComp) || lockComp.Locked == component.RequireLocked)
+ return;
+
+ _activatableUI.CloseAll(uid);
+ }
}
using Content.Shared.Popups;
using Content.Shared.PowerCell.Components;
using Content.Shared.Silicons.Borgs.Components;
+using Content.Shared.UserInterface;
using Content.Shared.Wires;
using Robust.Shared.Containers;
SubscribeLocalEvent<BorgChassisComponent, EntInsertedIntoContainerMessage>(OnInserted);
SubscribeLocalEvent<BorgChassisComponent, EntRemovedFromContainerMessage>(OnRemoved);
SubscribeLocalEvent<BorgChassisComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovementSpeedModifiers);
-
+ SubscribeLocalEvent<BorgChassisComponent, ActivatableUIOpenAttemptEvent>(OnUIOpenAttempt);
+
InitializeRelay();
}
component.ModuleContainer = Container.EnsureContainer<Container>(uid, component.ModuleContainerId, containerManager);
}
+ private void OnUIOpenAttempt(EntityUid uid, BorgChassisComponent component, ActivatableUIOpenAttemptEvent args)
+ {
+ // borgs can't view their own ui
+ if (args.User == uid)
+ args.Cancel();
+ }
+
protected virtual void OnInserted(EntityUid uid, BorgChassisComponent component, EntInsertedIntoContainerMessage args)
{
-namespace Content.Server.Wires;
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Wires;
/// <summary>
/// This is used for activatable UIs that require the entity to have a panel in a certain state.
/// </summary>
-[RegisterComponent]
+[RegisterComponent, NetworkedComponent, Access(typeof(SharedWiresSystem))]
public sealed partial class ActivatableUIRequiresPanelComponent : Component
{
/// <summary>
/// TRUE: the panel must be open to access the UI.
/// FALSE: the panel must be closed to access the UI.
/// </summary>
- [DataField("requireOpen"), ViewVariables(VVAccess.ReadWrite)]
+ [DataField]
public bool RequireOpen = true;
}
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Tools.Systems;
+using Content.Shared.UserInterface;
using Robust.Shared.Audio.Systems;
namespace Content.Shared.Wires;
public abstract class SharedWiresSystem : EntitySystem
{
[Dependency] protected readonly ISharedAdminLogManager AdminLogger = default!;
+ [Dependency] private readonly ActivatableUISystem _activatableUI = default!;
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
[Dependency] protected readonly SharedAudioSystem Audio = default!;
[Dependency] protected readonly SharedToolSystem Tool = default!;
SubscribeLocalEvent<WiresPanelComponent, WirePanelDoAfterEvent>(OnPanelDoAfter);
SubscribeLocalEvent<WiresPanelComponent, InteractUsingEvent>(OnInteractUsing);
SubscribeLocalEvent<WiresPanelComponent, ExaminedEvent>(OnExamine);
+
+ SubscribeLocalEvent<ActivatableUIRequiresPanelComponent, ActivatableUIOpenAttemptEvent>(OnAttemptOpenActivatableUI);
+ SubscribeLocalEvent<ActivatableUIRequiresPanelComponent, PanelChangedEvent>(OnActivatableUIPanelChanged);
}
private void OnPanelDoAfter(EntityUid uid, WiresPanelComponent panel, WirePanelDoAfterEvent args)
return entity.Comp.Open;
}
+
+ private void OnAttemptOpenActivatableUI(EntityUid uid, ActivatableUIRequiresPanelComponent component, ActivatableUIOpenAttemptEvent args)
+ {
+ if (args.Cancelled || !TryComp<WiresPanelComponent>(uid, out var wires))
+ return;
+
+ if (component.RequireOpen != wires.Open)
+ args.Cancel();
+ }
+
+ private void OnActivatableUIPanelChanged(EntityUid uid, ActivatableUIRequiresPanelComponent component, ref PanelChangedEvent args)
+ {
+ if (args.Open == component.RequireOpen)
+ return;
+
+ _activatableUI.CloseAll(uid);
+ }
}