CatStation/Content.Client/Weapons/Misc/GrapplingGunSystem.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

48 lines
1.5 KiB
C#

using System.Net;
using Content.Client.Hands.Systems;
using Content.Shared.CombatMode;
using Content.Shared.Weapons.Misc;
using Content.Shared.Weapons.Ranged.Components;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.Input;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Dynamics.Joints;
namespace Content.Client.Weapons.Misc;
public sealed partial class GrapplingGunSystem : SharedGrapplingGunSystem
{
[Dependency] private HandsSystem _hands = default!;
[Dependency] private InputSystem _input = default!;
[Dependency] private IPlayerManager _player = default!;
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;
var local = _player.LocalEntity;
var handUid = _hands.GetActiveHandEntity();
if (!TryComp<GrapplingGunComponent>(handUid, out var grappling))
return;
var reelKey = _input.CmdStates.GetState(EngineKeyFunctions.UseSecondary) == BoundKeyState.Down;
if (!TryComp<CombatModeComponent>(local, out var combatMode) ||
!combatMode.IsInCombatMode)
{
reelKey = false;
}
if (grappling.Reeling == reelKey)
return;
RaisePredictiveEvent(new RequestGrapplingReelMessage(reelKey));
}
}