@@ -89,8 +89,15 @@ function Update(self)
89
89
local mode = self .parentGun :GetNumberValue (" GrappleMode" );
90
90
91
91
if mode ~= 0 then
92
- self .pieSelection = mode ;
93
- self .parentGun :RemoveNumberValue (" GrappleMode" );
92
+ if mode == 3 then -- Unhook via Pie Menu
93
+ self .ToDelete = true ;
94
+ if self .parentGun then -- Corrected 'sif' to 'if'
95
+ self .parentGun :RemoveNumberValue (" GrappleMode" );
96
+ end
97
+ else
98
+ self .pieSelection = mode ;
99
+ self .parentGun :RemoveNumberValue (" GrappleMode" );
100
+ end
94
101
end
95
102
96
103
if self .parentGun .FiredFrame then
@@ -114,7 +121,10 @@ function Update(self)
114
121
if (self .parentGun and self .parentGun .ID ~= rte .NoMOID ) and (self .parentGun :GetRootParent ().ID == self .parent .ID ) then
115
122
if self .parent :IsPlayerControlled () then
116
123
if controller :IsState (Controller .WEAPON_RELOAD ) then
117
- self .ToDelete = true ;
124
+ -- Only unhook with R if holding the Grapple Gun
125
+ if self .parent .EquippedItem and self .parentGun and self .parent .EquippedItem .ID == self .parentGun .ID then
126
+ self .ToDelete = true ;
127
+ end
118
128
end
119
129
if self .parentGun .Magazine then
120
130
self .parentGun .Magazine .RoundCount = 0 ;
@@ -434,18 +444,30 @@ function Update(self)
434
444
435
445
-- Double tapping crouch retrieves the hook
436
446
if controller and controller :IsState (Controller .BODY_PRONE ) then
437
- self .pieSelection = 0 ;
438
- if self .canTap == true then
439
- controller :SetState (Controller .BODY_PRONE , false );
440
- self .climb = 0 ;
441
- if self .parentGun ~= nil and self .parentGun .ID ~= rte .NoMOID then
442
- self .parentGun :RemoveNumberValue (" GrappleMode" );
443
- end
447
+ -- Check if the player is currently holding the grappling gun
448
+ local isHoldingGrappleGun = false ;
449
+ if self .parent and self .parent .EquippedItem and self .parentGun and self .parent .EquippedItem .ID == self .parentGun .ID then
450
+ isHoldingGrappleGun = true ;
451
+ end
444
452
445
- self .tapTimer :Reset ();
446
- self .didTap = true ;
447
- self .canTap = false ;
448
- self .tapCounter = self .tapCounter + 1 ;
453
+ if not isHoldingGrappleGun then -- Only process tap for unhook if NOT holding grapple gun
454
+ self .pieSelection = 0 ;
455
+ if self .canTap == true then
456
+ controller :SetState (Controller .BODY_PRONE , false );
457
+ self .climb = 0 ;
458
+ if self .parentGun ~= nil and self .parentGun .ID ~= rte .NoMOID then
459
+ self .parentGun :RemoveNumberValue (" GrappleMode" );
460
+ end
461
+
462
+ self .tapTimer :Reset ();
463
+ self .didTap = true ;
464
+ self .canTap = false ;
465
+ self .tapCounter = self .tapCounter + 1 ;
466
+ end
467
+ else
468
+ -- If holding the gun, crouch might be for manual rope control.
469
+ -- Ensure canTap is true so that normal crouch isn't blocked by this tap logic.
470
+ self .canTap = true ;
449
471
end
450
472
else
451
473
self .canTap = true ;
@@ -455,7 +477,16 @@ function Update(self)
455
477
self .tapCounter = 0 ;
456
478
else
457
479
if self .tapCounter >= self .tapAmount then
458
- self .ToDelete = true ;
480
+ local isHoldingGrappleGun = false ;
481
+ if self .parent and self .parent .EquippedItem and self .parentGun and self .parent .EquippedItem .ID == self .parentGun .ID then
482
+ isHoldingGrappleGun = true ;
483
+ end
484
+
485
+ if not isHoldingGrappleGun then -- Only unhook via double tap if NOT holding grapple gun
486
+ self .ToDelete = true ;
487
+ else
488
+ self .tapCounter = 0 ; -- If holding gun, reset counter to prevent unhook
489
+ end
459
490
end
460
491
end
461
492
0 commit comments