@@ -1079,25 +1079,6 @@ local function OnCreateMove(pCmd)
1079
1079
can_attack = false
1080
1080
can_charge = false
1081
1081
1082
- -- ===== Charge Reach State Machine (Demoman only) =====
1083
- if pLocal and pLocal :GetPropInt (" m_iClass" ) == 4 then
1084
- if chargeState == " aim" then
1085
- if chargeAimAngles then
1086
- engine .SetViewAngles (EulerAngles (chargeAimAngles .pitch , chargeAimAngles .yaw , 0 ))
1087
- end
1088
- chargeState = " charge" -- next tick will trigger charge
1089
- elseif chargeState == " charge" then
1090
- pCmd :SetButtons (pCmd :GetButtons () | IN_ATTACK2 )
1091
- chargeState = " idle"
1092
- chargeAimAngles = nil
1093
- end
1094
- else
1095
- -- Not Demoman: never drive charge reach state machine
1096
- chargeState = " idle"
1097
- chargeAimAngles = nil
1098
- end
1099
- -- =====================================
1100
-
1101
1082
-- Get the local player entity
1102
1083
pLocal = entities .GetLocalPlayer ()
1103
1084
if not pLocal or not pLocal :IsAlive () then
@@ -1116,6 +1097,25 @@ local function OnCreateMove(pCmd)
1116
1097
pLocalClass = pLocal :GetPropInt (" m_iClass" )
1117
1098
chargeLeft = pLocal :GetPropFloat (" m_flChargeMeter" )
1118
1099
1100
+ -- ===== Charge Reach State Machine (Demoman only) =====
1101
+ if pLocalClass == 4 then
1102
+ if chargeState == " aim" then
1103
+ if chargeAimAngles then
1104
+ engine .SetViewAngles (EulerAngles (chargeAimAngles .pitch , chargeAimAngles .yaw , 0 ))
1105
+ end
1106
+ chargeState = " charge" -- next tick will trigger charge
1107
+ elseif chargeState == " charge" then
1108
+ pCmd :SetButtons (pCmd :GetButtons () | IN_ATTACK2 )
1109
+ chargeState = " idle"
1110
+ chargeAimAngles = nil
1111
+ end
1112
+ else
1113
+ -- Not Demoman: never drive charge reach state machine
1114
+ chargeState = " idle"
1115
+ chargeAimAngles = nil
1116
+ end
1117
+ -- =====================================
1118
+
1119
1119
-- Show notification if instant attack is enabled but dash key is not bound
1120
1120
if Menu .Misc .InstantAttack and gui .GetValue (" dash move key" ) == 0 and not dashKeyNotBoundNotified then
1121
1121
Notify .Simple (" Instant Attack Warning" , " Dash key is not bound. Instant Attack will not work properly." , 4 )
0 commit comments