@@ -2,7 +2,6 @@ function Create(self)
2
2
self .updateTimer = Timer ();
3
3
4
4
self .lungeTapDelay = 200 ;
5
- self .frontFlip = {input = {Controller .BODY_JUMP , Controller .BODY_CROUCH }, inputCounter = 0 };
6
5
self .lungePower = 6 ;
7
6
self .tapTimer = Timer ();
8
7
@@ -13,6 +12,8 @@ function Create(self)
13
12
self :SetNumberValue (" Identity" , self .face );
14
13
-- Add a ponytail if we are Lara
15
14
if self .face == 2 then
15
+ self .DeathSound .Pitch = 1.2 ;
16
+ self .PainSound .Pitch = 1.2 ;
16
17
self .Head :AddAttachable (CreateAttachable (" Ronin Brunette Ponytail" ));
17
18
end
18
19
else
@@ -21,8 +22,11 @@ function Create(self)
21
22
self .Head .Frame = self .face ;
22
23
end
23
24
end
25
+ self .analogSpin = 0 ;
26
+ self .lastAnalogAngle = self :GetController ().AnalogMove .AbsRadAngle ;
24
27
end
25
28
function Update (self )
29
+ self .analogSpin = self .analogSpin * 0.9 ;
26
30
if self .updateTimer :IsPastSimMS (1000 ) then
27
31
self .updateTimer :Reset ();
28
32
self .aggressive = self .Health < self .MaxHealth * 0.5 ;
@@ -34,49 +38,34 @@ function Update(self)
34
38
end
35
39
end
36
40
self .Frame = (self .face == 2 and self .Vel .Y > (SceneMan .GlobalAcc .Y * 0.15 )) and 3 or self .face ;
37
- local crouching = self .controller :IsState (Controller .BODY_CROUCH );
38
41
39
- if self :IsPlayerControlled () and self .Status < Actor .DYING and self .FGLeg and self .BGLeg then
42
+ if self :IsPlayerControlled () and self .Status < Actor .INACTIVE and self .FGLeg and self .BGLeg then
43
+ local crouching = self .controller :IsState (Controller .BODY_CROUCH );
40
44
if self .Status == Actor .UNSTABLE then
41
- if not crouching then
42
- local motion = self .Vel .Magnitude * 0.5 + math.abs (self .AngularVel );
43
- if motion > 1 then
44
- self .AngularVel = self .AngularVel * (1 - 0.1 / motion );
45
- end
46
- if self .tapTimer :IsPastSimMS (500 ) and math.cos (self .RotAngle ) > 0.9 and motion < 20 then
45
+ local motion = (self .Vel .Magnitude * 0.5 + math.abs (self .AngularVel ));
46
+ local stillness = 1 / (1 + motion );
47
+ if crouching then
48
+ self .AngularVel = self .AngularVel * (1 - stillness ) - (self .RotAngle - (self :GetAimAngle (false ) - math.pi * 0.5 ) * self .FlipFactor ) * 2 * stillness ;
49
+ end
50
+ elseif crouching then
51
+ if not self .crouchHeld then
52
+ if not self .tapTimer :IsPastSimMS (self .lungeTapDelay ) and SceneMan .Scene .GlobalAcc .Magnitude > 10 then
53
+ Lunge (self , 3 );
54
+ else
47
55
self .tapTimer :Reset ();
48
- self .Status = Actor .STABLE ;
49
- self .AngularVel = self .AngularVel * 0.5 ;
50
- end
56
+ end
57
+ self .controller :SetState (Controller .BODY_CROUCH , false );
51
58
end
52
59
else
53
- -- Track the key combo input (jump -> crouch) to trigger frontflip
54
- if self .controller :IsState (self .frontFlip .input [self .frontFlip .inputCounter + 1 ]) then
55
- if (self .frontFlip .inputCounter == 0 or not self .tapTimer :IsPastSimMS (self .lungeTapDelay )) then
56
- self .frontFlip .inputCounter = self .frontFlip .inputCounter + 1 ;
57
- if self .frontFlip .inputCounter == # self .frontFlip .input then
58
- Lunge (self , 8 );
59
- self .frontFlip .inputCounter = 0 ;
60
- -- AudioMan:PlaySound("Ronin.rte/Actors/Brains/Commander/Sounds/Jump.flac", self.Pos);
61
- end
62
- self .tapTimer :Reset ();
63
- else
64
- self .frontFlip .inputCounter = 0 ;
65
- end
66
- elseif crouching then
67
- if not self .keyHeld then
68
- if not self .tapTimer :IsPastSimMS (self .lungeTapDelay ) and SceneMan .Scene .GlobalAcc .Magnitude > 10 then
69
- Lunge (self , 0 );
70
- else
71
- self .tapTimer :Reset ();
72
- end
73
- end
74
- self .keyHeld = true ;
75
- else
76
- self .keyHeld = false ;
60
+ self .analogSpin = self .analogSpin + math.sin (self .controller .AnalogMove .AbsRadAngle - self .lastAnalogAngle );
61
+ if math.abs (self .analogSpin ) > 2 then
62
+ Lunge (self , 12 );
63
+ self .analogSpin = 0 ;
77
64
end
78
65
end
66
+ self .crouchHeld = crouching ;
79
67
end
68
+ self .lastAnalogAngle = self .controller .AnalogMove .AbsRadAngle ;
80
69
end
81
70
82
71
function Lunge (self , spin )
@@ -87,8 +76,8 @@ function Lunge(self, spin)
87
76
flip = - 1 ;
88
77
end
89
78
-- Different factors that affect the lunge
90
- local vel = (self .Vel . Magnitude ^ 2 ) * 0.0005 + 1 ;
91
- local ang = math.abs (self .AngularVel * 0.05 ) + 1 ;
79
+ local angVel = math.abs (self .AngularVel * 0.1 ) + 1 ;
80
+ local vel = (self .Vel . Magnitude + angVel ) ^ 2 * 0.0005 + 1 ;
92
81
local mass = math.abs (self .Mass * 0.005 ) + 1 ;
93
82
local aimAng = self :GetAimAngle (false );
94
83
local vertical = math.abs (math.cos (aimAng ))/ vel ;
@@ -97,7 +86,7 @@ function Lunge(self, spin)
97
86
local jumpVec = Vector ((self .lungePower + strength / vel ) * flip , - (self .lungePower * 0.5 + (strength * 0.3 )) * vertical ):RadRotate (aimAng * self .FlipFactor );
98
87
99
88
self .Vel = self .Vel + jumpVec / mass ;
100
- self .AngularVel = self .AngularVel - (2 / ang * vertical + spin ) * flip ;
89
+ self .AngularVel = self .AngularVel - (spin / angVel * vertical ) * flip * math.cos ( self . RotAngle ) ;
101
90
self .Status = Actor .UNSTABLE ;
102
91
self .tapTimer :Reset ();
103
92
end
0 commit comments