From f501bd500c33f5020d7e0cfe29fddef9587a286f Mon Sep 17 00:00:00 2001 From: Roudenn <149893554+Roudenn@users.noreply.github.com> Date: Tue, 30 Jul 2024 17:26:18 +0300 Subject: [PATCH] Grappling gun's ReelRate can be changed (#30493) * Grappling gun ReelRate can be changed Moves ReelRate constant from SharedGrapplingGunSystem to GrapplingGunComponent, so it's Reel speed can be changed. * Add coment + remove redudant --- Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs | 4 +--- .../Weapons/Ranged/Components/GrapplingGunComponent.cs | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs index 6feffffbe3..75d5300fdb 100644 --- a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs @@ -31,8 +31,6 @@ public abstract class SharedGrapplingGunSystem : EntitySystem public const string GrapplingJoint = "grappling"; - public const float ReelRate = 2.5f; - public override void Initialize() { base.Initialize(); @@ -187,7 +185,7 @@ public abstract class SharedGrapplingGunSystem : EntitySystem } // TODO: This should be on engine. - distance.MaxLength = MathF.Max(distance.MinLength, distance.MaxLength - ReelRate * frameTime); + distance.MaxLength = MathF.Max(distance.MinLength, distance.MaxLength - grappling.ReelRate * frameTime); distance.Length = MathF.Min(distance.MaxLength, distance.Length); _physics.WakeBody(joint.BodyAUid); diff --git a/Content.Shared/Weapons/Ranged/Components/GrapplingGunComponent.cs b/Content.Shared/Weapons/Ranged/Components/GrapplingGunComponent.cs index d0af3e8b36..553f0c10f3 100644 --- a/Content.Shared/Weapons/Ranged/Components/GrapplingGunComponent.cs +++ b/Content.Shared/Weapons/Ranged/Components/GrapplingGunComponent.cs @@ -8,6 +8,12 @@ namespace Content.Shared.Weapons.Ranged.Components; [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] public sealed partial class GrapplingGunComponent : Component { + /// + /// Hook's reeling force and speed - the higher the number, the faster the hook rewinds. + /// + [DataField, AutoNetworkedField] + public float ReelRate = 2.5f; + [DataField("jointId"), AutoNetworkedField] public string Joint = string.Empty; -- 2.52.0