Merge remote-tracking branch 'upstream/stable' into ed-25-08-2025-upstream-sync
# Conflicts: # .github/CODEOWNERS # Content.Client/UserInterface/Systems/Actions/Controls/ActionButton.cs # Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs # Content.Server/Chat/Systems/ChatSystem.cs # Content.Server/Explosion/EntitySystems/TriggerSystem.cs # Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs # Content.Shared/Lock/LockSystem.cs # Content.Shared/Nutrition/Components/FoodComponent.cs # Content.Shared/Speech/ListenEvent.cs # Resources/Prototypes/Entities/Effects/admin_triggers.yml
This commit is contained in:
@@ -30,12 +30,12 @@ public sealed class LockSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
|
||||
[Dependency] private readonly ActivatableUISystem _activatableUI = default!;
|
||||
[Dependency] private readonly EmagSystem _emag = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _sharedPopupSystem = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
||||
[Dependency] private readonly SharedUserInterfaceSystem _ui = default!;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize()
|
||||
@@ -57,8 +57,8 @@ public sealed class LockSystem : EntitySystem
|
||||
SubscribeLocalEvent<LockedWiresPanelComponent, AttemptChangePanelEvent>(OnAttemptChangePanel);
|
||||
SubscribeLocalEvent<LockedAnchorableComponent, UnanchorAttemptEvent>(OnUnanchorAttempt);
|
||||
|
||||
SubscribeLocalEvent<ActivatableUIRequiresLockComponent, ActivatableUIOpenAttemptEvent>(OnUIOpenAttempt);
|
||||
SubscribeLocalEvent<ActivatableUIRequiresLockComponent, LockToggledEvent>(LockToggled);
|
||||
SubscribeLocalEvent<UIRequiresLockComponent, ActivatableUIOpenAttemptEvent>(OnUIOpenAttempt);
|
||||
SubscribeLocalEvent<UIRequiresLockComponent, LockToggledEvent>(LockToggled);
|
||||
|
||||
SubscribeLocalEvent<ItemToggleRequiresLockComponent, ItemToggleActivateAttemptEvent>(OnActivateAttempt);
|
||||
}
|
||||
@@ -112,6 +112,9 @@ public sealed class LockSystem : EntitySystem
|
||||
|
||||
private void OnExamined(EntityUid uid, LockComponent lockComp, ExaminedEvent args)
|
||||
{
|
||||
if (!lockComp.ShowExamine)
|
||||
return;
|
||||
|
||||
args.PushText(Loc.GetString(lockComp.Locked
|
||||
? "lock-comp-on-examined-is-locked"
|
||||
: "lock-comp-on-examined-is-unlocked",
|
||||
@@ -255,6 +258,20 @@ public sealed class LockSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggle the lock to locked if unlocked, and unlocked if locked.
|
||||
/// </summary>
|
||||
/// <param name="uid">Entity to toggle the lock state of.</param>
|
||||
/// <param name="user">The person trying to toggle the lock</param>
|
||||
/// <param name="lockComp">Entities lock comp (will be resolved)</param>
|
||||
public void ToggleLock(EntityUid uid, EntityUid? user, LockComponent? lockComp = null)
|
||||
{
|
||||
if (IsLocked((uid, lockComp)))
|
||||
Unlock(uid, user, lockComp);
|
||||
else
|
||||
Lock(uid, user, lockComp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the entity is locked.
|
||||
/// Entities with no lock component are considered unlocked.
|
||||
@@ -305,11 +322,12 @@ public sealed class LockSystem : EntitySystem
|
||||
{
|
||||
//CrystallEdge Lock System Adapt
|
||||
|
||||
//if (!args.CanAccess || !args.CanInteract || !args.CanComplexInteract)
|
||||
//if (!args.CanAccess || !args.CanInteract || !args.CanComplexInteract || !component.ShowLockVerbs)
|
||||
// return;
|
||||
//
|
||||
|
||||
//AlternativeVerb verb = new()
|
||||
//{
|
||||
// Disabled = !CanToggleLock(uid, args.User),
|
||||
// Act = component.Locked
|
||||
// ? () => TryUnlock(uid, args.User, component)
|
||||
// : () => TryLock(uid, args.User, component),
|
||||
@@ -414,41 +432,54 @@ public sealed class LockSystem : EntitySystem
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnUIOpenAttempt(EntityUid uid, ActivatableUIRequiresLockComponent component, ActivatableUIOpenAttemptEvent args)
|
||||
private void OnUIOpenAttempt(EntityUid uid, UIRequiresLockComponent component, ActivatableUIOpenAttemptEvent args)
|
||||
{
|
||||
if (args.Cancelled)
|
||||
return;
|
||||
|
||||
if (TryComp<LockComponent>(uid, out var lockComp) && lockComp.Locked != component.RequireLocked)
|
||||
{
|
||||
args.Cancel();
|
||||
if (lockComp.Locked)
|
||||
{
|
||||
_sharedPopupSystem.PopupClient(Loc.GetString("entity-storage-component-locked-message"), uid, args.User);
|
||||
}
|
||||
if (!TryComp<LockComponent>(uid, out var lockComp) || lockComp.Locked == component.RequireLocked)
|
||||
return;
|
||||
|
||||
_audio.PlayPredicted(component.AccessDeniedSound, uid, args.User);
|
||||
args.Cancel();
|
||||
if (lockComp.Locked && component.Popup != null)
|
||||
{
|
||||
_sharedPopupSystem.PopupClient(Loc.GetString(component.Popup), uid, args.User);
|
||||
}
|
||||
|
||||
_audio.PlayPredicted(component.AccessDeniedSound, uid, args.User);
|
||||
}
|
||||
|
||||
private void LockToggled(EntityUid uid, ActivatableUIRequiresLockComponent component, LockToggledEvent args)
|
||||
private void LockToggled(EntityUid uid, UIRequiresLockComponent component, LockToggledEvent args)
|
||||
{
|
||||
if (!TryComp<LockComponent>(uid, out var lockComp) || lockComp.Locked == component.RequireLocked)
|
||||
return;
|
||||
|
||||
_activatableUI.CloseAll(uid);
|
||||
if (component.UserInterfaceKeys == null)
|
||||
{
|
||||
_ui.CloseUis(uid);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var key in component.UserInterfaceKeys)
|
||||
{
|
||||
_ui.CloseUi(uid, key);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnActivateAttempt(EntityUid uid, ItemToggleRequiresLockComponent component, ref ItemToggleActivateAttemptEvent args)
|
||||
{
|
||||
if (args.Cancelled)
|
||||
return;
|
||||
|
||||
if (TryComp<LockComponent>(uid, out var lockComp) && lockComp.Locked != component.RequireLocked)
|
||||
if (!TryComp<LockComponent>(uid, out var lockComp) || lockComp.Locked == component.RequireLocked)
|
||||
return;
|
||||
|
||||
args.Cancelled = true;
|
||||
|
||||
if (lockComp.Locked && component.LockedPopup != null)
|
||||
{
|
||||
args.Cancelled = true;
|
||||
if (lockComp.Locked)
|
||||
_sharedPopupSystem.PopupClient(Loc.GetString("lock-comp-generic-fail",
|
||||
("target", Identity.Entity(uid, EntityManager))),
|
||||
_sharedPopupSystem.PopupClient(Loc.GetString(component.LockedPopup,
|
||||
("target", Identity.Entity(uid, EntityManager))),
|
||||
uid,
|
||||
args.User);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user