Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pred errors related to Entity:EyeAngles #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions lua/autorun/sh_uclip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ end
-- Check if a player is stuck in an object or in the world.
-- Returns true and ent they're stuck on if they're stuck.
function isStuck( ply, filter )
local ang = ply:EyeAngles()
local directions = {
ang:Right(),
ang:Right() * -1,
ang:Forward(),
ang:Forward() * -1,
ang:Up(),
ang:Up() * -1,
Vector(1, 0, 0),
Vector(-1, 0, 0),
Vector(0, 1, 0),
Vector(0, -1, 0),
Vector(0, 0, 1),
Vector(0, 0, -1),
}
local ents = {}

Expand Down Expand Up @@ -86,7 +85,7 @@ end

-- This function allows us to get the player's *attempted* velocity (incase we're overriding their *actual* velocity).
local sv_noclipspeed = GetConVar( "sv_noclipspeed" )
function getNoclipVel( ply )
function getNoclipVel( ply, angs )

local noclipspeed = sv_noclipspeed:GetFloat() * 100

Expand All @@ -109,8 +108,8 @@ function getNoclipVel( ply )

local vel = Vector( 0, 0, 0 )

vel = vel + ( ply:EyeAngles():Forward() * ( forwardnum - backnum ) ) -- Forward and back
vel = vel + ( ply:EyeAngles():Right() * ( rightnum - leftnum ) ) -- Left and right
vel = vel + ( angs:Forward() * ( forwardnum - backnum ) ) -- Forward and back
vel = vel + ( angs:Right() * ( rightnum - leftnum ) ) -- Left and right
vel = vel + ( Vector( 0, 0, 1 ) * jumpnum ) -- Up
vel = vel:GetNormalized()
vel = vel * noclipspeed
Expand Down Expand Up @@ -198,7 +197,7 @@ function move( ply, move )
if adminCheck( ply ) then return end -- They can go through everything..

local ft = FrameTime()
local vel = getNoclipVel( ply ) -- How far are they trying to move this frame?
local vel = getNoclipVel( ply, move:GetAngles() ) -- How far are they trying to move this frame?

override_velocity = vel

Expand Down