@@ -8,70 +8,77 @@ function Create(self)
8
8
self .tapTime = 200 ;
9
9
self .tapAmount = 2 ;
10
10
self .guide = false ;
11
+
12
+ self .arrow = CreateMOSRotating (" Grapple Gun Guide Arrow" );
11
13
end
12
14
13
15
function Update (self )
14
- local actor = MovableMan :GetMOFromID (self .RootID );
15
- if actor and IsActor (actor ) then
16
- self .parent = ToActor (actor );
17
- local ctrl = self .parent :GetController ();
18
- if self .parent :IsPlayerControlled () and self .parent .Status < 2 then
19
- local mouse = ctrl :IsMouseControlled ();
16
+ local parent = self :GetRootParent ();
17
+ if parent and IsActor (parent ) then
18
+ if IsAHuman (parent ) then
19
+ parent = ToAHuman (parent )
20
+ elseif IsACrab (parent ) then
21
+ parent = ToACrab (parent );
22
+ else
23
+ parent = ToActor (parent );
24
+ end
25
+ if parent :IsPlayerControlled () and parent .Status < Actor .DYING then
26
+ local controller = parent :GetController ();
27
+ local mouse = controller :IsMouseControlled ();
20
28
-- Deactivate when equipped in BG arm to allow FG arm shooting
21
- if IsAHuman ( self . parent ) and ToAHuman ( self . parent ). EquippedBGItem then
22
- local itemBG = ToAHuman ( self . parent ) .EquippedBGItem ;
29
+ if parent . EquippedBGItem and parent . EquippedItem then
30
+ local itemBG = parent .EquippedBGItem ;
23
31
if itemBG .ID == self .ID then
24
32
self :Deactivate ();
25
33
end
26
34
end
27
- -- Alternatively you can tap Jump twice to grapple
28
- if ctrl :IsState (Controller .BODY_JUMPSTART ) then
29
- if self .tapTimerJump :IsPastSimMS (self .tapTime ) then
30
- self .tapTimerJump :Reset ();
31
- else
32
- self :Activate ();
35
+ if self .Magazine then
36
+ -- Double tapping crouch retrieves the hook
37
+ if self .Magazine .Scale == 1 then
38
+ if controller and controller :IsState (Controller .BODY_CROUCH ) then
39
+ if self .canTap then
40
+ controller :SetState (Controller .BODY_CROUCH , false );
41
+ self .tapTimerJump :Reset ();
42
+ self .didTap = true ;
43
+ self .canTap = false ;
44
+ self .tapCounter = self .tapCounter + 1 ;
45
+ end
46
+ else
47
+ self .canTap = true ;
48
+ end
49
+ if self .tapTimerJump :IsPastSimMS (self .tapTime ) then
50
+ self .tapCounter = 0 ;
51
+ else
52
+ if self .tapCounter >= self .tapAmount then
53
+ self :Activate ();
54
+ self .tapCounter = 0 ;
55
+ end
56
+ end
33
57
end
34
- end
35
- -- Tap sharp aim twice to toggle aim guide
36
- if ctrl :IsState (Controller .AIM_SHARP ) then
37
- if mouse then
58
+ -- A guide arrow appears at higher speeds
59
+ if (self .Magazine .Scale == 0 and not controller :IsState (Controller .AIM_SHARP )) or parent .Vel .Magnitude > 6 then
38
60
self .guide = true ;
39
- elseif self .canTap == true then
40
- self .tapTimerAim :Reset ();
41
- self .didTap = true ;
42
- self .canTap = false ;
43
- self .tapCounter = self .tapCounter + 1 ;
44
- end
45
- else
46
- self .canTap = true ;
47
- if mouse then
61
+ else
48
62
self .guide = false ;
49
63
end
50
64
end
51
- if self .tapTimerAim :IsPastSimMS (self .tapTime ) then
52
- self .tapCounter = 0 ;
53
- else
54
- if self .tapCounter >= self .tapAmount then
55
- if self .guide == false then
56
- self .guide = true ;
57
- else
58
- self .guide = false ;
59
- end
60
- end
61
- end
62
- if self .guide == true then
65
+ if self .guide then
63
66
local frame = 0 ;
64
- if self . parent .Vel .Magnitude > 10 then
67
+ if parent .Vel .Magnitude > 12 then
65
68
frame = 1 ;
66
69
end
67
- local startPos = (self .parent .Pos + self .parent .EyePos + self .Pos ) / 3 ;
68
- local arrow = CreateMOSRotating (" Grapple Gun Guide Arrow" );
69
- local guidePos = startPos + Vector (self .parent .AimDistance + (self .parent .Vel .Magnitude ), 0 ):RadRotate (self .parent :GetAimAngle (true ));
70
- FrameMan :DrawBitmapPrimitive (self .parent .Team , guidePos , arrow , self .parent :GetAimAngle (true ), frame );
70
+ local startPos = (parent .Pos + parent .EyePos + self .Pos ) / 3 ;
71
+ local guidePos = startPos + Vector (parent .AimDistance + (parent .Vel .Magnitude ), 0 ):RadRotate (parent :GetAimAngle (true ));
72
+ FrameMan :DrawBitmapPrimitive (ActivityMan :GetActivity ():ScreenOfPlayer (controller .Player ), guidePos , self .arrow , parent :GetAimAngle (true ), frame );
71
73
end
72
74
else
73
75
self :Deactivate ();
74
- ctrl :SetState (Controller .AIM_SHARP , false );
76
+ end
77
+ self .StanceOffset = Vector (ToMOSprite (self :GetParent ()):GetSpriteWidth (), 1 );
78
+ self .SharpStanceOffset = Vector (ToMOSprite (self :GetParent ()):GetSpriteWidth (), 1 );
79
+ if self .Magazine then
80
+ self .Magazine .Scale = 1 ;
81
+ self .Magazine .Frame = 1 ;
75
82
end
76
83
end
77
84
end
0 commit comments