From 0bcc91ae985d0b895b4050f67e983715dc28466d Mon Sep 17 00:00:00 2001 From: Vonsant Date: Thu, 20 Jun 2024 12:12:27 +0300 Subject: [PATCH 01/11] =?UTF-8?q?=D0=93=D1=80=D0=B0=D0=BF=D0=BF=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=B3=D0=A5=D1=83=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Weapons/Misc/GrapplingGunSystem.cs | 7 +---- .../Weapons/Misc/SharedGrapplingGunSystem.cs | 29 ++++++++++++------- .../Components/GrapplingGunComponent.cs | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Content.Client/Weapons/Misc/GrapplingGunSystem.cs b/Content.Client/Weapons/Misc/GrapplingGunSystem.cs index df20042b4be..f79e6daf90b 100644 --- a/Content.Client/Weapons/Misc/GrapplingGunSystem.cs +++ b/Content.Client/Weapons/Misc/GrapplingGunSystem.cs @@ -21,8 +21,6 @@ public override void Update(float frameTime) { base.Update(frameTime); - // Oh boy another input handler. - // If someone thinks of a better way to unify this please tell me. if (!Timing.IsFirstTimePredicted) return; @@ -39,9 +37,6 @@ public override void Update(float frameTime) return; } - if (distance.MaxLength <= distance.MinLength) - return; - var reelKey = _input.CmdStates.GetState(EngineKeyFunctions.UseSecondary) == BoundKeyState.Down; if (!TryComp(local, out var combatMode) || @@ -55,4 +50,4 @@ public override void Update(float frameTime) RaisePredictiveEvent(new RequestGrapplingReelMessage(reelKey)); } -} +} \ No newline at end of file diff --git a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs index 41e1895da2c..2c88fd5a346 100644 --- a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs @@ -30,8 +30,9 @@ 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 = 10.0f; // Maximum distance for the grappling hook + public const float ExtendRate = 2.5f; // Rate for extending the grapple public override void Initialize() { @@ -59,8 +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; Dirty(uid, component); var visuals = EnsureComp(shotUid.Value); @@ -132,7 +131,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; } @@ -171,7 +170,6 @@ public override void Update(float frameTime) { if (Timing.IsFirstTimePredicted) { - // Just in case. grappling.Stream = _audio.Stop(grappling.Stream); } @@ -186,8 +184,19 @@ public override void Update(float frameTime) continue; } - // TODO: This should be on engine. - distance.MaxLength = MathF.Max(distance.MinLength, distance.MaxLength - ReelRate * frameTime); + 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); + } + distance.Length = MathF.Min(distance.MaxLength, distance.Length); _physics.WakeBody(joint.BodyAUid); @@ -214,11 +223,9 @@ 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 joint.Stiffness = 1f; joint.MinLength = 0.35f; - // Setting velocity directly for mob movement fucks this so need to make them aware of it. - // joint.Breakpoint = 4000f; Dirty(uid, jointComp); } @@ -232,4 +239,4 @@ public RequestGrapplingReelMessage(bool reeling) Reeling = reeling; } } -} +} \ No newline at end of file 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 From 778c35a0b42adb20b6bcded6649c48c6713cca12 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Thu, 20 Jun 2024 12:14:29 +0300 Subject: [PATCH 02/11] Update GrapplingGunSystem.cs --- Content.Client/Weapons/Misc/GrapplingGunSystem.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Content.Client/Weapons/Misc/GrapplingGunSystem.cs b/Content.Client/Weapons/Misc/GrapplingGunSystem.cs index f79e6daf90b..1317e069b58 100644 --- a/Content.Client/Weapons/Misc/GrapplingGunSystem.cs +++ b/Content.Client/Weapons/Misc/GrapplingGunSystem.cs @@ -21,6 +21,8 @@ public override void Update(float frameTime) { base.Update(frameTime); + // Oh boy another input handler. + // If someone thinks of a better way to unify this please tell me. if (!Timing.IsFirstTimePredicted) return; @@ -50,4 +52,4 @@ public override void Update(float frameTime) RaisePredictiveEvent(new RequestGrapplingReelMessage(reelKey)); } -} \ No newline at end of file +} From 3d03e1181437c6236105898f9e1a95c4274f1108 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Thu, 20 Jun 2024 12:16:34 +0300 Subject: [PATCH 03/11] Update SharedGrapplingGunSystem.cs --- Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs index 2c88fd5a346..3e5c90e559a 100644 --- a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs @@ -59,7 +59,8 @@ 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; Dirty(uid, component); var visuals = EnsureComp(shotUid.Value); @@ -239,4 +240,4 @@ public RequestGrapplingReelMessage(bool reeling) Reeling = reeling; } } -} \ No newline at end of file +} From 0b6c11c111e814ae70bdfc5bd0d7a38879e203b0 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Thu, 20 Jun 2024 12:17:49 +0300 Subject: [PATCH 04/11] Update SharedGrapplingGunSystem.cs --- Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs index 3e5c90e559a..9f0ec54acac 100644 --- a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs @@ -171,6 +171,7 @@ public override void Update(float frameTime) { if (Timing.IsFirstTimePredicted) { + // Just in case. grappling.Stream = _audio.Stop(grappling.Stream); } @@ -185,6 +186,7 @@ public override void Update(float frameTime) continue; } + // TODO: This should be on engine. 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(); @@ -216,6 +218,8 @@ public override void Update(float frameTime) } } } + // Setting velocity directly for mob movement fucks this so need to make them aware of it. + // joint.Breakpoint = 4000f; private void OnGrappleCollide(EntityUid uid, GrapplingProjectileComponent component, ref ProjectileEmbedEvent args) { From 701ef49dd5419b89825f57acdc179d1aaf50d014 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Thu, 20 Jun 2024 12:18:41 +0300 Subject: [PATCH 05/11] Update SharedGrapplingGunSystem.cs --- Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs index 9f0ec54acac..46c1689ed7c 100644 --- a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs @@ -218,8 +218,6 @@ public override void Update(float frameTime) } } } - // Setting velocity directly for mob movement fucks this so need to make them aware of it. - // joint.Breakpoint = 4000f; private void OnGrappleCollide(EntityUid uid, GrapplingProjectileComponent component, ref ProjectileEmbedEvent args) { @@ -231,6 +229,8 @@ private void OnGrappleCollide(EntityUid uid, GrapplingProjectileComponent compon joint.MaxLength = MaxGrappleDistance; // Set the initial maximum distance to the defined maximum joint.Stiffness = 1f; joint.MinLength = 0.35f; + // Setting velocity directly for mob movement fucks this so need to make them aware of it. + // joint.Breakpoint = 4000f; Dirty(uid, jointComp); } From fb8e0c08d57a5c7234c27c07193879fd21fb5a12 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Thu, 20 Jun 2024 12:19:39 +0300 Subject: [PATCH 06/11] Update SharedGrapplingGunSystem.cs --- Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs index 46c1689ed7c..63097682567 100644 --- a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs @@ -31,7 +31,7 @@ public abstract class SharedGrapplingGunSystem : EntitySystem public const string GrapplingJoint = "grappling"; public const float ReelRate = 2.5f; - public const float MaxGrappleDistance = 10.0f; // Maximum distance for the grappling hook + public const float MaxGrappleDistance = 20.0f; // Maximum distance for the grappling hook public const float ExtendRate = 2.5f; // Rate for extending the grapple public override void Initialize() From 622bcbc7c4fe6fa7100ebb5a050184c7fdeba755 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Thu, 20 Jun 2024 12:22:27 +0300 Subject: [PATCH 07/11] Update GrapplingGunSystem.cs --- Content.Client/Weapons/Misc/GrapplingGunSystem.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Content.Client/Weapons/Misc/GrapplingGunSystem.cs b/Content.Client/Weapons/Misc/GrapplingGunSystem.cs index 1317e069b58..020fec5b5db 100644 --- a/Content.Client/Weapons/Misc/GrapplingGunSystem.cs +++ b/Content.Client/Weapons/Misc/GrapplingGunSystem.cs @@ -38,7 +38,10 @@ public override void Update(float frameTime) { 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) || From 2b92edbb444d15bdec92f09d6a6240857dd1305d Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Thu, 20 Jun 2024 12:25:12 +0300 Subject: [PATCH 08/11] Update SharedGrapplingGunSystem.cs --- .../Weapons/Misc/SharedGrapplingGunSystem.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs index 63097682567..20fcf44e1bb 100644 --- a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs @@ -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() { @@ -59,6 +60,7 @@ 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; @@ -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(); @@ -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); @@ -226,7 +228,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 = 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. From 7c4c8669652f8176738d44b0be6b528d65197ae5 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Thu, 20 Jun 2024 12:26:01 +0300 Subject: [PATCH 09/11] Update SharedGrapplingGunSystem.cs --- Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs index 20fcf44e1bb..805c00ed0e6 100644 --- a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs @@ -60,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; From ca3d990bfaf2e764c1d975fa2380efe62d42e2b9 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Thu, 20 Jun 2024 12:31:54 +0300 Subject: [PATCH 10/11] Update projectiles.yml --- .../Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 7cea250157ec16f01947dfc4be42100c4dcc5509 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Thu, 20 Jun 2024 12:37:15 +0300 Subject: [PATCH 11/11] Update GrapplingGunSystem.cs --- Content.Client/Weapons/Misc/GrapplingGunSystem.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Content.Client/Weapons/Misc/GrapplingGunSystem.cs b/Content.Client/Weapons/Misc/GrapplingGunSystem.cs index 020fec5b5db..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; } -/* Corvax Frontier start - if (distance.MaxLength <= distance.MinLength) - return; -*/ Corvax Frontier end +// 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) ||