]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Grappling gun's ReelRate can be changed (#30493)
authorRoudenn <149893554+Roudenn@users.noreply.github.com>
Tue, 30 Jul 2024 14:26:18 +0000 (17:26 +0300)
committerGitHub <noreply@github.com>
Tue, 30 Jul 2024 14:26:18 +0000 (00:26 +1000)
* 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
Content.Shared/Weapons/Ranged/Components/GrapplingGunComponent.cs

index 6feffffbe3181ae44f0ad3d850ba6c3d8d3ef351..75d5300fdb1bcea24fc5f43f88ac9051620241ff 100644 (file)
@@ -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);
index d0af3e8b36d6e084fc025f49e472c82f6bab6049..553f0c10f3216176ff435ce76f1b66caeeb2deac 100644 (file)
@@ -8,6 +8,12 @@ namespace Content.Shared.Weapons.Ranged.Components;
 [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
 public sealed partial class GrapplingGunComponent : Component
 {
+    /// <summary>
+    /// Hook's reeling force and speed - the higher the number, the faster the hook rewinds.
+    /// </summary>
+    [DataField, AutoNetworkedField]
+    public float ReelRate = 2.5f;
+
     [DataField("jointId"), AutoNetworkedField]
     public string Joint = string.Empty;