From 39e42899ca577d1df93b9b14f3566a65960e6e58 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Wed, 29 Dec 2021 23:14:21 +1100 Subject: [PATCH] Reduce MaxBuckleDistance (#5938) --- .../Buckle/Components/BuckleComponent.cs | 19 +------------------ .../Buckle/Components/StrapComponent.cs | 5 +---- Content.Server/Buckle/Systems/BuckleSystem.cs | 8 -------- .../Components/SharedBuckleComponent.cs | 2 -- Content.Shared/Buckle/SharedBuckleSystem.cs | 1 - 5 files changed, 2 insertions(+), 33 deletions(-) diff --git a/Content.Server/Buckle/Components/BuckleComponent.cs b/Content.Server/Buckle/Components/BuckleComponent.cs index d140e264fb..9da4b1eea4 100644 --- a/Content.Server/Buckle/Components/BuckleComponent.cs +++ b/Content.Server/Buckle/Components/BuckleComponent.cs @@ -133,7 +133,7 @@ namespace Content.Server.Buckle.Components break; } - ownTransform.LocalPosition = Vector2.Zero + strap.BuckleOffset; + ownTransform.LocalPosition = strap.BuckleOffset; } public bool CanBuckle(EntityUid user, EntityUid to, [NotNullWhen(true)] out StrapComponent? strap) @@ -410,22 +410,5 @@ namespace Content.Server.Buckle.Components return new BuckleComponentState(Buckled, drawDepth, LastEntityBuckledTo, DontCollide); } - - public void Update(PhysicsComponent physics) - { - if (!DontCollide) - return; - - physics.WakeBody(); - - if (!IsOnStrapEntityThisFrame && DontCollide) - { - DontCollide = false; - TryUnbuckle(Owner); - Dirty(); - } - - IsOnStrapEntityThisFrame = false; - } } } diff --git a/Content.Server/Buckle/Components/StrapComponent.cs b/Content.Server/Buckle/Components/StrapComponent.cs index 21d1588225..81f0e79d31 100644 --- a/Content.Server/Buckle/Components/StrapComponent.cs +++ b/Content.Server/Buckle/Components/StrapComponent.cs @@ -1,9 +1,7 @@ using System.Collections.Generic; using System.Linq; -using Content.Shared.ActionBlocker; using Content.Shared.Acts; using Content.Shared.Alert; -using Content.Shared.Buckle; using Content.Shared.Buckle.Components; using Content.Shared.DragDrop; using Content.Shared.Interaction; @@ -12,7 +10,6 @@ using Robust.Server.GameObjects; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Maths; -using Robust.Shared.Players; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -67,7 +64,7 @@ namespace Content.Server.Buckle.Components /// Don't change it unless you really have to /// [DataField("maxBuckleDistance", required: false)] - public float MaxBuckleDistance = 1f; + public float MaxBuckleDistance = 0.1f; /// /// You can specify the offset the entity will have after unbuckling. diff --git a/Content.Server/Buckle/Systems/BuckleSystem.cs b/Content.Server/Buckle/Systems/BuckleSystem.cs index 8ec67713a6..7586047fb3 100644 --- a/Content.Server/Buckle/Systems/BuckleSystem.cs +++ b/Content.Server/Buckle/Systems/BuckleSystem.cs @@ -64,14 +64,6 @@ namespace Content.Server.Buckle.Systems args.Handled = component.TryUnbuckle(args.User); } - public override void Update(float frameTime) - { - foreach (var (buckle, physics) in EntityManager.EntityQuery()) - { - buckle.Update(physics); - } - } - private void MoveEvent(EntityUid uid, BuckleComponent buckle, ref MoveEvent ev) { var strap = buckle.BuckledTo; diff --git a/Content.Shared/Buckle/Components/SharedBuckleComponent.cs b/Content.Shared/Buckle/Components/SharedBuckleComponent.cs index 9491e24254..724ae4581f 100644 --- a/Content.Shared/Buckle/Components/SharedBuckleComponent.cs +++ b/Content.Shared/Buckle/Components/SharedBuckleComponent.cs @@ -29,8 +29,6 @@ namespace Content.Shared.Buckle.Components public EntityUid? LastEntityBuckledTo { get; set; } - public bool IsOnStrapEntityThisFrame { get; set; } - public bool DontCollide { get; set; } public abstract bool TryBuckle(EntityUid user, EntityUid to); diff --git a/Content.Shared/Buckle/SharedBuckleSystem.cs b/Content.Shared/Buckle/SharedBuckleSystem.cs index 5bc94119b0..7e76ee96b4 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.cs @@ -59,7 +59,6 @@ namespace Content.Shared.Buckle { if (args.BodyB.Owner != component.LastEntityBuckledTo) return; - component.IsOnStrapEntityThisFrame = true; if (component.Buckled || component.DontCollide) { args.Cancel();