Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Update SharedGrapplingGunSystem.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vonsant authored Jun 20, 2024
1 parent 622bcbc commit 2b92edb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +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
public const float ExtendRate = 2.5f; // Rate for extending the grapple
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()
{
Expand All @@ -59,6 +60,7 @@ private void OnGrapplingShot(EntityUid uid, GrapplingGunComponent component, ref
{
if (!HasComp<GrapplingProjectileComponent>(shotUid))
continue;

//todo: this doesn't actually support multigrapple
// At least show the visuals.
component.Projectile = shotUid.Value;
Expand Down Expand Up @@ -186,7 +188,7 @@ public override void Update(float frameTime)
continue;
}

// TODO: This should be on engine.
// 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();
Expand All @@ -199,7 +201,7 @@ public override void Update(float frameTime)
{
distance.MaxLength = MathF.Min(MaxGrappleDistance, distance.MaxLength + ExtendRate * frameTime);
}

// Corvax Frontier end
distance.Length = MathF.Min(distance.MaxLength, distance.Length);

_physics.WakeBody(joint.BodyAUid);
Expand All @@ -226,7 +228,7 @@ private void OnGrappleCollide(EntityUid uid, GrapplingProjectileComponent compon

var jointComp = EnsureComp<JointComponent>(uid);
var joint = _joints.CreateDistanceJoint(uid, args.Weapon, anchorA: new Vector2(0f, 0.5f), id: GrapplingJoint);
joint.MaxLength = MaxGrappleDistance; // Set the initial maximum distance to the defined maximum
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.
Expand Down

0 comments on commit 2b92edb

Please sign in to comment.