Merge branch 'master' into sitHolder

This commit is contained in:
Xerasin 2021-08-28 19:08:13 -07:00
commit a3c66bddea
2 changed files with 5 additions and 7 deletions

View File

@ -98,6 +98,7 @@ end
local currSit
concommand.Add("+sit", function(ply, cmd, args)
if currSit then return end
if not IsValid(ply) or not ply.GetEyeTrace then return end
currSit = DoSit(ply:GetEyeTrace())
end)

View File

@ -397,7 +397,8 @@ function META.Sit(ply, EyeTrace, ang, parent, parentbone, func, exit, wantedAng)
if math.abs(surfaceAng.pitch) <= 15 then
ang = Angle()
local dists, distsang, ang_smallest_hori, smallest_hori = SitAnywhere.GetAreaProfile(EyeTrace.HitPos, 24, false)
local sampleResolution = 24
local dists, distsang, ang_smallest_hori, smallest_hori = SitAnywhere.GetAreaProfile(EyeTrace.HitPos, sampleResolution, false)
local infront = ((ang_smallest_hori or 0) + 180) % 360
@ -432,18 +433,14 @@ function META.Sit(ply, EyeTrace, ang, parent, parentbone, func, exit, wantedAng)
local trace = dists[I]
local behind = distsang[(trace.ang + 180) % 360]
if behind.Distance2 > 3 then
local cost = 0
if math.abs(eyeang.yaw - trace.ang) > 6 then
cost = cost + 30
end
local tbl = {
cost = cost,
cost = math.abs(eyeang.yaw - trace.ang),
ang = trace.ang,
}
table.insert(wants, tbl)
end
end
table.sort(wants,function(a,b) return b.cost > a.cost end)
if #wants == 0 then return end
ang.yaw = (wants[1].ang - 90)