Skip to content

Commit 7487003

Browse files
Add files via upload
1 parent 371d0e1 commit 7487003

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

A_Swing_Prediction.lua

+8-18
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,9 @@ local function CalcStrafe()
266266
-- Save the average delta
267267
avgDeltas[entityIndex] = avgDelta
268268

269-
-- Create two vectors adjusted by their past and current average delta in the yaw direction at a distance of 12 units
270-
local vector1 = Vector3(math.cos(math.rad(lastDeltas[entityIndex] or delta)) * 12, math.sin(math.rad(lastDeltas[entityIndex] or delta)) * 12, 0)
271-
local vector2 = Vector3(math.cos(math.rad(avgDelta)) * 12, math.sin(math.rad(avgDelta)) * 12, 0)
272-
269+
local vector1 = Vector3(1, 0, 0)
270+
local vector2 = Vector3(1, 0, 0)
271+
273272
-- Apply deviation
274273
local ang1 = vector1:Angles()
275274
ang1.y = ang1.y + (lastDeltas[entityIndex] or delta)
@@ -502,8 +501,8 @@ end
502501
local inaccuracyValue = inaccuracy[vPlayer:GetIndex()]
503502
if not inaccuracyValue then return nil end
504503

505-
local hitbox_min_trigger = Vector3(drawVhitbox[1].x + inaccuracyValue, drawVhitbox[1].y + inaccuracyValue, drawVhitbox[1].z)
506-
local hitbox_max_trigger = Vector3(drawVhitbox[2].x - inaccuracyValue, drawVhitbox[2].y - inaccuracyValue, drawVhitbox[2].z)
504+
local hitbox_min_trigger = drawVhitbox[1]
505+
local hitbox_max_trigger = drawVhitbox[2]
507506

508507
-- Calculate the closest point on the hitbox to the sphere
509508
local closestPoint = Vector3(
@@ -514,25 +513,13 @@ end
514513

515514
-- Calculate the vector from the closest point to the sphere center
516515
local distanceAlongVector = (spherePos - closestPoint):Length()
517-
if isAdvanced then
518-
local atackPos = Normalize(spherePos - closestPoint) * sphereRadius
519-
520516
-- Compare the distance along the vector to the sum of the radius
521517
if sphereRadius > distanceAlongVector then
522518
return true, closestPoint
523519
else
524520
-- Not InRange
525521
return false, nil
526522
end
527-
else
528-
-- Compare the distance along the vector to the sum of the radius
529-
if sphereRadius > distanceAlongVector then
530-
return true, closestPoint
531-
else
532-
-- Not InRange
533-
return false, nil
534-
end
535-
end
536523
end
537524

538525

@@ -775,6 +762,9 @@ end
775762
stepSize = pLocal:GetPropFloat("localdata", "m_flStepSize")
776763

777764
CalcStrafe()
765+
if inaccuracyValue then
766+
swingrange = swingrange - inaccuracyValue
767+
end
778768

779769
-- Local player prediction
780770
if pLocal:EstimateAbsVelocity() == 0 then

0 commit comments

Comments
 (0)