diff --git a/Content.Client/Weapons/Misc/GrapplingGunSystem.cs b/Content.Client/Weapons/Misc/GrapplingGunSystem.cs index df20042b4be..ee75364db3a 100644 --- a/Content.Client/Weapons/Misc/GrapplingGunSystem.cs +++ b/Content.Client/Weapons/Misc/GrapplingGunSystem.cs @@ -38,10 +38,10 @@ public override void Update(float frameTime) { return; } - - if (distance.MaxLength <= distance.MinLength) - return; - +// Corvax Frontier start +// if (distance.MaxLength <= distance.MinLength) +// return; +// Corvax Frontier end var reelKey = _input.CmdStates.GetState(EngineKeyFunctions.UseSecondary) == BoundKeyState.Down; if (!TryComp(local, out var combatMode) || diff --git a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs index 41e1895da2c..805c00ed0e6 100644 --- a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs @@ -30,8 +30,10 @@ public abstract class SharedGrapplingGunSystem : EntitySystem [Dependency] private readonly SharedPhysicsSystem _physics = default!; public const string GrapplingJoint = "grappling"; - + public const float ReelRate = 2.5f; + public const float MaxGrappleDistance = 20.0f; // Maximum distance for the grappling hook - Corvax Frontier + public const float ExtendRate = 2.5f; // Rate for extending the grapple - Corvax Frontier public override void Initialize() { @@ -58,7 +60,6 @@ private void OnGrapplingShot(EntityUid uid, GrapplingGunComponent component, ref { if (!HasComp(shotUid)) continue; - //todo: this doesn't actually support multigrapple // At least show the visuals. component.Projectile = shotUid.Value; @@ -132,7 +133,7 @@ private void OnGunActivate(EntityUid uid, GrapplingGunComponent component, Activ component.Projectile = null; SetReeling(uid, component, false, args.User); - _gun.ChangeBasicEntityAmmoCount(uid, 1); + _gun.ChangeBasicEntityAmmoCount(uid, 1); args.Handled = true; } @@ -186,8 +187,20 @@ public override void Update(float frameTime) continue; } - // TODO: This should be on engine. - distance.MaxLength = MathF.Max(distance.MinLength, distance.MaxLength - ReelRate * frameTime); + // Corvax Frontier start + var localTransform = Transform(uid); // Use the transform of the entity holding the grappling gun + var hookTransform = Transform(joint.BodyBUid); + var distanceBetween = (localTransform.Coordinates.Position - hookTransform.Coordinates.Position).Length(); + + if (grappling.Reeling) + { + distance.MaxLength = MathF.Max(distance.MinLength, distance.MaxLength - ReelRate * frameTime); + } + else + { + distance.MaxLength = MathF.Min(MaxGrappleDistance, distance.MaxLength + ExtendRate * frameTime); + } + // Corvax Frontier end distance.Length = MathF.Min(distance.MaxLength, distance.Length); _physics.WakeBody(joint.BodyAUid); @@ -214,7 +227,7 @@ private void OnGrappleCollide(EntityUid uid, GrapplingProjectileComponent compon var jointComp = EnsureComp(uid); var joint = _joints.CreateDistanceJoint(uid, args.Weapon, anchorA: new Vector2(0f, 0.5f), id: GrapplingJoint); - joint.MaxLength = joint.Length + 0.2f; + joint.MaxLength = MaxGrappleDistance; // Set the initial maximum distance to the defined maximum - Corvax Frontier joint.Stiffness = 1f; joint.MinLength = 0.35f; // Setting velocity directly for mob movement fucks this so need to make them aware of it. diff --git a/Content.Shared/Weapons/Ranged/Components/GrapplingGunComponent.cs b/Content.Shared/Weapons/Ranged/Components/GrapplingGunComponent.cs index d0af3e8b36d..15f66d4c076 100644 --- a/Content.Shared/Weapons/Ranged/Components/GrapplingGunComponent.cs +++ b/Content.Shared/Weapons/Ranged/Components/GrapplingGunComponent.cs @@ -31,4 +31,4 @@ public sealed partial class GrapplingGunComponent : Component new SpriteSpecifier.Rsi(new ResPath("Objects/Weapons/Guns/Launchers/grappling_gun.rsi"), "rope"); public EntityUid? Stream; -} +} \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml index bc8a1b7360b..02e48721fa1 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml @@ -920,7 +920,7 @@ hard: false mask: - Impassable - - HighImpassable + - BulletImpassable # was HighImpassable - type: GrapplingProjectile # Frontier projectiles