Skip to content

Commit

Permalink
Merge pull request Simple-Station#194 from Mnemotechnician/fix/leash
Browse files Browse the repository at this point in the history
Hotfix Leashes Being Unremovable
  • Loading branch information
Memeji authored Sep 19, 2024
2 parents 186e51a + 6affdec commit fc983eb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Content.Shared/Floofstation/Leash/LeashSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ private void OnJointRemoved(Entity<LeashedComponent> ent, ref JointRemovedEvent
|| ent.Comp.Puller is not { } puller
|| !TryComp<LeashAnchorComponent>(ent.Comp.Anchor, out var anchor)
|| !TryComp<LeashComponent>(puller, out var leash)
|| leash.Leashed.All(it => it.JointId != id)
|| !Transform(ent).Coordinates.TryDistance(EntityManager, Transform(puller).Coordinates, out var dst)
|| dst > leash.MaxDistance
)
Expand Down Expand Up @@ -397,16 +398,16 @@ public void RemoveLeash(Entity<LeashedComponent?> leashed, Entity<LeashComponent
if (_container.TryGetContainer(leashed, LeashedComponent.VisualsContainerName, out var visualsContainer))
_container.CleanContainer(visualsContainer);

if (breakJoint && jointId is not null)
_joints.RemoveJoint(leash, jointId);

if (Resolve(leash, ref leash.Comp, false))
{
var leashedData = leash.Comp.Leashed.Where(it => it.JointId == jointId).ToList();
foreach (var data in leashedData)
leash.Comp.Leashed.Remove(data);
}

if (breakJoint && jointId is not null)
_joints.RemoveJoint(leash, jointId);

Dirty(leash);
}

Expand Down

0 comments on commit fc983eb

Please sign in to comment.