mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
Allow handless mobs to exit containers, make ResistLocker respect OpenOnMove (#37250)
reviews Co-authored-by: AJCM-git <ajcm_mail@disroot.org>
This commit is contained in:
parent
73d674beca
commit
86fbd28504
2 changed files with 21 additions and 15 deletions
|
|
@ -33,7 +33,7 @@ public sealed partial class ResistLockerSystem : EntitySystem
|
|||
if (component.IsResisting)
|
||||
return;
|
||||
|
||||
if (!TryComp(uid, out EntityStorageComponent? storageComponent))
|
||||
if (!TryComp(uid, out EntityStorageComponent? storageComponent) || !storageComponent.OpenOnMove)
|
||||
return;
|
||||
|
||||
if (!_actionBlocker.CanMove(args.Entity))
|
||||
|
|
@ -65,30 +65,34 @@ public sealed partial class ResistLockerSystem : EntitySystem
|
|||
_popupSystem.PopupEntity(Loc.GetString("resist-locker-component-start-resisting"), user, user, PopupType.Large);
|
||||
}
|
||||
|
||||
// TODO: Convert to DoAfterAttemptEvent
|
||||
private void OnDoAfter(EntityUid uid, ResistLockerComponent component, DoAfterEvent args)
|
||||
{
|
||||
if (args.Cancelled)
|
||||
{
|
||||
component.IsResisting = false;
|
||||
_popupSystem.PopupEntity(Loc.GetString("resist-locker-component-resist-interrupted"), args.Args.User, args.Args.User, PopupType.Medium);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Handled || args.Args.Target == null)
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
component.IsResisting = false;
|
||||
|
||||
if (HasComp<EntityStorageComponent>(uid))
|
||||
if (args.Target != uid)
|
||||
return;
|
||||
|
||||
if (args.Cancelled)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("resist-locker-component-resist-interrupted"), args.User, args.User, PopupType.Medium);
|
||||
return;
|
||||
}
|
||||
|
||||
if (TryComp(uid, out EntityStorageComponent? storageComponent))
|
||||
{
|
||||
WeldableComponent? weldable = null;
|
||||
if (_weldable.IsWelded(uid, weldable))
|
||||
_weldable.SetWeldedState(uid, false, weldable);
|
||||
|
||||
if (TryComp<LockComponent>(args.Args.Target.Value, out var lockComponent))
|
||||
_lockSystem.Unlock(uid, args.Args.User, lockComponent);
|
||||
if (TryComp<LockComponent>(uid, out var lockComponent))
|
||||
_lockSystem.Unlock(uid, args.User, lockComponent);
|
||||
|
||||
_entityStorage.TryOpenStorage(args.Args.User, uid);
|
||||
if (storageComponent.OpenOnMove)
|
||||
_entityStorage.TryOpenStorage(args.User, uid);
|
||||
}
|
||||
|
||||
args.Handled = true;
|
||||
|
|
|
|||
|
|
@ -115,7 +115,8 @@ public abstract partial class SharedEntityStorageSystem : EntitySystem
|
|||
|
||||
private void OnRelayMovement(EntityUid uid, EntityStorageComponent component, ref ContainerRelayMovementEntityEvent args)
|
||||
{
|
||||
if (!HasComp<HandsComponent>(args.Entity))
|
||||
if (!component.Contents.Contains(args.Entity) &&
|
||||
!HasComp<HandsComponent>(args.Entity))
|
||||
return;
|
||||
|
||||
if (!_actionBlocker.CanMove(args.Entity))
|
||||
|
|
@ -415,7 +416,8 @@ public abstract partial class SharedEntityStorageSystem : EntitySystem
|
|||
if (!Resolve(target, ref component))
|
||||
return false;
|
||||
|
||||
if (!HasComp<HandsComponent>(user))
|
||||
if (!component.Contents.Contains(user) &&
|
||||
!HasComp<HandsComponent>(user))
|
||||
return false;
|
||||
|
||||
if (_weldable.IsWelded(target))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue