Add BennyCheck, clean hook names
This commit is contained in:
parent
ed336f6cfd
commit
79ca331ada
|
@ -274,7 +274,7 @@ function bennyfp( origin, angles, fov )
|
||||||
return pos, ang, 90
|
return pos, ang, 90
|
||||||
end
|
end
|
||||||
|
|
||||||
hook.Add( "CalcView", "MyCalcView", function( ply, pos, ang, fov )
|
hook.Add( "CalcView", "Benny_CalcView", function( ply, pos, ang, fov )
|
||||||
if c_unlock:GetBool() then return end
|
if c_unlock:GetBool() then return end
|
||||||
if ply:GetMoveType() == MOVETYPE_NOCLIP then return end
|
if ply:GetMoveType() == MOVETYPE_NOCLIP then return end
|
||||||
decide_active()
|
decide_active()
|
||||||
|
@ -292,8 +292,7 @@ hook.Add( "CalcView", "MyCalcView", function( ply, pos, ang, fov )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- PROTO: Add correct benny weapon check
|
if ply:BennyCheck() then -- and ply:GetActiveWeapon():GetAim() > 0 then
|
||||||
if true or IsValid(ply:GetActiveWeapon()) and ply:GetActiveWeapon():GetAim() > 0 then
|
|
||||||
view.drawviewer = true
|
view.drawviewer = true
|
||||||
view.origin, view.angles, view.fov = bennyfp( view.origin, view.angles, view.fov )
|
view.origin, view.angles, view.fov = bennyfp( view.origin, view.angles, view.fov )
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ local hide = {
|
||||||
["CHudZoom"] = true,
|
["CHudZoom"] = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
hook.Add( "HUDShouldDraw", "HideHUD", function( name )
|
hook.Add( "HUDShouldDraw", "Benny_HUDShouldDraw", function( name )
|
||||||
if ( hide[ name ] ) then return false end
|
if ( hide[ name ] ) then return false end
|
||||||
end )
|
end )
|
||||||
|
|
||||||
|
@ -218,7 +218,10 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
end
|
end
|
||||||
|
|
||||||
do -- Weapon
|
do -- Weapon
|
||||||
assert( IsValid(wep) and wep:GetClass() == "benny", "Failed to retrieve 'benny' weapon!" )
|
if !(IsValid(wep) and wep:GetClass() == "benny") then
|
||||||
|
print( "Failed to retrieve 'benny' weapon!" )
|
||||||
|
return
|
||||||
|
end
|
||||||
local inv = p:INV_Get()
|
local inv = p:INV_Get()
|
||||||
local wep1 = wep:BTable( false )
|
local wep1 = wep:BTable( false )
|
||||||
local wep1c = wep:BClass( false )
|
local wep1c = wep:BClass( false )
|
||||||
|
@ -278,8 +281,8 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
size = ss(2)
|
size = ss(2)
|
||||||
by = by - ss(9-3)
|
by = by - ss(9-3)
|
||||||
elseif count>60 then
|
elseif count>60 then
|
||||||
size = ss(3)
|
size = ss(2)
|
||||||
by = by - ss(7)
|
by = by - ss(6)
|
||||||
elseif count>30 then
|
elseif count>30 then
|
||||||
size = ss(3)
|
size = ss(3)
|
||||||
by = by - ss(5)
|
by = by - ss(5)
|
||||||
|
@ -662,12 +665,13 @@ do
|
||||||
local function Equip()
|
local function Equip()
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
local buckets = ply:INV_Buckets()
|
local buckets = ply:INV_Buckets()
|
||||||
if buckets[bucket_selected][item_selected] then
|
if buckets[bucket_selected] and buckets[bucket_selected][item_selected] then
|
||||||
RunConsoleCommand( "benny_inv_equip", buckets[bucket_selected][item_selected] )
|
RunConsoleCommand( "benny_inv_equip", buckets[bucket_selected][item_selected] )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function Wrap( ply, num )
|
local function Wrap( ply, num )
|
||||||
local buckets = ply:INV_Buckets()
|
local buckets = ply:INV_Buckets()
|
||||||
|
if !buckets[num] then return end
|
||||||
if bucket_selected == num then
|
if bucket_selected == num then
|
||||||
item_selected = item_selected + 1
|
item_selected = item_selected + 1
|
||||||
if item_selected > #buckets[bucket_selected] then
|
if item_selected > #buckets[bucket_selected] then
|
||||||
|
@ -727,22 +731,22 @@ do
|
||||||
Wrap( ply, 5 )
|
Wrap( ply, 5 )
|
||||||
end,
|
end,
|
||||||
["slot6"] = function( ply )
|
["slot6"] = function( ply )
|
||||||
-- Wrap( ply, 6 )
|
Wrap( ply, 6 )
|
||||||
end,
|
end,
|
||||||
["slot7"] = function( ply )
|
["slot7"] = function( ply )
|
||||||
-- Wrap( ply, 7 )
|
Wrap( ply, 7 )
|
||||||
end,
|
end,
|
||||||
["slot8"] = function( ply )
|
["slot8"] = function( ply )
|
||||||
-- Wrap( ply, 8 )
|
Wrap( ply, 8 )
|
||||||
end,
|
end,
|
||||||
["slot9"] = function( ply )
|
["slot9"] = function( ply )
|
||||||
-- Wrap( ply, 9 )
|
Wrap( ply, 9 )
|
||||||
end,
|
end,
|
||||||
["slot0"] = function( ply )
|
["slot0"] = function( ply )
|
||||||
-- Wrap( ply, 0 )
|
Wrap( ply, 0 )
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
hook.Add( "PlayerBindPress", "inv", function( ply, bind, pressed, code )
|
hook.Add( "PlayerBindPress", "Benny_PlayerBindPress", function( ply, bind, pressed, code )
|
||||||
if qt[bind] and pressed then
|
if qt[bind] and pressed then
|
||||||
qt[bind]( ply )
|
qt[bind]( ply )
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -7,7 +7,7 @@ local blop = Angle()
|
||||||
local lastmoveangle = 0
|
local lastmoveangle = 0
|
||||||
local lastmoveangle_lerp
|
local lastmoveangle_lerp
|
||||||
TPSOverride = TPSOverride or Angle()
|
TPSOverride = TPSOverride or Angle()
|
||||||
hook.Add( "CreateMove", "CamFuck", function( cmd )
|
hook.Add( "CreateMove", "Benny_CreateMove", function( cmd )
|
||||||
if false and BENNY_ACTIVECAMERA and LocalPlayer():GetMoveType() != MOVETYPE_NOCLIP then
|
if false and BENNY_ACTIVECAMERA and LocalPlayer():GetMoveType() != MOVETYPE_NOCLIP then
|
||||||
local x, y = cmd:GetForwardMove(), cmd:GetSideMove()
|
local x, y = cmd:GetForwardMove(), cmd:GetSideMove()
|
||||||
|
|
||||||
|
@ -54,18 +54,16 @@ hook.Add( "CreateMove", "CamFuck", function( cmd )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if true and LocalPlayer():GetMoveType() != MOVETYPE_NOCLIP then -- FPS cam
|
|
||||||
local p = LocalPlayer()
|
local p = LocalPlayer()
|
||||||
local w = p:GetActiveWeapon()
|
local w = p:GetActiveWeapon()
|
||||||
if !IsValid(w) then w = false end
|
if p:BennyCheck() and LocalPlayer():GetMoveType() != MOVETYPE_NOCLIP then -- FPS cam
|
||||||
local aimed = w and w:GetUserAim() or false
|
local aimed = w:GetUserAim()
|
||||||
|
|
||||||
local opos, ang = p:CamSpot( TPSOverride )
|
local opos, ang = p:CamSpot( TPSOverride )
|
||||||
|
|
||||||
ang:Add( Angle( cmd:GetMouseY()*0.022, -cmd:GetMouseX()*0.022, 0 ) )
|
ang:Add( Angle( cmd:GetMouseY()*0.022, -cmd:GetMouseX()*0.022, 0 ) )
|
||||||
ang:Normalize()
|
ang:Normalize()
|
||||||
|
|
||||||
|
|
||||||
if aimed then
|
if aimed then
|
||||||
local tr = util.TraceLine( {
|
local tr = util.TraceLine( {
|
||||||
start = opos,
|
start = opos,
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
|
|
||||||
local PT = FindMetaTable( "Player" )
|
local PT = FindMetaTable( "Player" )
|
||||||
|
|
||||||
|
function PT:BennyCheck()
|
||||||
|
return ( self:GetActiveWeapon():IsValid() and self:GetActiveWeapon():GetClass() == "benny" and self:GetActiveWeapon().GetUserAim )
|
||||||
|
end
|
||||||
|
|
||||||
function PT:CamSpot( ang )
|
function PT:CamSpot( ang )
|
||||||
local w = self:GetActiveWeapon()
|
local w = self:GetActiveWeapon()
|
||||||
if !IsValid( w ) then w = false end
|
if !IsValid( w ) then w = false end
|
||||||
|
|
||||||
local aim = w and w:GetAim() or 0
|
local aim = w and w:GetAim() or 0
|
||||||
aim = w:GetUserAim() and math.ease.OutCubic( aim ) or math.ease.InCubic( aim )
|
if w then aim = w:GetUserAim() and math.ease.OutCubic( aim ) or math.ease.InCubic( aim ) end
|
||||||
|
|
||||||
local pos = self:GetPos()
|
local pos = self:GetPos()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue