Skip to content

Commit fccae43

Browse files
fixed stupid bug
1 parent ae4965b commit fccae43

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

A_Swing_Prediction.lua

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,25 +1079,6 @@ local function OnCreateMove(pCmd)
10791079
can_attack = false
10801080
can_charge = false
10811081

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-
11011082
-- Get the local player entity
11021083
pLocal = entities.GetLocalPlayer()
11031084
if not pLocal or not pLocal:IsAlive() then
@@ -1116,6 +1097,25 @@ local function OnCreateMove(pCmd)
11161097
pLocalClass = pLocal:GetPropInt("m_iClass")
11171098
chargeLeft = pLocal:GetPropFloat("m_flChargeMeter")
11181099

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+
11191119
-- Show notification if instant attack is enabled but dash key is not bound
11201120
if Menu.Misc.InstantAttack and gui.GetValue("dash move key") == 0 and not dashKeyNotBoundNotified then
11211121
Notify.Simple("Instant Attack Warning", "Dash key is not bound. Instant Attack will not work properly.", 4)

0 commit comments

Comments
 (0)