From 9e8c5c0ed6e127f1c904b9615de8aa584c75c2aa Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Tue, 30 Aug 2022 12:19:24 +1000 Subject: [PATCH] Make pull chains faster (#10794) * Make pull chains faster * swap order --- .../Friction/SharedTileFrictionController.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Content.Shared/Friction/SharedTileFrictionController.cs b/Content.Shared/Friction/SharedTileFrictionController.cs index 968f3633e6..d30c5a6d41 100644 --- a/Content.Shared/Friction/SharedTileFrictionController.cs +++ b/Content.Shared/Friction/SharedTileFrictionController.cs @@ -3,6 +3,7 @@ using Content.Shared.Gravity; using Content.Shared.Movement; using Content.Shared.Movement.Components; using Content.Shared.Movement.Systems; +using Content.Shared.Pulling.Components; using JetBrains.Annotations; using Robust.Shared.Configuration; using Robust.Shared.GameStates; @@ -70,6 +71,8 @@ namespace Content.Shared.Friction var frictionQuery = GetEntityQuery(); var xformQuery = GetEntityQuery(); + var pullerQuery = GetEntityQuery(); + var pullableQuery = GetEntityQuery(); foreach (var body in mapComponent.AwakeBodies) { @@ -96,6 +99,15 @@ namespace Content.Shared.Friction bodyModifier = frictionComp.Modifier; } + // If we're sandwiched between 2 pullers reduce friction + // Might be better to make this dynamic and check how many are in the pull chain? + // Either way should be much faster for now. + if (pullerQuery.TryGetComponent(body.Owner, out var puller) && puller.Pulling != null && + pullableQuery.TryGetComponent(body.Owner, out var pullable) && pullable.BeingPulled) + { + bodyModifier *= 0.2f; + } + var friction = _frictionModifier * surfaceFriction * bodyModifier; ReduceLinearVelocity(prediction, body, friction, frameTime);