Just a ton of progress I forgot to commit

This commit is contained in:
Fesiug 2023-09-23 22:51:35 -04:00
parent 3c25c16787
commit 1dc4d614cd
11 changed files with 288 additions and 5213 deletions

View File

@ -1,4 +1,6 @@
-- The benny weapon handles the weapon pickups you find throughout the game.
SWEP.Base = "weapon_base" SWEP.Base = "weapon_base"
SWEP.PrintName = "Benny Weapon Handler" SWEP.PrintName = "Benny Weapon Handler"
@ -6,10 +8,23 @@ SWEP.PrintName = "Benny Weapon Handler"
SWEP.ViewModel = "models/weapons/c_pistol.mdl" SWEP.ViewModel = "models/weapons/c_pistol.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl" SWEP.WorldModel = "models/weapons/w_pistol.mdl"
function SWEP:SetupDataTables()
self:NetworkVar( "Float", 0, "Aim" )
end
function SWEP:PrimaryAttack() function SWEP:PrimaryAttack()
if self:Clip1() == 0 then
self:EmitSound( "benny/weapons/common/06-13.ogg", 80, 100, 1, CHAN_STATIC )
return
end
if CLIENT then if CLIENT then
AddCaption( "PISTOL", Color( 61, 61, 61 ), "[Pistol shot]", 0.1, 0.5 ) AddCaption( "PISTOL", Color( 61, 61, 61 ), "[Pistol shot]", 0.1, 0.5 )
end end
self:EmitSound( "benny/weapons/1911/0".. math.random(1,3) ..".ogg", 110, 100, 1, CHAN_STATIC )
self:SetClip1( self:Clip1() - 1 )
return true return true
end end
@ -18,12 +33,23 @@ function SWEP:SecondaryAttack()
end end
function SWEP:Reload() function SWEP:Reload()
self:SetClip1( 17 )
return true return true
end end
function SWEP:Think() function SWEP:Think()
self:SetWeaponHoldType("normal") local p = self:GetOwner()
self:SetHoldType("normal")
self:SetAim( math.Approach( self:GetAim(), p:KeyDown(IN_ATTACK2) and 1 or 0, FrameTime()/0.05 ) )
local ht = "normal"
if self:GetAim() > 0 then
ht = "revolver"
end
self:SetWeaponHoldType(ht)
self:SetHoldType(ht)
return true return true
end end

View File

@ -0,0 +1,13 @@
local UUID_chars = "0123456789ABCDEF"
function UUID_generate()
local str = ""
for i=1, 8 do
str = str .. UUID_chars[ math.random( 1, #UUID_chars ) ]
-- if (i%4==0 and i!=8) then
-- str = str .. "-"
-- end
end
return str
end

View File

@ -3,6 +3,27 @@
local debugcolor = Color( 255, 0, 255, 1 ) local debugcolor = Color( 255, 0, 255, 1 )
local function QuickDrag( self, dist, ply )
local spos = ply:GetPos()
self.QuickDrag = self.QuickDrag or Vector()
-- debugoverlay.Box( self.last, Vector( -dist, -dist, 0 ), Vector( dist, dist, 64 ), 0, Color( 0, 0, 255, 0 ) )
if spos.x > (self.QuickDrag.x+dist) then
self.QuickDrag.x = spos.x-dist
elseif spos.x < (self.QuickDrag.x-dist) then
self.QuickDrag.x = spos.x+dist
end
if spos.y > (self.QuickDrag.y+dist) then
self.QuickDrag.y = spos.y-dist
elseif spos.y < (self.QuickDrag.y-dist) then
self.QuickDrag.y = spos.y+dist
end
return spos
end
tempmapcameras = {} tempmapcameras = {}
tempmapcameras["benny_caramelldansen"] = {} tempmapcameras["benny_caramelldansen"] = {}
@ -10,7 +31,7 @@ tempmapcameras["benny_caramelldansen"] = {}
tempmapcameras["benny_caramelldansen"]["main"] = { tempmapcameras["benny_caramelldansen"]["main"] = {
Type = "Standard", Type = "Standard",
Pos = Vector( -510, 0, 128 ), Pos = Vector( -510, 0, 128 ),
Ang = Angle( 12, 0, 0 ), Ang = Angle( 44, 0, 0 ),
FOV = 90, FOV = 90,
Checks = { Checks = {
{ {
@ -24,6 +45,10 @@ tempmapcameras["benny_caramelldansen"]["main"] = {
local ang = Angle() local ang = Angle()
ang:Set( self.Ang ) ang:Set( self.Ang )
pos:Set( QuickDrag( self, 40, ply ) )
pos.x = pos.x - 130
pos.z = 180
return pos, ang, self.FOV return pos, ang, self.FOV
end end
} }
@ -166,23 +191,13 @@ local tempcam = {
Special = function( self, ply ) Special = function( self, ply )
local pos = Vector() local pos = Vector()
local ang = Angle() local ang = Angle( 22, 0, 0 )
local fov = self.FOV
local ppos = ply:GetPos()
local pang = ply:EyeAngles()
pos:Set( ppos ) pos:Set( QuickDrag( self, 40, ply ) )
ang:Add( pang ) pos.x = pos.x - 30
pos.z = pos.z + 80
pos.z = pos.z + 68 return pos, ang, self.FOV
ctrace.start = pos
ctrace.endpos = pos + ( ang:Forward() * -60 ) + ( ang:Right() * 20 )
ctrace.filter = ply
local tr = util.TraceHull( ctrace )
pos = tr.HitPos
return pos, ang, fov
end end
} }
@ -250,21 +265,48 @@ local function decide_active()
return false return false
end end
function bennyfp( origin, angles, fov )
local ply = LocalPlayer()
assert( IsValid( ply:GetActiveWeapon() ) )
local pos, ang = Vector(), Angle()
pos:Set( ply:GetPos() )
pos.z = pos.z + 64
ang:Set( angles )
pos:Add( 16 * ang:Right() )
pos:Add( -32 * ang:Forward() )
pos:Add( 0 * ang:Up() )
pos:Add( 16 * ang:Up() * (ang.p/90) )
return pos, ang, 90
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
if ply:GetMoveType() == MOVETYPE_NOCLIP then return end if ply:GetMoveType() == MOVETYPE_NOCLIP then return end
decide_active() decide_active()
local camera = BENNY_ACTIVECAMERA local camera = BENNY_ACTIVECAMERA
local view = {}
view.origin = pos
view.angles = ang
view.fov = 90
if camera then if camera then
local view = { view.origin = camera.Pos
origin = camera.Pos, view.angles = camera.Ang
angles = camera.Ang, view.fov = camera.FOV or 60
fov = camera.FOV or 60,
drawviewer = true
}
if camera.Special then if camera.Special then
view.origin, view.angles, view.fov = camera.Special( camera, ply ) view.origin, view.angles, view.fov = camera.Special( camera, ply )
end end
end
-- PROTO: Add correct benny weapon check
if IsValid(ply:GetActiveWeapon()) and ply:GetActiveWeapon():GetAim() > 0 then
view.drawviewer = true
view.origin, view.angles, view.fov = bennyfp( view.origin, view.angles, view.fov )
end
local st = c_over:GetString() local st = c_over:GetString()
if st != "" then if st != "" then
@ -280,9 +322,8 @@ hook.Add( "CalcView", "MyCalcView", function( ply, pos, ang, fov )
view.fov = tonumber(st[7]) view.fov = tonumber(st[7])
end end
--view.fov = Convert( view.fov, (ScrH()/ScrW())/(3/4) ) view.fov = Convert( view.fov, (ScrH()/ScrW())/(3/4) )
return view return view
end
end ) end )
function Convert( fovDegrees, ratio ) function Convert( fovDegrees, ratio )

View File

@ -8,6 +8,9 @@ local hide = {
["CHudSecondaryAmmo"] = true, ["CHudSecondaryAmmo"] = true,
["CHudPoisonDamageIndicator"] = true, ["CHudPoisonDamageIndicator"] = true,
["CHudCrosshair"] = true, ["CHudCrosshair"] = true,
["CHUDQuickInfo"] = true,
["CHudSuitPower"] = true,
["CHudZoom"] = true,
} }
hook.Add( "HUDShouldDraw", "HideHUD", function( name ) hook.Add( "HUDShouldDraw", "HideHUD", function( name )
@ -135,11 +138,14 @@ function AddCaption( name, color, text, time_to_type, lifetime )
end end
local color_caption = Color( 0, 0, 0, 127 ) local color_caption = Color( 0, 0, 0, 127 )
local mat_grad = Material( "benny/hud/grad.png", "mips smooth" )
hook.Add( "HUDPaint", "Benny_HUDPaint", function() hook.Add( "HUDPaint", "Benny_HUDPaint", function()
local sw, sh = ScrW(), ScrH() local sw, sh = ScrW(), ScrH()
localss = ss(1)
local b = ss(20) local b = ss(20)
local p = LocalPlayer()
-- PROTO: Make sure this is the 'benny' weapon.
local wep = p:GetActiveWeapon()
local scheme = schemes["benny"] local scheme = schemes["benny"]
@ -148,7 +154,8 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
surface.SetDrawColor( scheme["bg"] ) surface.SetDrawColor( scheme["bg"] )
surface.DrawRect( b, sh - b - ss(22), ss(140), ss(14+8) ) surface.DrawRect( b, sh - b - ss(22), ss(140), ss(14+8) )
local hp = CurTime()*0.5 % 1 local hp = p:Health()/100 --CurTime()*0.5 % 1
local ti = (CurTime()*0.75 / (hp)) % 1
-- Text underneath -- Text underneath
surface.SetFont( "Benny_18" ) surface.SetFont( "Benny_18" )
@ -160,6 +167,15 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
surface.SetDrawColor( scheme["fg"] ) surface.SetDrawColor( scheme["fg"] )
surface.DrawRect( b + ss(4), sh - b - ss(22) + ss(4), ss((140*hp)-8), ss(14) ) surface.DrawRect( b + ss(4), sh - b - ss(22) + ss(4), ss((140*hp)-8), ss(14) )
local gcol = scheme["fg"]
local ch, cs, cl = gcol:ToHSL()
cl = ((cl*0.0) + (1)*hp)
gcol = HSLToColor( ch, cs, cl )
gcol.a = ((1-ti)*255*hp) + ((1-hp)*255)
surface.SetDrawColor( gcol )
surface.SetMaterial( mat_grad )
surface.DrawTexturedRect( b + ss(4), sh - b - ss(22) + ss(4), ss((140*hp*ti)-8), ss(14) )
-- Bar text -- Bar text
surface.SetTextColor( scheme["bg"] ) surface.SetTextColor( scheme["bg"] )
surface.SetTextPos( b + ss(6), sh - b - ss(22) + ss(3) ) surface.SetTextPos( b + ss(6), sh - b - ss(22) + ss(3) )
@ -170,29 +186,30 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
do -- Weapon do -- Weapon
local w, h = 150, 100 local w, h = 150, 100
local BOXHEIGHT = 44
-- BG -- BG
surface.SetDrawColor( scheme["bg"] ) surface.SetDrawColor( scheme["bg"] )
surface.DrawRect( sw - b - ss(w), sh - b - ss(100), ss(w), ss(100) ) surface.DrawRect( sw - b - ss(w), sh - b - ss(BOXHEIGHT), ss(w), ss(BOXHEIGHT) )
-- Text bar -- Text bar
surface.SetFont( "Benny_18" ) surface.SetFont( "Benny_18" )
surface.SetDrawColor( scheme["fg"] ) surface.SetDrawColor( scheme["fg"] )
surface.DrawRect( sw - b - ss(w-4), sh - b - ss(100-4), ss(w-8), ss(14) ) surface.DrawRect( sw - b - ss(w-4), sh - b - ss(BOXHEIGHT-4), ss(w-8), ss(14) )
surface.SetTextColor( scheme["bg"] ) surface.SetTextColor( scheme["bg"] )
surface.SetTextPos( sw - b - ss(w-6), sh - b - ss(100-3) ) surface.SetTextPos( sw - b - ss(w-6), sh - b - ss(BOXHEIGHT-3) )
surface.DrawText( "GLOCK-17" ) surface.DrawText( "GLOCK-17" )
surface.SetDrawColor( scheme["fg"] ) surface.SetDrawColor( scheme["fg"] )
surface.DrawRect( sw - b - ss(w-4), sh - b + ss(16) - ss(100-4), ss(29), ss(10) ) surface.DrawRect( sw - b - ss(w-4), sh - b + ss(16) - ss(BOXHEIGHT-4), ss(29), ss(10) )
surface.SetFont( "Benny_12" ) surface.SetFont( "Benny_12" )
surface.SetTextColor( scheme["bg"] ) surface.SetTextColor( scheme["bg"] )
surface.SetTextPos( sw - b - ss(w-7), sh - b + ss(16) - ss(100-4) ) surface.SetTextPos( sw - b - ss(w-7), sh - b + ss(16) - ss(BOXHEIGHT-4) )
surface.DrawText( "3BST" ) surface.DrawText( "3BST" )
surface.SetFont( "Benny_12" ) surface.SetFont( "Benny_12" )
local text = "17 - MAG 3" local text = wep:Clip1() .. " - MAG 3"
local tw = surface.GetTextSize( text ) local tw = surface.GetTextSize( text )
surface.SetTextColor( scheme["fg"] ) surface.SetTextColor( scheme["fg"] )
surface.SetTextPos( sw - b - ss(4) - tw, sh - b - ss(24) ) surface.SetTextPos( sw - b - ss(4) - tw, sh - b - ss(24) )
@ -200,9 +217,12 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
for i=1, 17 do for i=1, 17 do
surface.SetDrawColor( scheme["fg"] ) surface.SetDrawColor( scheme["fg"] )
surface.DrawOutlinedRect( sw - b - ss(3+4) - ( ss(5) * (i-1) ), sh - b - ss(8+4), ss(3), ss(8), ss(0.5) )
if i <= wep:Clip1() then
surface.DrawRect( sw - b - ss(3+4) - ( ss(5) * (i-1) ), sh - b - ss(8+4), ss(3), ss(8) ) surface.DrawRect( sw - b - ss(3+4) - ( ss(5) * (i-1) ), sh - b - ss(8+4), ss(3), ss(8) )
end end
end end
end
do -- Captions do -- Captions
local space = b local space = b
@ -241,4 +261,34 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
surface.DrawText( caption.name ) surface.DrawText( caption.name )
end end
end end
-- [UUID_generate()] = {
-- Clip1 = 20,
-- Mag1 = 12,
-- Mag2 = 9,
-- Mag3 = 17,
-- }
do -- Inventory
local gap = 0
for ID, Data in pairs( p:INV_Get() ) do
surface.SetDrawColor( scheme["bg"] )
surface.DrawRect( b + ss(4), b + ss(4) + gap, ss(140), ss(30) )
surface.SetFont( "Benny_12" )
surface.SetTextColor( scheme["fg"] )
surface.SetTextPos( b + ss(4 + 4), b + ss(4 + 3) + gap )
surface.DrawText( ID )
local str = ""
for i, v in pairs( Data ) do
str = str .. i .. ": " .. v .. " "
end
surface.SetFont( "Benny_10" )
surface.SetTextColor( scheme["fg"] )
surface.SetTextPos( b + ss(4 + 4), b + ss(4 + 3 + 8) + gap )
surface.DrawText( str )
gap = gap + ss(30+4)
end
end
end ) end )

View File

@ -1,8 +1,7 @@
function GM:PlayerSetModel( ply ) function GM:PlayerSpawn( ply )
ply:SetModel( "models/player/group01/male_07.mdl" ) player_manager.SetPlayerClass( ply, "player_benny" )
end ply:SetModel( "models/player/combine_super_soldier.mdl" )
ply:SetPlayerColor( Vector( 0.275, 0.2, 0.145 ) )
function GM:PlayerLoadout( ply )
ply:Give( "benny" ) ply:Give( "benny" )
end end

View File

@ -0,0 +1,10 @@
local PT = FindMetaTable( "Player" )
function PT:INV_Get()
if !self.INV then
print( "Inventory created")
self.INV = {}
end
return self.INV
end

View File

@ -6,8 +6,21 @@ local wa, wb = 0, 0
local blop = Angle() local blop = Angle()
hook.Add( "CreateMove", "CamFuck", function( cmd ) hook.Add( "CreateMove", "CamFuck", function( cmd )
if LocalPlayer():GetMoveType() != MOVETYPE_NOCLIP then if BENNY_ACTIVECAMERA and LocalPlayer():GetMoveType() != MOVETYPE_NOCLIP then
local x, y = cmd:GetForwardMove(), cmd:GetSideMove() local x, y = cmd:GetForwardMove(), cmd:GetSideMove()
local lx=input.GetAnalogValue(ANALOG_JOY_X) // Left X Axis: left -, right +
local ly=input.GetAnalogValue(ANALOG_JOY_Y) // Left Y Axis: up -, bottom +
local lr=input.GetAnalogValue(ANALOG_JOY_R) // Right X Axis: left -, right +
local lu=input.GetAnalogValue(ANALOG_JOY_U) // Right Y Axis: up -, bottom +
lx=lx/32768; ly=ly/32768; lr=lr/32768; lu=lu/32768; // Conversion to floats -1.0 - 1.0
if lx != 0 or ly != 0 then
x, y = ly * -320, lx * 320
end
wa, wb = x, y wa, wb = x, y
local ad = Vector( x, y, 0 ) local ad = Vector( x, y, 0 )
@ -23,9 +36,10 @@ hook.Add( "CreateMove", "CamFuck", function( cmd )
ad:Rotate( am ) ad:Rotate( am )
ad:Rotate( -an ) ad:Rotate( -an )
ad:Normalize() -- ad:Normalize()
ad:Mul(320) -- ad:Mul(320)
cmd:ClearMovement()
cmd:SetForwardMove( ad.x ) cmd:SetForwardMove( ad.x )
cmd:SetSideMove( ad.y ) cmd:SetSideMove( ad.y )

View File

@ -0,0 +1,28 @@
AddCSLuaFile()
local PLAYER = {}
PLAYER.DisplayName = "Benny Player Class"
PLAYER.SlowWalkSpeed = 200
PLAYER.WalkSpeed = 400
PLAYER.RunSpeed = 600
PLAYER.CrouchedWalkSpeed = 0.3
PLAYER.DuckSpeed = 0.3
PLAYER.UnDuckSpeed = 0.3
PLAYER.JumpPower = 200
PLAYER.CanUseFlashlight = false
PLAYER.MaxHealth = 100
PLAYER.MaxArmor = 100
PLAYER.StartHealth = 100
PLAYER.StartArmor = 0
PLAYER.DropWeaponOnDie = false
PLAYER.TeammateNoCollide = true
PLAYER.AvoidPlayers = true
PLAYER.UseVMHands = true
function PLAYER:SetupDataTables()
end
player_manager.RegisterClass( "player_benny", PLAYER, "player_default" )

View File

@ -0,0 +1,47 @@
WEAPONS = {}
local wep = {}
WEAPONS["glock"] = wep
wep.Name = "GLOCK-18"
wep.WModel = "models/weapons/w_pist_glock18.mdl"
wep.Description = "Superb precision but poor capacity."
wep.Ammo = 17
wep.Damage = 18
local wep = {}
WEAPONS["python"] = wep
wep.Name = "PYTHON"
wep.Description = "Superb precision but poor capacity."
wep.Ammo = 6
wep.Damage = 36
local wep = {}
WEAPONS["tmp"] = wep
wep.Name = "TMP"
wep.Description = "Precise."
wep.Ammo = 15
local wep = {}
WEAPONS["mp7"] = wep
wep.Name = "MP7"
wep.Description = "Small, pistol-sized, and simple."
wep.Ammo = 15
local wep = {}
WEAPONS["mp5k"] = wep
wep.Name = "MP5K"
wep.Description = "Quality manufacturing, but cumbersome."
wep.Ammo = 15
local wep = {}
WEAPONS["mac11"] = wep
wep.Name = "MAC-11"
wep.Description = "More fit for combat in a phone booth."
wep.Ammo = 15
local wep = {}
WEAPONS["bizon"] = wep
wep.Name = "BIZON"
wep.Description = "Unwieldy bullet storm."
wep.Ammo = 40

BIN
maps/benny_test.bsp (Stored with Git LFS)

Binary file not shown.

File diff suppressed because it is too large Load Diff