Skip to content

Commit

Permalink
Merge pull request impstation#791 from TGRCdev/pulled-crates-fix
Browse files Browse the repository at this point in the history
Pulled lockers/crates can now only be opened by the person pulling them
  • Loading branch information
formlessnameless authored Nov 27, 2024
2 parents a8212e7 + c08ca6c commit 3794835
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
using Robust.Shared.Physics.Systems;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Content.Shared.Movement.Pulling.Components;

namespace Content.Shared.Storage.EntitySystems;

Expand Down Expand Up @@ -371,6 +372,15 @@ public bool CanOpen(EntityUid user, EntityUid target, bool silent = false, Share
}
}

// impstation edit: prevent opening containers being pulled by others
if (
TryComp<PullableComponent>(target, out var pullable) && // Can be pulled
pullable.BeingPulled && // Someone is pulling it
pullable.Puller != user && // It is not the user
!component.Contents.Contains(user) // The user is not inside of it
)
return false;

//Checks to see if the opening position, if offset, is inside of a wall.
if (component.EnteringOffset != new Vector2(0, 0) && !HasComp<WallMountComponent>(target)) //if the entering position is offset
{
Expand Down

0 comments on commit 3794835

Please sign in to comment.