Skip to content

Commit ae4965b

Browse files
Add files via upload
1 parent ab9e385 commit ae4965b

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

A_Swing_Prediction.lua

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

1082-
-- ===== Charge Reach State Machine =====
1083-
if chargeState == "aim" then
1084-
if chargeAimAngles then
1085-
engine.SetViewAngles(EulerAngles(chargeAimAngles.pitch, chargeAimAngles.yaw, 0))
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
10861093
end
1087-
chargeState = "charge" -- next tick will trigger charge
1088-
elseif chargeState == "charge" then
1089-
pCmd:SetButtons(pCmd:GetButtons() | IN_ATTACK2)
1094+
else
1095+
-- Not Demoman: never drive charge reach state machine
10901096
chargeState = "idle"
10911097
chargeAimAngles = nil
10921098
end
@@ -1462,7 +1468,8 @@ local function OnCreateMove(pCmd)
14621468
aim_angles = aimpos
14631469
end
14641470

1465-
if Menu.Aimbot.ChargeBot and pLocal:InCond(17) and not can_attack then
1471+
-- Charge-bot steering only relevant to Demoman shield charge (class 4)
1472+
if Menu.Aimbot.ChargeBot and pLocalClass == 4 and pLocal:InCond(17) and not can_attack then
14661473
local trace = engine.TraceHull(pLocalOrigin, inRangePoint or vPlayerFuture, vHitbox[1], vHitbox[2],
14671474
MASK_PLAYERSOLID_BRUSHONLY)
14681475
if trace.fraction == 1 or trace.entity == CurrentTarget then
@@ -1477,7 +1484,7 @@ local function OnCreateMove(pCmd)
14771484
local limitedYaw = currentAng.yaw + Clamp(yawDiff, -MAX_CHARGE_BOT_TURN, MAX_CHARGE_BOT_TURN)
14781485
engine.SetViewAngles(EulerAngles(currentAng.pitch, limitedYaw, 0))
14791486
end
1480-
elseif Menu.Aimbot.ChargeBot and chargeLeft == 100 and input.IsButtonDown(MOUSE_RIGHT) and not can_attack and fDistance < 750 then
1487+
elseif Menu.Aimbot.ChargeBot and pLocalClass == 4 and chargeLeft == 100 and input.IsButtonDown(MOUSE_RIGHT) and not can_attack and fDistance < 750 then
14811488
local trace = engine.TraceHull(pLocalFuture, inRangePoint or vPlayerFuture, vHitbox[1], vHitbox[2],
14821489
MASK_PLAYERSOLID_BRUSHONLY)
14831490
if trace.fraction == 1 or trace.entity == CurrentTarget then

0 commit comments

Comments
 (0)