Make pull chains faster (#10794)
* Make pull chains faster * swap order
This commit is contained in:
@@ -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<TileFrictionModifierComponent>();
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
var pullerQuery = GetEntityQuery<SharedPullerComponent>();
|
||||
var pullableQuery = GetEntityQuery<SharedPullableComponent>();
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user