newer stuff

This commit is contained in:
Fesiug 2023-09-06 05:33:02 -04:00
parent 0b7e6762ec
commit 0997f4eec2
4 changed files with 2913 additions and 4995 deletions

View File

@ -5,37 +5,88 @@ BENNY.Cameras = {}
BENNY.Cameras["main"] = { BENNY.Cameras["main"] = {
Type = "Standard", Type = "Standard",
Pos = Vector( 235.24, 0, 280 ), Pos = Vector( -892, 0, 268 ),
Ang = Angle( 75, -180, 0 ), Ang = Angle( 35, 0, 0 ),
FOV = 67, FOV = 90,
Corner1 = Vector( 240, -240, 0 ), Checks = {
Corner2 = Vector( -240, 240, -130 ), {
v1 = Vector( 180, 0, -128 ), Vector( -448, 510, 0 ),
v2 = Vector( -180, 0, -128 ), Vector( -911, -509, -70 ),
},
},
iX1 = -550,
iX2 = -800,
Special = function( self, ply ) Special = function( self, ply )
local pos = Vector() local pos = Vector()
pos:Set( self.Pos ) pos:Set( self.Pos )
local ang = Angle() local ang = Angle()
ang:Set( self.Ang ) ang:Set( self.Ang )
debugoverlay.Cross( self.v1, 8, 0, color_white, true ) local ppos = ply:GetPos()
debugoverlay.Cross( self.v2, 8, 0, color_white, true ) pos.y = ppos.y
local amt = math.TimeFraction( self.v1.x, self.v2.x, ply:GetPos().x ) do -- Angle
local amt = math.TimeFraction( self.iX1, self.iX2, ppos.x )
amt = math.Clamp( amt, 0, 1 ) amt = math.Clamp( amt, 0, 1 )
ang.p = ang.p - ( 23 * amt ) amt = math.ease.InOutCubic( amt )
pos.x = pos.x - ( 270/2 * amt ) ang.p = ang.p + ( 35 * (amt) )
end
return pos, ang, self.FOV return pos, ang, self.FOV
end end
} }
BENNY.Cameras["grass"] = {
Pos = Vector( -1822, -214, 284 ),
Ang = Angle( 60, 0, 0 ),
FOV = 90,
Checks = {
{
Vector( -931, -130, 0 ),
Vector( -1311, -319, -70 ),
},
{
Vector( -1321, 506, 0 ),
Vector( -1813, -503, -70 ),
},
},
BENNY.Cameras["hall"] = { iX1 = -900,
iX2 = -1300,
Special = function( self, ply )
local pos = Vector()
pos:Set( self.Pos )
local ang = Angle()
ang:Set( self.Ang )
local fov = self.FOV
local ppos = ply:GetPos()
pos.y = ppos.y
do -- far
local amt = math.TimeFraction( self.iX1, self.iX2, ppos.x )
amt = 1-math.Clamp( amt, 0, 1 )
amt = math.ease.InOutCubic( amt )
ang.p = ang.p - ( 22 * amt )
pos.x = pos.x + ( 400 * amt )
fov = fov - ( 22 * amt )
end
return pos, ang, fov
end
}
--[[ BENNY.Cameras["hall"] = {
Type = "Fixed", Type = "Fixed",
Pos = Vector( 794, -40, 84 ), Pos = Vector( 794, -40, 84 ),
Ang = Angle( 29, 180, 0 ), Ang = Angle( 29, 180, 0 ),
Corner1 = Vector( 273, -111, 0 ), Checks = {
Corner2 = Vector( 751, 99, -130 ), {
Vector( 273, -111, 0 ),
Vector( 751, 99, -130 ),
},
},
v1 = Vector( 400, 0, -128 ), v1 = Vector( 400, 0, -128 ),
v2 = Vector( 630, 0, -128 ), v2 = Vector( 630, 0, -128 ),
FOV = 67, FOV = 67,
@ -54,15 +105,18 @@ BENNY.Cameras["hall"] = {
pos.x = pos.x - ( 50 * (1-amt) ) pos.x = pos.x - ( 50 * (1-amt) )
return pos, ang, self.FOV return pos, ang, self.FOV
end end
} } ]]
--[[ BENNY.Cameras["racks"] = {
BENNY.Cameras["racks"] = {
Type = "Standard", Type = "Standard",
Pos = Vector( 120, 0, 280 ), Pos = Vector( 120, 0, 280 ),
Ang = Angle( 60, 180, 0 ), Ang = Angle( 60, 180, 0 ),
Corner1 = Vector( 890, 135, 0 ), Checks = {
Corner2 = Vector( -253, 765, -130 ), {
Vector( 890, 135, 0 ),
Vector( -253, 765, -130 )
},
},
v1 = Vector( 870, 135, -130 ), v1 = Vector( 870, 135, -130 ),
v2 = Vector( 760, 135, -130 ), v2 = Vector( 760, 135, -130 ),
v3 = Vector( 890, 135, -130 ), v3 = Vector( 890, 135, -130 ),
@ -97,22 +151,32 @@ BENNY.Cameras["racks"] = {
return pos, ang, self.FOV return pos, ang, self.FOV
end end
} } ]]
BENNY_ACTIVECAMERA = "main" BENNY_ACTIVECAMERA = nil
local c_over = CreateConVar( "benny_cam_override", "" ) local c_over = CreateConVar( "benny_cam_override", "" )
local c_unlock = CreateConVar( "benny_cam_unlock", 0 ) local c_unlock = CreateConVar( "benny_cam_unlock", 0 )
local function decide_active()
for name, camera in pairs( BENNY.Cameras ) do
if camera.Checks then
for i, v in ipairs(camera.Checks) do
if LocalPlayer():GetPos():WithinAABox( v[1], v[2] ) then
print( LocalPlayer():GetPos() )--print( CurTime(), name, v[1], v[2] )
return name
end
end
end
end
end
hook.Add( "CalcView", "MyCalcView", function( ply, pos, ang, fov ) hook.Add( "CalcView", "MyCalcView", function( ply, pos, ang, fov )
if c_unlock:GetBool() then return end if c_unlock:GetBool() then return end
for i, v in pairs( BENNY.Cameras ) do if ply:GetMoveType() == MOVETYPE_NOCLIP then return end
if v.Corner1 and v.Corner2 then local da = decide_active()
if ply:GetPos():WithinAABox( v.Corner1, v.Corner2 ) then if da then
BENNY_ACTIVECAMERA = i BENNY_ACTIVECAMERA = da
break
end
end
end end
local camera = BENNY.Cameras[BENNY_ACTIVECAMERA] local camera = BENNY.Cameras[BENNY_ACTIVECAMERA]
if camera then if camera then
@ -286,21 +350,24 @@ concommand.Add("benny_cam_panel", function()
local b = vgui.Create("DButton") local b = vgui.Create("DButton")
b:SetText( "Steal from current" ) b:SetText( "Steal from current" )
function b:DoClick() function b:DoClick()
local ply = LocalPlayer()
local ppos = ply:EyePos()
local pang = ply:EyeAngles()
for i=1, 7 do for i=1, 7 do
if i==1 then if i==1 then
bloink[i]:SetValue( BENNY_ACTIVECAMERA:GetPos()[1] ) bloink[i]:SetValue( ppos[1] )
elseif i==2 then elseif i==2 then
bloink[i]:SetValue( BENNY_ACTIVECAMERA:GetPos()[2] ) bloink[i]:SetValue( ppos[2] )
elseif i==3 then elseif i==3 then
bloink[i]:SetValue( BENNY_ACTIVECAMERA:GetPos()[3] ) bloink[i]:SetValue( ppos[3] )
elseif i==4 then elseif i==4 then
bloink[i]:SetValue( -BENNY_ACTIVECAMERA:GetAngles()[1] ) bloink[i]:SetValue( pang[1] )
elseif i==5 then elseif i==5 then
bloink[i]:SetValue( BENNY_ACTIVECAMERA:GetAngles()[2] ) bloink[i]:SetValue( pang[2] )
elseif i==6 then elseif i==6 then
bloink[i]:SetValue( BENNY_ACTIVECAMERA:GetAngles()[3] ) bloink[i]:SetValue( pang[3] )
elseif i==7 then elseif i==7 then
bloink[i]:SetValue( BENNY_ACTIVECAMERA.FOV ) bloink[i]:SetValue( 90 )
end end
c_over:SetString( table.concat( st, " " ) ) c_over:SetString( table.concat( st, " " ) )
end end
@ -323,6 +390,6 @@ end)
concommand.Add( "benny_dev_eyetrace", function( ply ) concommand.Add( "benny_dev_eyetrace", function( ply )
local tr = ply:GetEyeTrace() local tr = ply:GetEyeTrace()
print( string.format("Vector( %f, %f, %f )", tr.HitPos.x, tr.HitPos.y, tr.HitPos.z ) ) print( string.format("Vector( %i, %i, %i )", math.Round( tr.HitPos.x ), math.Round( tr.HitPos.y ), math.Round( tr.HitPos.z ) ) )
print( tr.Entity ) print( tr.Entity )
end) end)

View File

@ -2,7 +2,7 @@
local wa, wb = 0, 0 local wa, wb = 0, 0
hook.Add( "CreateMove", "CamFuck", function( cmd ) hook.Add( "CreateMove", "CamFuck", function( cmd )
if LocalPlayer():GetMoveType() != MOVETYPE_NOCLIP then
local x, y = cmd:GetForwardMove(), cmd:GetSideMove() local x, y = cmd:GetForwardMove(), cmd:GetSideMove()
wa, wb = x, y wa, wb = x, y
@ -26,6 +26,7 @@ hook.Add( "CreateMove", "CamFuck", function( cmd )
cmd:SetForwardMove( ad.x ) cmd:SetForwardMove( ad.x )
cmd:SetSideMove( ad.y ) cmd:SetSideMove( ad.y )
end
end) end)
function GM:PlayerNoClip() function GM:PlayerNoClip()
@ -64,5 +65,36 @@ if CLIENT then
oy = math.Clamp( oy, -1, 1 ) * cr oy = math.Clamp( oy, -1, 1 ) * cr
surface.DrawCircle( bo + cr + ox, ScrH() - bo - cr + oy, ss( 2 ) ) surface.DrawCircle( bo + cr + ox, ScrH() - bo - cr + oy, ss( 2 ) )
-- local x, y, w, h = 0, 0, 360, 240
-- local ow, oh = 512, 512
-- local camera = BENNY.Cameras[BENNY_ACTIVECAMERA]
-- local view = {
-- origin = camera.Pos,
-- angles = camera.Ang,
-- fov = camera.FOV or 60,
-- drawviewer = true
-- }
-- if camera.Special then
-- view.origin, view.angles, view.fov = camera.Special( camera, LocalPlayer() )
-- end
-- view.angles.p = 0
-- view.angles.r = 0
-- local aratio = w/h
-- render.RenderView( {
-- origin = view.origin + Vector( 0, 0, 64 ),
-- angles = Angle( 90, view.angles.y, 0 ),
-- aspect = 1,
-- fov = 90,
-- x = x, y = y,
-- w = w, h = h,
-- ortho = {
-- left = -ow, right = ow,
-- top = -oh / aratio, bottom = oh / aratio,
-- },
-- } )
end) end)
end end

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:7ae6994423218baf74ecb6ea8d65e881dfe58717c4fce23e29cb0be90ad707e1 oid sha256:7fb755e69fa8e8d77acaf7abf68e984a524ada079789ad6c620d317054870728
size 197256 size 230856

File diff suppressed because it is too large Load Diff