Skip to content

Commit

Permalink
Fix dropping carried entity when walking to a different grid and acci…
Browse files Browse the repository at this point in the history
…dental escape from carrying
  • Loading branch information
Mnemotechnician committed Jun 24, 2024
1 parent 32394b0 commit 520cbaa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Content.Server/Nyanotrasen/Carrying/CarryingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ private void OnThrow(EntityUid uid, CarryingComponent component, BeforeThrowEven

private void OnParentChanged(EntityUid uid, CarryingComponent component, ref EntParentChangedMessage args)
{
if (Transform(uid).MapID != args.OldMapId)
var xform = Transform(uid);
if (xform.MapID != args.OldMapId)
return;

// Do not drop the carried entity if the new parent is a grid
if (xform.ParentUid == xform.GridUid)
return;

DropCarried(uid, component.Carried);
Expand Down Expand Up @@ -158,6 +163,9 @@ private void OnMoveInput(EntityUid uid, BeingCarriedComponent component, ref Mov
if (!TryComp<CanEscapeInventoryComponent>(uid, out var escape))
return;

if (!args.HasDirectionalMovement)
return;

if (_actionBlockerSystem.CanInteract(uid, component.Carrier))
{
_escapeInventorySystem.AttemptEscape(uid, component.Carrier, escape, MassContest(uid, component.Carrier));
Expand Down

0 comments on commit 520cbaa

Please sign in to comment.