From 40a6931f51f90ffb371e0bbbe330eed24aa3edc1 Mon Sep 17 00:00:00 2001 From: Fesiug Date: Thu, 7 Mar 2024 20:34:16 -0500 Subject: [PATCH] Whole rewrite of game code --- gamemodes/benny/gamemode/camera.lua | 14 + gamemodes/benny/gamemode/cl_init.lua | 2 - gamemodes/benny/gamemode/init.lua | 2 - .../items/sh_definitions.lua => items.lua} | 4 + .../gamemode/modules/arena/sh_loadout.lua | 42 - .../benny/gamemode/modules/audio/sh_audio.lua | 78 -- .../gamemode/modules/commons/sh_commons.lua | 10 - .../gamemode/modules/commons/sh_convars.lua | 95 -- .../benny/gamemode/modules/gui/cl_deadeye.lua | 416 ------- .../gamemode/modules/gui/cl_debuginv.lua | 189 ---- .../benny/gamemode/modules/gui/cl_inv.lua | 2 - .../gamemode/modules/gui/cl_mainmenu.lua | 97 -- .../gamemode/modules/gui/cl_settings.lua | 142 --- .../gamemode/modules/gui/cl_spawnmenu.lua | 530 --------- .../benny/gamemode/modules/gui/cl_spscore.lua | 10 - .../benny/gamemode/modules/lang/en-us.lua | 7 - .../benny/gamemode/modules/lang/sh_lang.lua | 10 - .../gamemode/modules/player/cl_camera.lua | 143 --- .../benny/gamemode/modules/player/cl_hud.lua | 1005 ----------------- .../gamemode/modules/player/sh_basic.lua | 131 --- .../gamemode/modules/player/sh_checker.lua | 182 --- .../benny/gamemode/modules/player/sh_hud.lua | 74 -- .../gamemode/modules/player/sh_movement.lua | 155 --- .../modules/player/sh_movement_advanced.lua | 207 ---- .../gamemode/modules/player/sh_player.lua | 356 ------ .../modules/player/sh_player_class.lua | 45 - .../modules/vgui/cl_bcategorycollapse.lua | 318 ------ .../benny/gamemode/modules/vgui/cl_bframe.lua | 202 ---- gamemodes/benny/gamemode/shared.lua | 37 +- gamemodes/benny/gamemode/sound/sh_basic.lua | 0 30 files changed, 24 insertions(+), 4481 deletions(-) create mode 100644 gamemodes/benny/gamemode/camera.lua rename gamemodes/benny/gamemode/{modules/items/sh_definitions.lua => items.lua} (96%) delete mode 100644 gamemodes/benny/gamemode/modules/arena/sh_loadout.lua delete mode 100644 gamemodes/benny/gamemode/modules/audio/sh_audio.lua delete mode 100644 gamemodes/benny/gamemode/modules/commons/sh_commons.lua delete mode 100644 gamemodes/benny/gamemode/modules/commons/sh_convars.lua delete mode 100644 gamemodes/benny/gamemode/modules/gui/cl_deadeye.lua delete mode 100644 gamemodes/benny/gamemode/modules/gui/cl_debuginv.lua delete mode 100644 gamemodes/benny/gamemode/modules/gui/cl_inv.lua delete mode 100644 gamemodes/benny/gamemode/modules/gui/cl_mainmenu.lua delete mode 100644 gamemodes/benny/gamemode/modules/gui/cl_settings.lua delete mode 100644 gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua delete mode 100644 gamemodes/benny/gamemode/modules/gui/cl_spscore.lua delete mode 100644 gamemodes/benny/gamemode/modules/lang/en-us.lua delete mode 100644 gamemodes/benny/gamemode/modules/lang/sh_lang.lua delete mode 100644 gamemodes/benny/gamemode/modules/player/cl_camera.lua delete mode 100644 gamemodes/benny/gamemode/modules/player/cl_hud.lua delete mode 100644 gamemodes/benny/gamemode/modules/player/sh_basic.lua delete mode 100644 gamemodes/benny/gamemode/modules/player/sh_checker.lua delete mode 100644 gamemodes/benny/gamemode/modules/player/sh_hud.lua delete mode 100644 gamemodes/benny/gamemode/modules/player/sh_movement.lua delete mode 100644 gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua delete mode 100644 gamemodes/benny/gamemode/modules/player/sh_player.lua delete mode 100644 gamemodes/benny/gamemode/modules/player/sh_player_class.lua delete mode 100644 gamemodes/benny/gamemode/modules/vgui/cl_bcategorycollapse.lua delete mode 100644 gamemodes/benny/gamemode/modules/vgui/cl_bframe.lua delete mode 100644 gamemodes/benny/gamemode/sound/sh_basic.lua diff --git a/gamemodes/benny/gamemode/camera.lua b/gamemodes/benny/gamemode/camera.lua new file mode 100644 index 0000000..2c3e25e --- /dev/null +++ b/gamemodes/benny/gamemode/camera.lua @@ -0,0 +1,14 @@ + +--------------------- +-- Your Name is Benny +--------------------- + +function GM:CalcView( ply, pos, ang, fov ) + local view = { + origin = pos + (ang:Forward() * -64), + angles = angles, + fov = fov, + drawviewer = true + } + return view +end \ No newline at end of file diff --git a/gamemodes/benny/gamemode/cl_init.lua b/gamemodes/benny/gamemode/cl_init.lua index e9b3797..ec3dcc6 100644 --- a/gamemodes/benny/gamemode/cl_init.lua +++ b/gamemodes/benny/gamemode/cl_init.lua @@ -1,4 +1,2 @@ --- Thing - include( "shared.lua" ) \ No newline at end of file diff --git a/gamemodes/benny/gamemode/init.lua b/gamemodes/benny/gamemode/init.lua index c3a2ec9..a5d210c 100644 --- a/gamemodes/benny/gamemode/init.lua +++ b/gamemodes/benny/gamemode/init.lua @@ -1,6 +1,4 @@ --- Thing - AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) diff --git a/gamemodes/benny/gamemode/modules/items/sh_definitions.lua b/gamemodes/benny/gamemode/items.lua similarity index 96% rename from gamemodes/benny/gamemode/modules/items/sh_definitions.lua rename to gamemodes/benny/gamemode/items.lua index cf5dc35..3241581 100644 --- a/gamemodes/benny/gamemode/modules/items/sh_definitions.lua +++ b/gamemodes/benny/gamemode/items.lua @@ -1,4 +1,8 @@ +--------------------- +-- Your Name is Benny +--------------------- + ITEMS = {} local itemmeta = {} diff --git a/gamemodes/benny/gamemode/modules/arena/sh_loadout.lua b/gamemodes/benny/gamemode/modules/arena/sh_loadout.lua deleted file mode 100644 index f4873f7..0000000 --- a/gamemodes/benny/gamemode/modules/arena/sh_loadout.lua +++ /dev/null @@ -1,42 +0,0 @@ - --- Benny quirk system - -PERKS = {} - -CAT_MENTAL = 1 -CAT_PHYSICAL = 2 -CAT_TRAINING = 3 -CAT_OPERATIONAL = 4 - -PERKS[CAT_MENTAL] = {} -PERKS[CAT_PHYSICAL] = {} -PERKS[CAT_TRAINING] = {} -PERKS[CAT_OPERATIONAL] = {} - -PERKS[CAT_MENTAL]["overprepared"] = 1 -- Magazines & grenades take less inventory space -PERKS[CAT_MENTAL]["resilience"] = 1 -- Near immunity to fall damage -PERKS[CAT_MENTAL]["paranoid"] = 2 -- Indicator when being targeted from outside your FoV. -PERKS[CAT_MENTAL]["stoic"] = 2 -- Flinch less from damage. -PERKS[CAT_MENTAL]["bloodthirsty"] = 2 -- Instantly regenerate health from melee and thrown kills -PERKS[CAT_MENTAL]["relentless"] = 3 -- Faster melee swings on a hit. - -PERKS[CAT_PHYSICAL]["sling"] = 1 -- Hipfire accuracy increase -PERKS[CAT_PHYSICAL]["armpadding"] = 2 -- No health damage when blocking blunt melee, but stamina damage still applies -PERKS[CAT_PHYSICAL]["stabkevlar"] = 2 -- Half health damage when blocking sharp melee, but stamina damage still applies -PERKS[CAT_PHYSICAL]["tacticalgloves"] = 2 -- Switch weapons faster -PERKS[CAT_PHYSICAL]["platecarrier"] = 3 -- More inventory slots (+2?) -PERKS[CAT_PHYSICAL]["lightweight"] = 3 -- Aim down sights faster. - -PERKS[CAT_TRAINING]["freerunner"] = 1 -- Faster movement, shorter cooldowns, quicker movement actions. -PERKS[CAT_TRAINING]["legday"] = 1 -- Higher vaulting & jumping. -PERKS[CAT_TRAINING]["readyup"] = 1 -- Weapon is ready faster after sprinting -PERKS[CAT_TRAINING]["hitman"] = 2 -- Take down enemies without revealing their location -PERKS[CAT_TRAINING]["athletic"] = 2 -- Infinite sprint -PERKS[CAT_TRAINING]["counters"] = 3 -- Perfect blocks on melee damage stuns enemies. - -PERKS[CAT_OPERATIONAL]["blindeye"] = 1 -- Enemy electronics take much longer to spot you. -PERKS[CAT_OPERATIONAL]["scavenger"] = 1 -- Replenish ammo from enemy corpses. -PERKS[CAT_OPERATIONAL]["deadsilence"] = 2 -- Move almost quietly. -PERKS[CAT_OPERATIONAL]["blastresponse"] = 2 -- Enemies damaged by explosions show up on radar. -PERKS[CAT_OPERATIONAL]["offthegrid"] = 3 -- Don't show up on radar -PERKS[CAT_OPERATIONAL]["wiretap"] = 3 -- Hack into enemy equipment \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/audio/sh_audio.lua b/gamemodes/benny/gamemode/modules/audio/sh_audio.lua deleted file mode 100644 index 8042133..0000000 --- a/gamemodes/benny/gamemode/modules/audio/sh_audio.lua +++ /dev/null @@ -1,78 +0,0 @@ - --- Audio & caption system - -CAPTIONS = {} -CAPTIONS["en-us"] = {} - - -function RegisterCaption( Name, Subject, Color, Text, TypeTime, LifeTime, Bold, Italic ) - CAPTIONS["en-us"][Name] = { - Name = Subject, - Color = Color, - Text = Text, - TypeTime = TypeTime, - LifeTime = LifeTime, - Bold = Bold, - Italic = Italic, - } -end - -RegisterCaption("1911.Fire", "Cobra .45", color_white, "[fire]", 0.1, 0.5, false, true ) -RegisterCaption("1911.Reload", "Cobra .45", color_white, "[reload]", 0.1, 0.5, false, true ) -RegisterCaption("Bizon.Fire", "Bizon", color_white, "[fire]", 0.1, 0.5, false, true ) -RegisterCaption("Bizon.Reload", "Bizon", color_white, "[reload]", 0.1, 0.5, false, true ) -RegisterCaption("TMP.Fire", "TMP", color_white, "[fire]", 0.1, 0.5, false, true ) -RegisterCaption("TMP.Reload", "TMP", color_white, "[reload]", 0.1, 0.5, false, true ) -RegisterCaption("USP.Fire", "USP", color_white, "[fire]", 0.1, 0.5, false, true ) -RegisterCaption("USP.Reload", "USP", color_white, "[reload]", 0.1, 0.5, false, true ) -RegisterCaption("Glock.Fire", "Glock", color_white, "[fire]", 0.1, 0.5, false, true ) -RegisterCaption("Glock.Reload", "Glock", color_white, "[reload]", 0.1, 0.5, false, true ) -RegisterCaption("MP5K.Fire", "MP5K", color_white, "[fire]", 0.1, 0.5, false, true ) -RegisterCaption("MP5K.Reload", "MP5K", color_white, "[reload]", 0.1, 0.5, false, true ) -RegisterCaption("MAC11.Fire", "MAC11", color_white, "[fire]", 0.1, 0.5, false, true ) -RegisterCaption("MAC11.Reload", "MAC11", color_white, "[reload]", 0.1, 0.5, false, true ) -RegisterCaption("MP7.Fire", "MP7", color_white, "[fire]", 0.1, 0.5, false, true ) -RegisterCaption("MP7.Reload", "MP7", color_white, "[reload]", 0.1, 0.5, false, true ) -RegisterCaption("Anaconda.Fire", "Anaconda", color_white, "[fire]", 0.1, 0.5, false, true ) -RegisterCaption("Anaconda.Reload", "Anaconda", color_white, "[reload]", 0.1, 0.5, false, true ) -RegisterCaption("Nambu.Fire", "Nambu", color_white, "[fire]", 0.1, 0.5, false, true ) -RegisterCaption("Nambu.Reload", "Nambu", color_white, "[reload]", 0.1, 0.5, false, true ) - -SOUNDS = {} - -function AddSound( name, path, sndlevel, pitch, volume, channel ) - SOUNDS[name] = { - path = path, - sndlevel = sndlevel or 70, - pitch = pitch or 100, - volume = volume or 1, - channel = channel or CHAN_STATIC, - } -end - -local screwup = SERVER and Color(150, 255, 255) or Color(255, 200, 150) - -function B_Sound( ent, tag ) - if !tag then return end - local tagt = SOUNDS[tag] - if !tagt then MsgC( screwup, "Invalid sound " .. tag .. "\n" ) return end - local path, sndlevel, pitch, volume, channel = tagt.path, tagt.sndlevel, tagt.pitch, tagt.volume, tagt.channel - if istable( path ) then - path = path[math.Round(util.SharedRandom( "B_Sound", 1, #path ))] - end - ent:EmitSound( path, sndlevel, pitch, volume, channel ) - if CLIENT and IsFirstTimePredicted() then - if CAPTIONS[tag] then - local capt = CAPTIONS[tag] - AddCaption( capt.Name, capt.Color, capt.Text, capt.TypeTime, capt.LifeTime ) - else - MsgC( screwup, "No caption defined for " .. tag .. "\n" ) - end - end -end - -RegisterCaption("Common.Deploy", "DEBUG", color_white, "[deploy]", 0.1, 0.5, false, true ) -RegisterCaption("Common.Holster", "DEBUG", color_white, "[holster]", 0.1, 0.5, false, true ) -RegisterCaption("Common.ReloadFail", "DEBUG", color_white, "[fail]", 0.1, 0.5, false, true ) - -CAPTIONS = CAPTIONS["en-us"] \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/commons/sh_commons.lua b/gamemodes/benny/gamemode/modules/commons/sh_commons.lua deleted file mode 100644 index 55c2f41..0000000 --- a/gamemodes/benny/gamemode/modules/commons/sh_commons.lua +++ /dev/null @@ -1,10 +0,0 @@ - -local UUID_chars = "0123456789ABCDEF" - -function UUID_generate() - local str = "" - for i=1, 8 do - str = str .. UUID_chars[ math.random( 1, #UUID_chars ) ] - end - return str -end \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/commons/sh_convars.lua b/gamemodes/benny/gamemode/modules/commons/sh_convars.lua deleted file mode 100644 index 5147063..0000000 --- a/gamemodes/benny/gamemode/modules/commons/sh_convars.lua +++ /dev/null @@ -1,95 +0,0 @@ - --- Meanings: Default, Min, Max, Replicated, Archived, Hint --- Replicated is Userinfo in Client. - -CONVARS_SV = {} - -CONVARS_SV["cam_override"] = { "", nil, nil, true, false, "X Y Z P Y R FOV" } -CONVARS_SV["cam_unlock"] = { 0, 0, 1, true, false, "First person (sort of)" } - -CONVARS_SV["net_easyway"] = { 0, 0, 1, true, false, "Use a disgusting way of networking inventories for minimal desync." } - -CONVARS_SV["cheat_infiniteammo"] = { 0, 0, 1, true, false, "Cheat: Don't expend ammo." } - -CONVARS_SV["tempchar"] = { "benny", nil, nil, true, false, "Temporary character." } - - -CONVARS_SV_GEN = {} -for i, v in pairs( CONVARS_SV ) do - CONVARS_SV_GEN[i] = CreateConVar( "benny_" .. i, v[1], (v[4] and FCVAR_REPLICATED or 0) + (v[5] and FCVAR_ARCHIVE or 0), v[6], v[2], v[3] ) -end - -function ConVarSV( name ) - return CONVARS_SV_GEN[name] -end - -function ConVarSV_Bool( name ) - return ConVarSV( name ):GetBool() -end - -function ConVarSV_String( name ) - return ConVarSV( name ):GetString() -end - -function ConVarSV_Int( name ) - return ConVarSV( name ):GetInt() -end - -function ConVarSV_Float( name ) - return ConVarSV( name ):GetFloat() -end - -if CLIENT then -- CL CL CL - -CONVARS_CL = {} - -CONVARS_CL["lang"] = { "en-us", nil, nil, false, true, "Active language" } - -CONVARS_CL["hud_scale"] = { 2, 1, 4, false, true, "HUD integer scaling" } -CONVARS_CL["hud_tempactive"] = { "benny", nil, nil, false, true, "HUD color scheme temporary" } - -CONVARS_CL["hud_enable_health"] = { 1, nil, nil, false, true, "Draw Health panel" } -CONVARS_CL["hud_enable_hotbar"] = { 1, nil, nil, false, true, "Draw Hotbar panel" } -CONVARS_CL["hud_enable_active"] = { 1, nil, nil, false, true, "Draw Active Weapons panel" } -CONVARS_CL["hud_enable_hints"] = { 1, nil, nil, false, true, "Draw Hints panel" } - -CONVARS_CL["wep_toggleaim"] = { 1, 0, 1, true, true, "Hold or toggle to aim weapon." } -CONVARS_CL["wep_ao_firearms"] = { 1, 0, 1, true, true, "Whether offhand firearms overrides primary attack." } -CONVARS_CL["wep_ao_grenades"] = { 0, 0, 1, true, true, "Whether offhand grenades overrides primary attack." } -CONVARS_CL["wep_ao_junk"] = { 0, 0, 1, true, true, "Whether offhand junk overrides primary attack." } - -CONVARS_CL["wep_toolgun"] = { "", nil, nil, true, true, "Toolgun tool." } - -CONVARS_CL["cam_override"] = { "", nil, nil, false, true, "Override camera" } -CONVARS_CL["cam_unlock"] = { 0, 0, 1, false, false, "Unlock camera" } - - -CONVARS_CL["bind2_reload"] = { KEY_R, nil, nil, true, true, "Bind for Reload" } -CONVARS_CL["bind2_reloada"] = { KEY_T, nil, nil, true, true, "Bind for ReloadAlt" } - -CONVARS_CL_GEN = {} -for i, v in pairs( CONVARS_CL ) do - CONVARS_CL_GEN[i] = CreateConVar( "benny_" .. i, v[1], (v[4] and FCVAR_USERINFO or 0) + (v[5] and FCVAR_ARCHIVE or 0), v[6], v[2], v[3] ) -end - -function ConVarCL( name ) - return CONVARS_CL_GEN[name] -end - -function ConVarCL_Bool( name ) - return ConVarCL( name ):GetBool() -end - -function ConVarCL_String( name ) - return ConVarCL( name ):GetString() -end - -function ConVarCL_Int( name ) - return ConVarCL( name ):GetInt() -end - -function ConVarCL_Float( name ) - return ConVarCL( name ):GetFloat() -end - -end -- CL end CL end CL end diff --git a/gamemodes/benny/gamemode/modules/gui/cl_deadeye.lua b/gamemodes/benny/gamemode/modules/gui/cl_deadeye.lua deleted file mode 100644 index d888f22..0000000 --- a/gamemodes/benny/gamemode/modules/gui/cl_deadeye.lua +++ /dev/null @@ -1,416 +0,0 @@ - --- Deadeye Choreographer - -local function QUICKDIRT( self, w, h, no_bg ) - if !no_bg then - local r, g, b = schemes["benny"]["bg"]:Unpack() - surface.SetDrawColor( r, g, b, 200 ) - surface.DrawRect( 0, 0, w, h ) - end - - surface.SetDrawColor( schemes["benny"]["fg"] ) - surface.DrawOutlinedRect( 0, 0, w, h, 1 ) -end -local function QUICKEARTH( self, w, h ) - local r, g, b = schemes["benny"]["fg"]:Unpack() - surface.SetDrawColor( r, g, b, 200 ) - surface.DrawRect( 0, 0, w, h ) -end -local function QUICKNIL( self, w, h ) -end - -local FIRST = { - "left_lowerer", - "left_outer_raiser", - "left_inner_raiser", - "left_cheek_puffer", - "left_cheek_raiser", - "left_lid_closer", - "left_lid_droop", - "left_lid_raiser", - "left_lid_tightener", - "left_mouth_drop", - "left_upper_raiser", - "left_dimpler", - "left_funneler", - "left_part", - "left_puckerer", - "left_stretcher", - "left_corner_depressor", - "left_corner_puller", -} - -local SECOND = { - "jaw_clencher", - "jaw_drop", - "jaw_sideways", - - "lip_bite", - "lower_lip", - "presser", - "tightener", - "wrinkler", - "dilator", - - "bite", - "blink", - "half_closed", - "chin_raiser", - "mouth_sideways", - "sneer_left", - - "body_rightleft", - "chest_rightleft", - "eyes_rightleft", - "eyes_updown", - "gesture_rightleft", - "gesture_updown", - "head_forwardback", - "head_rightleft", - "head_tilt", - "head_updown", -} - -local SIDE_L = { - ["left_cheek_puffer"] = "right_cheek_puffer", - ["left_cheek_raiser"] = "right_cheek_raiser", - ["left_corner_depressor"] = "right_corner_depressor", - ["left_corner_puller"] = "right_corner_puller", - ["left_lid_closer"] = "right_lid_closer", - ["left_lid_droop"] = "right_lid_droop", - ["left_lid_raiser"] = "right_lid_raiser", - ["left_lid_tightener"] = "right_lid_tightener", - ["left_upper_raiser"] = "right_upper_raiser", - ["left_outer_raiser"] = "right_outer_raiser", - ["left_inner_raiser"] = "right_inner_raiser", - ["left_mouth_drop"] = "right_mouth_drop", - ["left_dimpler"] = "right_dimpler", - ["left_funneler"] = "right_funneler", - ["left_part"] = "right_part", - ["left_puckerer"] = "right_puckerer", - ["left_stretcher"] = "right_stretcher", - ["left_lowerer"] = "right_lowerer", -} - -local SIDE_R = { - ["right_cheek_puffer"] = "left_cheek_puffer", - ["right_cheek_raiser"] = "left_cheek_raiser", - ["right_corner_depressor"] = "left_corner_depressor", - ["right_corner_puller"] = "left_corner_puller", - ["right_lid_closer"] = "left_lid_closer", - ["right_lid_droop"] = "left_lid_droop", - ["right_lid_raiser"] = "left_lid_raiser", - ["right_lid_tightener"] = "left_lid_tightener", - ["right_upper_raiser"] = "left_upper_raiser", - ["right_outer_raiser"] = "left_outer_raiser", - ["right_inner_raiser"] = "left_inner_raiser", - ["right_mouth_drop"] = "left_mouth_drop", - ["right_dimpler"] = "left_dimpler", - ["right_funneler"] = "left_funneler", - ["right_part"] = "left_part", - ["right_puckerer"] = "left_puckerer", - ["right_stretcher"] = "left_stretcher", - ["right_lowerer"] = "left_lowerer", -} - -local PRETTY = { - ["left_outer_raiser"] = "Brow Outer Raiser", - ["left_inner_raiser"] = "Brow Inner Raiser", - ["left_lowerer"] = "Brow Lowerer", - ["left_cheek_puffer"] = "Cheek Puffer", - ["left_cheek_raiser"] = "Cheek Raiser", - ["left_lid_closer"] = "Lid Closer", - ["left_lid_droop"] = "Lid Droop", - ["left_lid_raiser"] = "Lid Raiser", - ["left_lid_tightener"] = "Lid Tightener", - ["left_mouth_drop"] = "Mouth Drop", - ["left_upper_raiser"] = "Lip Upper Raiser", - ["left_dimpler"] = "Lip Dimpler", - ["left_funneler"] = "Lip Funneler", - ["left_part"] = "Lip Part", - ["left_puckerer"] = "Lip Puckerer", - ["left_stretcher"] = "Lip Stretcher", - ["left_corner_depressor"] = "Lip Corner Depr.", - ["left_corner_puller"] = "Lip Corner Puller", - - ["right_outer_raiser"] = "Brow Outer Raiser", - ["right_inner_raiser"] = "Brow Inner Raiser", - ["right_lowerer"] = "Brow Lowerer", - ["right_cheek_puffer"] = "Cheek Puffer", - ["right_cheek_raiser"] = "Cheek Raiser", - ["right_lid_closer"] = "Lid Closer", - ["right_lid_droop"] = "Lid Droop", - ["right_lid_raiser"] = "Lid Raiser", - ["right_lid_tightener"] = "Lid Tightener", - ["right_mouth_drop"] = "Mouth Drop", - ["right_upper_raiser"] = "Lip Upper Raiser", - ["right_dimpler"] = "Lip Dimpler", - ["right_funneler"] = "Lip Funneler", - ["right_part"] = "Lip Part", - ["right_puckerer"] = "Lip Puckerer", - ["right_stretcher"] = "Lip Stretcher", - ["right_corner_depressor"] = "Lip Corner Depr.", - ["right_corner_puller"] = "Lip Corner Puller", - - ["jaw_clencher"] = "Jaw Clencher", - ["jaw_drop"] = "Jaw Drop", - ["jaw_sideways"] = "Jaw Sideways", - - ["lip_bite"] = "Lip Bite", - ["lower_lip"] = "Lip Lower Depr.", - ["presser"] = "Lip Presser", - ["tightener"] = "Lip Tightener", - ["wrinkler"] = "Nose Wrinkler", - ["dilator"] = "Nose Dilator", - - ["bite"] = "Bite", - ["blink"] = "Blink", - ["half_closed"] = "Half Closed", - ["chin_raiser"] = "Chin Raiser", - ["mouth_sideways"] = "Mouth Sideways", - ["sneer_left"] = "Sneer Left", - - ["body_rightleft"] = "Body Rightleft", - ["chest_rightleft"] = "Chest Rightleft", - ["eyes_rightleft"] = "Eyes Rightleft", - ["eyes_updown"] = "Eyes Updown", - ["gesture_rightleft"] = "Gesture Rightleft", - ["gesture_updown"] = "Gesture Updown", - ["head_forwardback"] = "Head Forwardback", - ["head_rightleft"] = "Head Rightleft", - ["head_tilt"] = "Head Tilt", - ["head_updown"] = "Head Updown", -} - -local function makeme( id, parent, ent, no_dock ) - local SLIDER = parent:Add( "DNumSlider" ) - SLIDER:SetText( PRETTY[ ent:GetFlexName( id ) ] or ent:GetFlexName( id ) ) - local min, max = ent:GetFlexBounds( id ) - SLIDER:SetMin( min ) - SLIDER:SetMax( max ) - SLIDER:SetDecimals( 2 ) - SLIDER:SetTall( 18 ) - if !no_dock then - SLIDER:Dock( TOP ) - SLIDER:DockMargin( 10, 0, 10, 0 ) - end - - SLIDER.Label:SetWide( 90 ) - function SLIDER:PerformLayout() return end - - function SLIDER:OnValueChanged( val ) - if !DEADEYE_MEM.Flex then DEADEYE_MEM.Flex = {} end - DEADEYE_MEM.Flex[ ent:GetFlexName( id ) ] = val - end - - function SLIDER:Think() - if DEADEYE_MEM.Flex then - self:SetValue( DEADEYE_MEM.Flex[ ent:GetFlexName( id ) ] ) - end - end - return SLIDER -end - -DEADEYE_MEM = DEADEYE_MEM or {} - -function OpenDeadeye() - if IsValid( GOD ) then GOD:Remove() end - GOD = vgui.Create( "DFrame" ) - - GOD:SetTitle( "Deadeye Choreographer" ) - GOD:SetSize( ScrW()*0.9, ScrH()*0.9 ) - GOD:Center() - GOD:MakePopup() - GOD:SetSizable( true ) - GOD.Paint = QUICKDIRT - - do -- Menubar - local MENUBAR = GOD:Add( "DMenuBar" ) - MENUBAR:Dock( TOP ) - MENUBAR:DockMargin( -5, -5, -5, 8 ) - MENUBAR.Paint = QUICKDIRT - - local MENU_FILE = MENUBAR:AddMenu( "File" ) - MENU_FILE:AddOption( "New", function() table.Empty( DEADEYE_MEM ) OpenDeadeye() end ) - MENU_FILE:AddOption( "Open", function() end ) - local MENU_EDIT = MENUBAR:AddMenu( "Edit" ) - local MENU_ABOUT = MENUBAR:AddMenu( "About" ) - end - - local NAME = { - "X", - "Y", - "Z", - "P", - "Y", - "R", - } - - do -- Main - local MAIN = GOD:Add( "DPanel" ) - MAIN:Dock( FILL ) - MAIN.Paint = QUICKNIL - - local SIDE_MODEL = MAIN:Add( "DPanel" ) - SIDE_MODEL.Paint = QUICKNIL - local SIDE_CHOREO = MAIN:Add( "DPanel" ) - SIDE_CHOREO.Paint = QUICKDIRT - - local SIDEDIV = MAIN:Add( "DVerticalDivider" ) - SIDEDIV:Dock( FILL ) - SIDEDIV:SetTop( SIDE_MODEL ) - SIDEDIV:SetBottom( SIDE_CHOREO ) - SIDEDIV:SetDividerHeight( 8 ) - SIDEDIV:SetTopMin( 20 ) - SIDEDIV:SetBottomMin( 240 ) - SIDEDIV:SetTopHeight( 500 ) - - do -- Model side (top) - local MODEL = SIDE_MODEL:Add( "DAdjustableModelPanel" ) - MODEL:SetFOV( 30 ) - MODEL:SetModel( "models/alyx.mdl" ) - MODEL:SetLookAng( Angle( 0, 180, 0 ) ) - MODEL:SetCamPos( Vector( 64, 0, 64 ) ) - function MODEL:LayoutEntity( Entity ) - if DEADEYE_MEM.Flex then - for i=0, Entity:GetFlexNum()-1 do - if !DEADEYE_MEM.Flex[ Entity:GetFlexName( i ) ] then continue end - Entity:SetFlexWeight( i, DEADEYE_MEM.Flex[ Entity:GetFlexName( i ) ] ) - end - else - DEADEYE_MEM.Flex = {} - for i=0, Entity:GetFlexNum()-1 do - DEADEYE_MEM.Flex[ Entity:GetFlexName( i ) ] = 0--Entity:GetFlexWeight( i ) - end - end - self.Entity:SetEyeTarget( self:GetCamPos() ) - return - end - - function MODEL:PaintOver( w, h ) - QUICKDIRT( self, w, h, true ) - - local fuckp, fucka = MODEL:GetCamPos(), MODEL:GetLookAng() - local PX, PY, PZ, AP, AY, AR = fuckp.x, fuckp.y, fuckp.z, fucka.p, fucka.y, fucka.r - PX, PY, PZ, AP, AY, AR = math.Round( PX ), math.Round( PY ), math.Round( PZ ), math.Round( AP ), math.Round( AY ), math.Round( AR ) - draw.SimpleText( "pos: " .. PX .. " " .. PY .. " " .. PZ, "Trebuchet24", 8, 4, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) - draw.SimpleText( "ang: " .. AP .. " " .. AY .. " " .. AR, "Trebuchet24", 8, 4+24, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) - draw.SimpleText( "fov: " .. math.Round( MODEL:GetFOV() ), "Trebuchet24", 8, 4+48, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) - end - - local MODELPSHEET = SIDE_MODEL:Add( "DPropertySheet" ) - MODELPSHEET.Paint = QUICKDIRT - - local MODELSETTINGS = SIDE_MODEL:Add( "DScrollPanel" ) - MODELSETTINGS.Paint = QUICKDIRT - - MODELPSHEET:AddSheet( "Actor Alyx", MODELSETTINGS ) - - local flexlist = {} - for i=0, MODEL.Entity:GetFlexNum()-1 do -- Model settings - flexlist[MODEL.Entity:GetFlexName( i )] = true - end - - local madelist = {} - - - local MARKF = MODELSETTINGS:Add( "DHorizontalDivider" ) - MARKF:Dock( TOP ) - MARKF:DockMargin( 130, 0, -140, 0 ) - MARKF:SetDividerWidth( 0 ) - local LABELR = MODELSETTINGS:Add("DLabel") - LABELR:SetText( "Right" ) - local LABELL = MODELSETTINGS:Add("DLabel") - LABELL:SetText( "Left" ) - MARKF:SetLeft( LABELR ) - MARKF:SetRight( LABELL ) - local old = MARKF.PerformLayout - function MARKF:PerformLayout( w, h ) - self:SetLeftWidth( w / 2 ) - old( self, w, h ) - end - - for v, i in ipairs( FIRST ) do - local MARK = MODELSETTINGS:Add( "DHorizontalDivider" ) - MARK:Dock( TOP ) - MARK:DockMargin( 10, -4, 10, -4 ) - MARK:SetDividerWidth( 0 ) - - local SLIDERA = makeme( MODEL.Entity:GetFlexIDByName( SIDE_L[i] ), MODELSETTINGS, MODEL.Entity, true ) - local SLIDERB = makeme( MODEL.Entity:GetFlexIDByName( i ), MODELSETTINGS, MODEL.Entity, true ) - madelist[SIDE_L[i]] = true - madelist[i] = true - MARK:SetLeft( SLIDERA ) - MARK:SetRight( SLIDERB ) - local old = MARK.PerformLayout - function MARK:PerformLayout( w, h ) - self:SetLeftWidth( w / 2 ) - old( self, w, h ) - end - end - - for v, i in SortedPairs( SECOND ) do - if !madelist[i] then - local id = MODEL.Entity:GetFlexIDByName( i ) - makeme( id, MODELSETTINGS, MODEL.Entity ) - madelist[i] = true - end - end - - for i, v in SortedPairs( flexlist ) do - if !madelist[i] then - local id = MODEL.Entity:GetFlexIDByName( i ) - makeme( id, MODELSETTINGS, MODEL.Entity ) - madelist[i] = true - end - end - - local DIVIDER = SIDE_MODEL:Add( "DHorizontalDivider" ) - DIVIDER:Dock( FILL ) - DIVIDER:SetLeft( MODEL ) - DIVIDER:SetRight( MODELPSHEET ) - DIVIDER:SetDividerWidth( 8 ) - DIVIDER:SetLeftMin( 20 ) - DIVIDER:SetRightMin( 240 ) - DIVIDER:SetLeftWidth( 800 ) - end - - do -- Choreo side (bottom) - local PLAY = SIDE_CHOREO:Add( "DButton" ) - PLAY:SetPos( 4, 4 ) - PLAY:SetSize( 80, 20 ) - PLAY:SetText( "Play/Pause" ) - PLAY.Paint = QUICKDIRT - - local SPEED = SIDE_CHOREO:Add( "DNumSlider" ) - SPEED:SetPos( 4+4+80, 4 ) - SPEED:SetSize( 180, 20 ) - SPEED:SetText( "Speed" ) - SPEED.Label:SetWide( 0 ) - function SPEED:PerformLayout() - return true - end - SPEED:SetMin( 0 ) - SPEED:SetMax( 100 ) - SPEED:SetValue( 100 ) - SPEED:SetDecimals( 0 ) - SPEED.Paint = QUICKDIRT - - do - local BLINKY = SIDE_CHOREO:Add( "DPanel" ) - BLINKY:SetPos( 4, 4+4+20 ) - BLINKY.Paint = QUICKDIRT - function BLINKY:PerformLayout( w, h ) - local par = SIDE_CHOREO - BLINKY:SetSize( par:GetWide() - 8, par:GetTall() - 20 - 12 ) - end - end - end - end -end - -if IsValid( GOD ) then OpenDeadeye() end - -concommand.Add("benny_ui_deadeye", function() - OpenDeadeye() -end) \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/gui/cl_debuginv.lua b/gamemodes/benny/gamemode/modules/gui/cl_debuginv.lua deleted file mode 100644 index a98916c..0000000 --- a/gamemodes/benny/gamemode/modules/gui/cl_debuginv.lua +++ /dev/null @@ -1,189 +0,0 @@ - --- Dev inventory - -local function regen_items( itemlist ) - local ply = LocalPlayer() - local inv = ply:INV_Get() - local active = GetConVar("benny_hud_tempactive"):GetString() - itemlist:Clear() - - local maidlist = {} - local catesmade = {} - - for i, v in pairs( ply:INV_ListFromBuckets() ) do - local class = inv[v].Class - local Class = ITEMS[class] - - if !catesmade[Class.Category] then - catesmade[Class.Category] = true - local cate = vgui.Create( "DButton" ) - itemlist:AddItem( cate ) - cate:SetSize( 1, ss(12) ) - cate:Dock( TOP ) - cate:DockMargin( 0, 0, 0, ss(2) ) - - cate.Text_Name = Class.Category - - function cate:Paint( w, h ) - surface.SetDrawColor( schemes[active]["bg"] ) - surface.DrawRect( 0, 0, w, h ) - surface.SetDrawColor( schemes[active]["fg"] ) - surface.DrawOutlinedRect( 0, 0, w, h, ss(0.5) ) - - surface.SetTextColor( schemes[active]["fg"] ) - surface.SetFont( "Benny_10" ) - surface.SetTextPos( ss(2), ss(2) ) - surface.DrawText( self.Text_Name ) - - return true - end - end - - local button = vgui.Create( "DButton" ) - itemlist:AddItem( button ) - button:SetSize( 1, ss(24) ) - button:Dock( TOP ) - button:DockMargin( 0, 0, 0, ss(2) ) - - button.ID = v - - local mag = false - if class:Left( 4 ) == "mag_" then - mag = true - button:SetTall( ss(11) ) - end - - if !maidlist[class] then - maidlist[class] = table.Flip( ply:INV_Find( class ) ) - end - local ml = maidlist[class] - - button.Text_Name = Class.Name - button.Text_Desc = Class.Description - button.Text_ID = "[" .. ml[v] .. "] " .. button.ID - - -- PROTO: These functions don't need to be remade over and over like this. - function button:DoClick() - do return end - local Menu = DermaMenu() - - local opt1 = Menu:AddOption( "Equip Right", function() - RunConsoleCommand( "benny_inv_equip", button.ID, "false" ) - end) - opt1:SetIcon( "icon16/resultset_last.png" ) - - local opt3 = Menu:AddOption( "Equip Right, Move Left", function() - RunConsoleCommand( "benny_inv_equip", button.ID, "false", "true" ) - end) - opt3:SetIcon( "icon16/resultset_next.png" ) - - Menu:AddSpacer() - - local opt2 = Menu:AddOption( "Equip Left", function() - RunConsoleCommand( "benny_inv_equip", button.ID, "true" ) - end) - opt2:SetIcon( "icon16/resultset_first.png" ) - - local opt4 = Menu:AddOption( "Equip Left, Move Right", function() - RunConsoleCommand( "benny_inv_equip", button.ID, "true", "true" ) - end) - opt4:SetIcon( "icon16/resultset_previous.png" ) - - Menu:AddSpacer() - - local opt5 = Menu:AddOption( "Holster", function() - RunConsoleCommand( "benny_inv_holster", button.ID ) - end) - opt5:SetIcon( "icon16/control_pause_blue.png" ) - - local opt6 = Menu:AddOption( "Discard", function() - RunConsoleCommand("benny_inv_discard", button.ID) - self:Remove() - end) - opt6:SetIcon( "icon16/bin.png" ) - - Menu:Open() - -- timer.Simple( 0.1, function() if IsValid( itemlist ) then regen_items( itemlist ) end end ) - end - - button.DoRightClick = function( self ) - do return end - RunConsoleCommand("benny_inv_discard", button.ID) - self:Remove() - end - - function button:Paint( w, h ) - surface.SetDrawColor( schemes[active]["fg"] ) - surface.DrawRect( 0, 0, w, h ) - - surface.SetTextColor( schemes[active]["bg"] ) - - surface.SetFont( !mag and "Benny_16" or "Benny_10" ) - surface.SetTextPos( ss(2), ss(2) ) - surface.DrawText( self.Text_Name ) - - if !mag then - surface.SetFont( "Benny_12" ) - surface.SetTextPos( ss(2), ss(2 + 11) ) - surface.DrawText( self.Text_Desc ) - end - - local wep = ply:BennyCheck() - if wep then - local handed_r = wep:bGetInvID( false ) == v - local handed_l = wep:bGetInvID( true ) == v - if handed_r or handed_l then - draw.SimpleText( handed_l and "LEFT" or "RIGHT", "Benny_18", w/2, h/2 + ss(1), schema_c("bg"), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) - end - end - - surface.SetFont( "Benny_10" ) - local tx = surface.GetTextSize( self.Text_ID ) - surface.SetTextPos( w - ss(2) - tx, ss(2) ) - surface.DrawText( self.Text_ID ) - return true - end - - button.B = button:Add("DButton") - button.B:Dock( RIGHT ) - function button.B:DoClick() - button:Remove() - return RunConsoleCommand( "benny_inv_discard", button.ID ) - end - function button.B:Paint( w, h ) - surface.SetDrawColor( schema( "fg" ) ) - surface.DrawRect( 0, 0, w, h ) - - surface.SetDrawColor( schema( "bg" ) ) - surface.DrawOutlinedRect( 0, 0, w, h, ss(1) ) - draw.SimpleText( "DISCARD", "Benny_10", w/2, h/2 + ss(1), schema_c("bg"), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) - return true - end - button.B:DockMargin( ss(2), ss(2), ss(2), ss(2) ) - button.B:SetSize( ss(36), ss(24) ) - - function button:Think() - local visible = self.B:IsHovered() or self:IsHovered() - self.B:SetVisible( visible ) - end - end -end - -function OpenDebugInv() - if IsValid( base ) then base:Remove() return end - base = vgui.Create("BFrame") - base:SetSize( ss(400), ss(400) ) - base:SetTitle("Developer Inventory") - base:MakePopup() - base:SetKeyboardInputEnabled( false ) - base:Center() - - local itemlist = base:Add("DScrollPanel") - itemlist:Dock( FILL ) - - regen_items( itemlist ) -end - -concommand.Add("benny_ui_inv", function() - OpenDebugInv() -end) \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/gui/cl_inv.lua b/gamemodes/benny/gamemode/modules/gui/cl_inv.lua deleted file mode 100644 index 1120ad9..0000000 --- a/gamemodes/benny/gamemode/modules/gui/cl_inv.lua +++ /dev/null @@ -1,2 +0,0 @@ - --- Final inventory customizer for MP \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/gui/cl_mainmenu.lua b/gamemodes/benny/gamemode/modules/gui/cl_mainmenu.lua deleted file mode 100644 index 58a5083..0000000 --- a/gamemodes/benny/gamemode/modules/gui/cl_mainmenu.lua +++ /dev/null @@ -1,97 +0,0 @@ - --- Main menu - -local meow = { - "RESUME", - "", - "START GAME", - "LOAD GAME", - "", - "JOIN SERVER", - "START SERVER", - "", - "OPTIONS", - "QUIT", -} - -local function unimplemented() - if mb and mb:IsValid() then mb:Remove() end - mb = vgui.Create( "BFrame" ) - mb:SetSize( ss(160), ss(50) ) - mb:Center() - mb:MakePopup() - - mb:SetTitle( "Woops!" ) - - local oldpaint = mb.Paint - function mb:Paint( w, h ) - oldpaint( self, w, h ) - surface.SetDrawColor( schema("fg") ) - surface.DrawOutlinedRect( 0, 0, w, h, ss(1) ) - - draw.SimpleText( "That isn't implemented yet.", "Benny_12", w/2, ss(18), schema_c("fg"), TEXT_ALIGN_CENTER ) - end - - local okbutton = mb:Add("DButton") - okbutton:SetText("") - okbutton:SetSize( ss(30), ss(12) ) - okbutton:SetPos( mb:GetWide()/2 - okbutton:GetWide()/2, mb:GetTall() - okbutton:GetTall() - ss(6) ) - function okbutton:Paint( w, h ) - surface.SetDrawColor( schema("bg") ) - surface.DrawRect( 0, 0, w, h ) - surface.SetDrawColor( schema("fg") ) - surface.DrawOutlinedRect( 0, 0, w, h, ss(1) ) - draw.SimpleText( "OK", "Benny_10", w/2, ss(2), schema_c("fg"), TEXT_ALIGN_CENTER ) - end - function okbutton:DoClick() - mb:Remove() - end -end - -function CreateMainMenu() - if mm and mm:IsValid() then mm:Remove() end - mm = vgui.Create( "BFrame" ) - mm:SetSize( ScrW(), ScrH() ) - mm:Center() - mm:MakePopup() - mm:SetPopupStayAtBack( true ) - - mm:SetTitle("Main Menu") - - local oldpaint = mm.Paint - function mm:Paint( w, h ) - oldpaint( self, w, h ) - - draw.SimpleText( "YOUR", "Benny_48", ss(34), self:GetTall()/2 - ss(54 + (28*3)), schema_c("fg") ) - draw.SimpleText( "NAME", "Benny_48", ss(34), self:GetTall()/2 - ss(54 + (28*2)), schema_c("fg") ) - draw.SimpleText( "IS", "Benny_48", ss(34), self:GetTall()/2 - ss(54 + (28*1)), schema_c("fg") ) - draw.SimpleText( "BENNY", "Benny_72", ss(32), self:GetTall()/2 - ss(58 + (28*0)), schema_c("fg") ) - end - - local bump = -ss(32) - for i=#meow, 1, -1 do - local label = meow[i] - local spacer = label == "" - local button = mm:Add("DButton") - button:SetText("") - button:SetSize( ss(256), ss(spacer and 0 or 16) ) - button:SetPos( ss(32), mm:GetTall() + ss(bump) ) - function button:Paint( w, h ) - if !spacer then - surface.SetDrawColor( schema("bg") ) - surface.DrawRect( 0, 0, w, h ) - surface.SetDrawColor( schema("fg") ) - surface.DrawOutlinedRect( 0, 0, w, h, ss(0.5) ) - - draw.SimpleText( label, "Benny_16", ss(4+16), ss(2), schema_c("fg") ) - end - end - button.DoClick = unimplemented - bump = bump - (spacer and 12 or (16+4)) - end - -end - -concommand.Add("benny_ui_mainmenu", function() - CreateMainMenu() -end) \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/gui/cl_settings.lua b/gamemodes/benny/gamemode/modules/gui/cl_settings.lua deleted file mode 100644 index 03065c1..0000000 --- a/gamemodes/benny/gamemode/modules/gui/cl_settings.lua +++ /dev/null @@ -1,142 +0,0 @@ - --- Settings panel - --- 0 = checkbox, 1 = slider, 2 = string, 3 = binder -local conf = { - [1] = { - { 0, "benny_hud_enable_health", "Health", }, - { 0, "benny_hud_enable_active", "Active Weapon", }, - { 0, "benny_hud_enable_hints", "Hints", }, - { 0, "benny_hud_enable_hotbar", "Hotbar", }, - { 1, "benny_hud_scale", "Scale", 1, 4, 0 }, - }, - [2] = { - { 0, "benny_wep_ao_firearms", "Firearms Override Primary Attack" }, - { 2, "Like traditional akimbo, pressing Left Mouse will shoot an offhand firearm." }, - { 0, "benny_wep_ao_grenades", "Grenades Override Primary Attack" }, - { 2, "Pressing Left Mouse will throw an offhand grenade." }, - { 0, "benny_wep_ao_junk", "Junk Overrides Primary Attack" }, - { 2, "Pressing Left Mouse will throw offhand junk." }, - { 3, "benny_bind_reload", "Reload" }, - { 3, "benny_bind_reloada", "Reload Alt" }, - }, - [3] = { - { 4, function( Scroll ) - local Butt = Scroll:Add("DLabel") - Butt:Dock(TOP) - Butt:DockMargin( ss(24+4), 0, 0, 0 ) - Butt:SetText( "Character Appearance" ) - - local Down = Scroll:Add("DComboBox") - Down:Dock( TOP ) - Down:DockMargin( ss(24), 0, ss(24), ss(2) ) - Down:SetValue( ConVarSV_String("tempchar") ) - Down:AddChoice( "Benny", "benny" ) - Down:AddChoice( "Nikki", "nikki" ) - Down:AddChoice( "Igor", "igor" ) - Down:AddChoice( "Yang-Hao", "yanghao" ) - - Down:AddChoice( "z: CIA", "mp_cia" ) - Down:AddChoice( "z: PLASOF", "mp_plasof" ) - Down:AddChoice( "z: MILITIA", "mp_militia" ) - Down:AddChoice( "z: ARNG", "mp_natguard" ) - Down:AddChoice( "z: VIPER", "mp_viper" ) - Down:AddChoice( "z: HALO", "mp_halo" ) - - function Down:OnSelect( index, value, data ) - RunConsoleCommand( "benny_tempchar", data ) - RunConsoleCommand( "benny_hud_tempactive", data ) - end - end }, - - }, -} - -local function genpan( Base, Sect, Conf ) - local Scroll = Base:Add("DPanel") - Scroll:DockPadding( 10, 5, 10, 5 ) - Scroll.Paint = function() end - Sect:SetContents( Scroll ) - - for i, v in ipairs( Conf ) do - if v[1] == 0 then - local Butt = Scroll:Add("DCheckBoxLabel") - Butt:Dock(TOP) - Butt:DockMargin( 0, ss(2), 0, ss(2) ) - Butt:SetText( v[3] ) - Butt:SetConVar( v[2] ) - elseif v[1] == 1 then - local Butt = Scroll:Add("DNumSlider") - Butt:Dock(TOP) - Butt:DockMargin( 0, ss(2), 0, ss(2) ) - Butt:SetText( v[3] ) - Butt:SetConVar( v[2] ) - Butt:SetMin( v[4] ) - Butt:SetMax( v[5] ) - Butt:SetDecimals( v[6] ) - elseif v[1] == 2 then - local Butt = Scroll:Add("DLabel") - Butt:Dock(TOP) - Butt:DockMargin( ss(12), ss(-4), 0, 0 ) - Butt:SetText( v[2] ) - elseif v[1] == 3 then - local Butt = Scroll:Add("DLabel") - Butt:Dock(TOP) - Butt:DockMargin( ss(24+4), 0, 0, 0 ) - Butt:SetText( v[3] ) - - local Butt = Scroll:Add("DBinder") - Butt:Dock(TOP) - Butt:DockMargin( ss(24), 0, ss(24), ss(2) ) - Butt:SetText( v[2] ) - - function Butt:OnChange( num ) - RunConsoleCommand( v[2], num ) - end - elseif v[1] == 4 then - v[2]( Scroll ) - end - end -end - -function OpenSettingsMenu() - if IsValid( SettingsMenu ) then SettingsMenu:Remove() return end - local Base = vgui.Create("BFrame") - SettingsMenu = Base - Base:SetTitle("Settings") - Base:SetSize( ss(300), ss(300) ) - Base:Center() - Base:MakePopup() - Base:SetKeyboardInputEnabled( false ) - - do -- Sect 1 - local Sect = Base:Add("BCollapsibleCategory") - Sect:Dock(TOP) - Sect:DockMargin( 0, 0, 0, ss(2) ) - Sect:SetLabel("HUD") - - genpan( Base, Sect, conf[1] ) - end - - do -- Sect 2 - local Sect = Base:Add("BCollapsibleCategory") - Sect:Dock(TOP) - Sect:DockMargin( 0, 0, 0, ss(2) ) - Sect:SetLabel("Controls") - - genpan( Base, Sect, conf[2] ) - end - - do -- Sect 3 - local Sect = Base:Add("BCollapsibleCategory") - Sect:Dock(TOP) - Sect:DockMargin( 0, 0, 0, ss(2) ) - Sect:SetLabel("Preferences") - - genpan( Base, Sect, conf[3] ) - end -end - -concommand.Add("benny_ui_settings", function() - OpenSettingsMenu() -end) \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua b/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua deleted file mode 100644 index e79ddc7..0000000 --- a/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua +++ /dev/null @@ -1,530 +0,0 @@ - --- Dev spawnmenu - -function GM:OnSpawnMenuOpen() -end -function GM:OnSpawnMenuClose() -end - -local function yea() - return true -end - -local function rmt1( val, min, max ) - return math.Remap( val, min, max, 0, 1 ) -end - -local function rmt1c( val, min, max ) - return math.Clamp( rmt1( val, min, max, 0, 1 ), 0, 1 ) -end - -local mewer = { - { - Func = function( class ) - return class.PrintName - end, - Size = 18, - SizeMultiline = 18, - Font = "Benny_18", - }, - { - Func = function( class ) - return class.Description - end, - Size = 14, - SizeMultiline = 12, - Font = "Benny_12", - -- "How easily and quickly the weapon can take out a single target.\nDoes not consider armor penetration.\nAffected by Damage and RPM." - }, - { - Name = "Lethality", - Size = 12, - Font = "Benny_10", - Stat = function( class ) - local bwep = math.Clamp( math.Remap( BENNY_GetStat( class, "Damage" ) * ( BENNY_GetStat( class, "Pellets" ) or 1 ), 14, 80, 0, 1 ), 0, 1 ) - local meowzor = math.ease.OutQuart( bwep ) - return meowzor - end, - -- "How much the weapon's point of aim will move around.\nAffected by various Sway stats." - }, - { - Name = "Suppression", - Size = 12, - Font = "Benny_10", - Stat = function( class ) - local weight_1, weight_2 = 1, 3 - local totalscore = (weight_1 + weight_2) - weight_1, weight_2 = weight_1/totalscore, weight_2/totalscore - local score_1, score_2 = 1, 1 - - local truedelay = ( 1 / BENNY_GetStat( class, "Delay" ) ) - if BENNY_GetStat( class, "Firemodes" )[1].Mode == 1 then - truedelay = math.min( truedelay, 60/300 ) - end - score_1 = rmt1c( BENNY_GetStat( class, "Damage" ) * truedelay, 100, 350 ) - score_1 = score_1 * weight_1 - - score_2 = rmt1c( BENNY_GetStat( class, "AmmoStd" ), 16, 42 ) - score_2 = score_2 * weight_2 - - return score_1 + score_2 - end, - -- "How much damage the weapon can output over a long period of time.\nDoes not consider armor penetration.\nAffected by Damage, RPM, Capacity and Reload Time." - }, - -- - -- Name = "Range", - -- Size = 12, - -- Font = "Benny_10", - -- Stat = function( class ) - -- return 0 - -- end, - -- -- "How well the weapon gains or loses damage over long distances.\nAffected by Minimum Range, Maximum Range, and damage falloff." - -- }, - { - Name = "Precision", - Size = 12, - Font = "Benny_10", - Stat = function( class ) - return math.Clamp( math.Remap( BENNY_GetStat( class, "Spread" ), 1/60, 2, 1, 0 ), 0, 1 ) - end, - -- "How accurate the weapon is when firing single shots or short bursts.\nAffected by Spread and various Recoil stats." - }, - { - Name = "Control", - Size = 12, - Font = "Benny_10", - Stat = function( class ) - return math.Clamp( math.Remap( BENNY_GetStat( class, "SpreadAdd" ) * ( 1 / BENNY_GetStat( class, "Delay" ) ), 1, 13, 1, 0 ), 0, 1 ) - end, - -- "How managable the weapon's recoil and spread is under sustained fire.\nAffected by RPM and various Recoil stats." - }, - -- { - -- Name = "Handling", - -- Size = 12, - -- Font = "Benny_10", - -- Stat = function( class ) - -- return 0 - -- end, - -- -- "How quickly this weapon readies from sprinting, aiming and deploying.\nAffected by Aim Down Sights Time, Sprint To Fire Time, and Deploy Time." - -- }, - --{ - -- Name = "Maneuvering", - -- Size = 12, - -- Font = "Benny_10", - -- Stat = function( class ) - -- return 0 - -- end, - -- -- "How accurate the weapon is while not aiming.\nAffected by Hipfire Spread, Mid-air Spread, Sway, and Free Aim Angle." - --}, - { - Name = "Mobility", - Size = 12, - Font = "Benny_10", - Stat = function( class ) - local weight_moving, weight_aiming, weight_reloading, weight_firing = 5, 5, 2, 1 - local totalscore = (weight_moving + weight_aiming + weight_reloading + weight_firing) - weight_moving, weight_aiming, weight_reloading, weight_firing = weight_moving/totalscore, weight_aiming/totalscore, weight_reloading/totalscore, weight_firing/totalscore - - local score_moving, score_aiming, score_reloading, score_firing = 1, 1, 1, 1 - - score_moving = rmt1c( BENNY_GetStat( class, "Speed_Move" ), 0.8, 1 ) - score_moving = score_moving * weight_moving - - score_aiming = rmt1c( BENNY_GetStat( class, "Speed_Aiming" ), 0.8, .98 ) - score_aiming = score_aiming * weight_aiming - - score_reloading = rmt1c( BENNY_GetStat( class, "Speed_Reloading" ), 0.75, 0.95 ) - score_reloading = score_reloading * weight_reloading - - score_firing = rmt1c( BENNY_GetStat( class, "Speed_Firing" ), 0.75, 0.95 ) - score_firing = score_firing * weight_firing - - return score_moving + score_aiming + score_reloading + score_firing - end, - -- "How fast the user can move while using this weapon.\nAffected by various Speed stats." - }, - -- { - -- Name = "Stability", - -- Size = 12, - -- Font = "Benny_10", - -- Stat = function( class ) - -- return 0 - -- end, - -- "How much the weapon's point of aim will move around.\nAffected by various Sway stats."- }, -} - -local function multlinetext(text, maxw, font) - local content = {} - local tline = "" - local x = 0 - surface.SetFont(font) - - local newlined = string.Split(text, "\n") - - for _, line in pairs(newlined) do - local words = string.Split(line, " ") - - for _, word in pairs(words) do - local tx = surface.GetTextSize(word) - - if x + tx >= maxw then - table.insert(content, tline) - tline = "" - x = surface.GetTextSize(word) - end - - tline = tline .. word .. " " - - x = x + surface.GetTextSize(word .. " ") - end - - table.insert(content, tline) - tline = "" - x = 0 - end - - return content -end - -local h_F, s_F, v_F = 224, 0.00, 0.40 -local h_D, s_D, v_D = 180, 0.40, 0.40 -local h_C, s_C, v_C = 140, 0.40, 0.50 -local h_B, s_B, v_B = 40, 0.60, 0.90 -local h_A, s_A, v_A = 24, 0.70, 0.90 -local h_S, s_S, v_S = 0, 0.75, 0.90 - -local function rank( perc ) - local letter - local color - if perc <= 1/10 then - letter = "F" - color = HSVToColor( - h_F, - s_F, - v_F - ) - elseif perc <= 3/10 then - letter = "D" - color = HSVToColor( - h_D, - s_D, - v_D - ) - elseif perc <= 5/10 then - letter = "C" - color = HSVToColor( - h_C, - s_C, - v_C - ) - elseif perc <= 7/10 then - letter = "B" - color = HSVToColor( - h_B, - s_B, - v_B - ) - elseif perc <= 9/10 then - letter = "A" - color = HSVToColor( - h_A, - s_A, - v_A - ) - elseif perc <= 1 then - letter = "S" - color = HSVToColor( - h_S, - s_S, - v_S - ) - end - return letter, color -end - -function OpenSMenu() - if IsValid( smenu ) then smenu:Remove() return end - local active = GetConVar("benny_hud_tempactive"):GetString() - smenu = vgui.Create("BFrame") - smenu:SetSize( ss(350), ss(360) ) - smenu:SetTitle("Developer Spawnmenu") - smenu:MakePopup() - smenu:SetKeyboardInputEnabled( false ) - smenu:Center() - - local itemlist = smenu:Add("DScrollPanel") - itemlist:Dock( FILL ) - smenu:Center() - - itemlist:GetVBar():SetWide( 0 ) - - local statlist = smenu:Add("DPanel") - statlist:SetWide( ss(220) ) - statlist:Dock( RIGHT ) - statlist:DockMargin( ss(2), 0, 0, 0 ) - statlist:DockPadding( ss(2), ss(2), ss(2), ss(2) ) - function statlist:Paint( w, h ) - surface.SetDrawColor( schema("fg") ) - surface.DrawOutlinedRect( 0, 0, w, h, ss(0.5) ) - end - - -- PROTO: Do regen stats. - do - local BAR_NAME = statlist:Add( "DLabel" ) - BAR_NAME:SetTall( ss(18) ) - BAR_NAME:Dock( TOP ) - BAR_NAME:DockMargin( 0, 0, 0, ss(2) ) - function BAR_NAME:Paint( w, h ) - surface.SetDrawColor( schema("fg") ) - surface.DrawRect( 0, 0, w, h ) - - if pan_active then - local rang = ITEMS[ pan_active ] - draw.SimpleText( l8(rang.PrintName), "Benny_18", ss(2), ss(2), schema_c("bg") ) - end - return true - end - end - - do - local BAR_DESC = statlist:Add( "DLabel" ) - BAR_DESC:SetTall( ss(18) ) - BAR_DESC:Dock( TOP ) - BAR_DESC:DockMargin( 0, 0, 0, ss(2) ) - local lastheight = 0 - function BAR_DESC:Paint( w, h ) - surface.SetDrawColor( schema("fg") ) - surface.DrawRect( 0, 0, w, h ) - - if pan_active then - local rang = ITEMS[ pan_active ] - local multiline = multlinetext( l8(rang.Description) or "No description", w-ss(2), "Benny_12" ) - for i, v in ipairs( multiline ) do - local line = i-1 - local height = ss( 14 + (#multiline-1)*12 ) - if lastheight != height then - BAR_DESC:SetTall( height ) - lastheight = height - end - draw.SimpleText( v, "Benny_12", ss(2), ss(2+12*line), schema_c("bg") ) - end - end - - return true - end - end - - for i, us in ipairs( mewer ) do - do continue end - local fucker = statlist:Add( "DLabel" ) - fucker:SetTall( ss(us.Size) ) - fucker:Dock( TOP ) - fucker:DockMargin( 0, 0, 0, ss(2) ) - local lastheight = 0 - function fucker:Paint( w, h ) - - if us.Stat then - surface.SetDrawColor( schema("fg") ) - surface.DrawOutlinedRect( 0, 0, w, h, ss(0.5) ) - else - surface.SetDrawColor( schema("fg") ) - surface.DrawRect( 0, 0, w, h ) - end - - local rang = ITEMS[ pan_active ] - if rang then - if us.SizeMultiline then - local multiline = multlinetext( l8( us.Func and us.Func( rang ) or us.PrintName ), w-ss(2), us.Font ) - for i, v in ipairs( multiline ) do - local line = i-1 - local height = ss( us.Size + ((#multiline-1)*us.SizeMultiline) ) - if lastheight != height then - fucker:SetTall( height ) - lastheight = height - end - draw.SimpleText( v, us.Font, ss(2), ss(2)+ss(us.SizeMultiline*line), schema_c(us.Stat and "fg" or "bg") ) - end - else - draw.SimpleText( l8( us.Func and us.Func( rang ) or us.PrintName ), us.Font, ss(2), ss(2), schema_c(us.Stat and "fg" or "bg") ) - end - if us.Stat then - local perc = us.Stat( rang ) - --perc = (CurTime()*0.2+i/4) % 2 - --if perc > 1 then - -- perc = 2-perc - --end - --perc = math.Remap( perc, 0, 1, 0.3, 0.8) - local rank, col = rank( perc ) - surface.SetDrawColor( schema("fg") ) - surface.DrawRect( ss(60), 0, ss(1), h ) - draw.SimpleText( rank, us.Font, ss(60+4), ss(2), col ) - surface.DrawRect( ss(60)+h, 0, ss(1), h ) - - surface.SetDrawColor( col ) - local width = w-(ss(60+1.5)+h) - surface.DrawRect( ss(60+1)+h, ss(3), math.max( ss(1), width*perc ), h-ss(6) ) - --surface.SetDrawColor( schema("bg") ) - --surface.DrawOutlinedRect( ss(60+1)+h, ss(0.5), width, h-ss(1), ss(2) ) - for i=1, 10 do - if i==1 then continue end - surface.SetDrawColor( schema("fg", i%2==1 and 0.008 or 0.12) ) - surface.DrawRect( ss(60)+h + width*(i-1)/10, 0, ss(1), h ) - end - end - end - - return true - end - end - - do - local fucker = statlist:Add( "DLabel" ) - fucker:SetTall( ss(14) ) - fucker:Dock( TOP ) - fucker:DockMargin( 0, 0, 0, ss(2) ) - function fucker:Paint( w, h ) - do return true end - if pan_active then - local hm = ITEMS[ pan_active ] - surface.SetDrawColor( schema("fg") ) - surface.DrawRect( 0, 0, w, h ) - - draw.SimpleText( BENNY_GetStat( hm, "AmmoStd" ) .. " rounds", "Benny_12", ss(2), ss(2), schema_c("bg") ) - end - return true - end - end - - do - local fucker = statlist:Add( "DLabel" ) - fucker:SetTall( ss(14) ) - fucker:Dock( TOP ) - fucker:DockMargin( 0, 0, 0, ss(2) ) - function fucker:Paint( w, h ) - do return true end - if pan_active then - local hm = ITEMS[ pan_active ] - surface.SetDrawColor( schema("fg") ) - surface.DrawRect( 0, 0, w, h ) - - local fm = BENNY_GetStat( hm, "Firemodes" ) - local fms = "" - - for i,v in ipairs( fm) do - local m =v.Mode - if m == math.huge then - fms = fms .. "AUTO" - elseif m == 1 then - fms = fms .. "SEMI" - else - fms = fms .. m .. "-BURST" - end - if i != #fm then - fms = fms .. " / " - end - end - draw.SimpleText( fms, "Benny_12", ss(2), ss(2), schema_c("bg") ) - end - return true - end - end - - local createlist = {} - - for ClassName, Class in pairs( ITEMS ) do - if rawget(Class, "Hide") then continue end - local category = Class.Category or "No category" - if !createlist[category] then - createlist[category] = {} - end - - table.insert( createlist[category], { ClassName = ClassName, Class = Class } ) - end - - for i, v in SortedPairs( createlist ) do - local Collapse = itemlist:Add( "BCollapsibleCategory" ) - Collapse:Dock( TOP ) - Collapse:SetLabel( i ) - Collapse:SetExpanded( false ) - Collapse:DockMargin( 0, 0, 0, ss(2) ) - Collapse:DockPadding( ss(2), ss(2), ss(2), ss(2) ) - for Mew, New in ipairs( v ) do - local button = Collapse:Add( "DButton" ) - button:SetSize( 0, ss(10) ) - button:DockMargin( 0, 0, 0, ss(0) ) - - button.Text_Name = l8( New.Class.PrintName ) - button.Text_Desc = l8( New.Class.Description ) - - -- PROTO: These functions don't need to be remade over and over like this. - function button:DoClick() - RunConsoleCommand( "benny_debug_give", New.ClassName ) - chat.AddText( "Gave " .. New.Class.PrintName ) - end - - function button:DoRightClick() - if ItemDef("mag_"..New.ClassName) then - RunConsoleCommand( "benny_debug_give", "mag_" .. New.ClassName ) - chat.AddText( "Gave " .. ItemDef("mag_"..New.ClassName).PrintName ) - else - chat.AddText( "That item doesn't exist. " .. "mag_"..New.ClassName ) - end - end - - function button:Think() - if self:IsHovered() then - pan_active = New.ClassName - end - end - - function button:Paint( w, h ) - - local z = 0.5 - if self:IsHovered() then - - local nx, ny = 0, 0 - for i=1, 9 do - -- PROTO: ... - if i==1 then - nx, ny = -1, -1 - elseif i==2 then - nx, ny = 0, -1 - elseif i==3 then - nx, ny = 1, -1 - elseif i==4 then - nx, ny = -1, 0 - elseif i==5 then - continue - elseif i==6 then - nx, ny = 1, 0 - elseif i==7 then - nx, ny = -1, 1 - elseif i==8 then - nx, ny = 0, 1 - elseif i==9 then - nx, ny = 1, 1 - end - nx, ny = ss(nx), ss(ny) - draw.SimpleText( self.Text_Name, "Benny_14", ss(2)+nx, ss(-1)+ny, schema_c("fg") ) - end - - draw.SimpleText( self.Text_Name, "Benny_14", ss(2), ss(-1), schema_c("bg") ) - else - draw.SimpleText( self.Text_Name, "Benny_14", ss(2), ss(-1), schema_c("fg") ) - end - --surface.SetDrawColor( schema("fg") ) - --surface.DrawOutlinedRect( 0, 0, surface.GetTextSize(self.Text_Name)+ss(2+2), h ) - - --surface.SetDrawColor( schema("fg") ) - --surface.DrawRect( ss(2), h-ss(1), surface.GetTextSize(self.Text_Name), ss(0.5) ) - --draw.SimpleText( self.Text_Desc, "Benny_8", w/2, ss(2+8), schema_c("fg"), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP ) - return true - end - end - end - -end - -concommand.Add("benny_ui_spawnmenu", function() - OpenSMenu() -end) \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/gui/cl_spscore.lua b/gamemodes/benny/gamemode/modules/gui/cl_spscore.lua deleted file mode 100644 index c25ca78..0000000 --- a/gamemodes/benny/gamemode/modules/gui/cl_spscore.lua +++ /dev/null @@ -1,10 +0,0 @@ - --- Singleplayer score panel - -function OpenScorePanel() - -end - -concommand.Add("benny_ui_score", function() - OpenScorePanel() -end) \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/lang/en-us.lua b/gamemodes/benny/gamemode/modules/lang/en-us.lua deleted file mode 100644 index fac4d6b..0000000 --- a/gamemodes/benny/gamemode/modules/lang/en-us.lua +++ /dev/null @@ -1,7 +0,0 @@ - -local L = {} -Languages["en-us"] = L -L["Name"] = "English (United States)" - -L["#Item.mk23.Name"] = "MK.23" -L["#Item.mk23.Description"] = "Special forces sidearm" \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/lang/sh_lang.lua b/gamemodes/benny/gamemode/modules/lang/sh_lang.lua deleted file mode 100644 index 50dad3f..0000000 --- a/gamemodes/benny/gamemode/modules/lang/sh_lang.lua +++ /dev/null @@ -1,10 +0,0 @@ - -Languages = {} - -function l8( inp ) - return Languages[ConVarCL_String("lang")][inp] or Languages["en-us"][inp] or inp -end - -local AD, IN = AddCSLuaFile, include -AD("en-us.lua") -IN("en-us.lua") \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/player/cl_camera.lua b/gamemodes/benny/gamemode/modules/player/cl_camera.lua deleted file mode 100644 index 040c3ff..0000000 --- a/gamemodes/benny/gamemode/modules/player/cl_camera.lua +++ /dev/null @@ -1,143 +0,0 @@ - -BENNY_ACTIVECAMERA = nil - -local fixer = Angle( 0, -90, 90 ) -local fixer2 = Angle( 0, -90, 90 ) -local cscam = { - Special = function( self, ply ) - local pos = Vector() - local ang = Angle() - local fov = 90 - - cuts:SetupBones() - local mat = cuts:GetBoneMatrix( cuts:LookupBone( "camera" ) ) - local matf = cuts:GetBoneMatrix( cuts:LookupBone( "camera.fov" ) ) - - pos:Set( mat:GetTranslation() ) - ang:Set( mat:GetAngles() ) - ang:Sub( fixer ) - - local fix, fixa = matf:GetTranslation(), matf:GetAngles() - fix:Sub( cuts:GetPos() ) - fov = fix.z - - do - local x, y, z = pos.x, pos.y, pos.z - end - - do - local p, y, r = ang.p, ang.y, ang.r - ang.p = -r - ang.r = 0 - end - - fov = Convert( fov, (4/3) ) -- Convert to vertical FOV.. somehow - fov = Convert( fov, (ScrH()/ScrW())/(3/4) ) -- Shut up default Source FOV widescreen magic - - return pos, ang, fov - end -} - -local function decide_active() - local csent = ents.FindByClass( "benny_cutscene" )[1] - if IsValid( csent ) then - BENNY_ACTIVECAMERA = cscam - cuts = csent - return true - end - - return false -end - -function bennyfp( origin, angles, fov ) - local ply = LocalPlayer() - if !IsValid( ply:GetActiveWeapon() ) then return origin, angles, fov end - - local pos, ang = ply:CamSpot( TPSOverride ) - - return pos, ang, 90 -end - -hook.Add( "CalcView", "Benny_CalcView", function( ply, pos, ang, fov ) - if ConVarCL_Bool("cam_unlock") then return end - if ply:NoclippingAndNotVaulting() then return end - decide_active() - local camera = BENNY_ACTIVECAMERA - local view = {} - view.origin = pos - view.angles = ang - view.fov = 90 - if false and camera then - view.origin = camera.Pos - view.angles = camera.Ang - view.fov = camera.FOV or 60 - if camera.Special then - view.origin, view.angles, view.fov = camera.Special( camera, ply ) - end - end - - local wep = ply:BennyCheck() - if wep then -- and ply:GetActiveWeapon():GetAim() > 0 then - --local cv = wep:bWepClass( true ) and wep:bWepClass( true ).Custom_CalcView or wep:bWepClass( false ) and wep:bWepClass( false ).Custom_CalcView - local halt = false - --if cv then - -- halt = cv( wep, view, view.origin, view.angles, view.fov ) - --end - if !halt then - view.drawviewer = true - view.origin, view.angles, view.fov = bennyfp( view.origin, view.angles, view.fov ) - end - end - - local st = ConVarCL_String("cam_override") - if st != "" then - local st = string.Explode( " ", st ) - view.origin.x = tonumber(st[1]) - view.origin.y = tonumber(st[2]) - view.origin.z = tonumber(st[3]) - - view.angles.x = tonumber(st[4]) - view.angles.y = tonumber(st[5]) - view.angles.z = tonumber(st[6]) - - view.fov = tonumber(st[7]) - end - - if globhit then - globhit:Set( view.origin ) - globang:Set( view.angles ) - end - - view.fov = Convert( view.fov, (ScrH()/ScrW())/(3/4) ) - return view -end ) - -function Convert( fovDegrees, ratio ) - local halfAngleRadians = fovDegrees * ( 0.5 * math.pi / 180 ) - local t = math.tan( halfAngleRadians ) - t = t * ratio - local retDegrees = ( 180 / math.pi ) * math.atan( t ) - return retDegrees * 2 -end - -concommand.Add( "benny_dev_eyetrace", function( ply ) - local tr = ply:GetEyeTrace() - 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 ) -end) - -if game.GetMap():Left( 13 ) == "bennysurvive_" then - local ourMat = Material( "color" ) - hook.Add("PostDraw2DSkyBox", "ExampleHook", function() - local r, g, b = render.GetFogColor() - r=(r+1)/255 - g=(g+1)/255 - b=(b+1)/255 - local v = Vector( r, g, b ) - render.OverrideDepthEnable( true, false ) -- ignore Z to prevent drawing over 3D skybox - ourMat:SetVector( "$color", v ) - render.SetMaterial( ourMat ) - render.DrawScreenQuadEx( 0, 0, ScrW(), ScrH() ) - render.OverrideDepthEnable( false, false ) - end) -end \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/player/cl_hud.lua b/gamemodes/benny/gamemode/modules/player/cl_hud.lua deleted file mode 100644 index 2308adf..0000000 --- a/gamemodes/benny/gamemode/modules/player/cl_hud.lua +++ /dev/null @@ -1,1005 +0,0 @@ - --- HUD - -local hide = { - ["CHudHealth"] = true, - ["CHudBattery"] = true, - ["CHudAmmo"] = true, - ["CHudSecondaryAmmo"] = true, - ["CHudPoisonDamageIndicator"] = true, - ["CHudDamageIndicator"] = true, - ["CHudCrosshair"] = true, - ["CHUDQuickInfo"] = true, - ["CHudSuitPower"] = true, - ["CHudZoom"] = true, -} - -hook.Add( "HUDShouldDraw", "Benny_HUDShouldDraw", function( name ) - if ( hide[ name ] ) then return false end -end ) - -function ss( scale ) - return scale*ConVarCL_Int("hud_scale")--math.Round( scale * ( ScrH() / 480 ) * HSCALE:GetFloat() ) -end - -local function genfonts() - local sizes = { - 8, - 10, - 12, - 14, - 16, - 18, - 24, - 28, - 32, - 36, - 48, - 64, - 72 - } - for _, size in pairs(sizes) do - surface.CreateFont( "Benny_" .. size, { - font = "Carbon Plus Bold", - size = ss(size), - weight = 0, - } ) - end - for _, size in pairs(sizes) do - surface.CreateFont( "BennyS_" .. size, { - font = "Carbon Plus Bold", - size = ss(size), - weight = 0, - scanlines = ss(1), - blursize = ss(3), - } ) - end - local sizes = { - 8, - 9, - 10, - 12, - } - for _, size in pairs(sizes) do - for i=1, 4 do - local add = i==1 and "" or i==2 and "B" or i==3 and "I" or i==4 and "BI" - local mode = i==1 and "" or i==2 and " Bold" or i==3 and " Italic" or i==4 and " Bold Italic" - surface.CreateFont( "Benny_Caption_" .. size .. add, { - font = "Roboto" .. mode, - size = ss(size), - weight = 0, - } ) - end - end -end -genfonts() - -cvars.AddChangeCallback("benny_hud_scale", function(convar_name, value_old, value_new) - genfonts() -end, "benny_hud_scale_callback") - -schemes = { - ["benny"] = { - fg = Color( 255, 238, 169 ), - bg = Color( 54, 44, 39 ), - caption = Color( 255, 238, 169 ), - name = "BENNY", - }, - ["nikki"] = { - fg = Color( 255, 174, 210 ), - bg = Color(37, 12, 40 ), - caption = Color( 255, 174, 210 ), - name = "NIKKI", - }, - ["igor"] = { - fg = Color( 253, 208, 207 ), - bg = Color( 32, 14, 12 ), - caption = Color( 253, 78, 77 ), - name = "IGOR", - }, - ["yanghao"] = { - fg = Color( 157, 187, 253 ), - bg = Color( 19, 21, 28 ), - caption = Color( 87, 187, 253 ), - name = "YANG-HAO", - }, - ["mp_cia"] = { - fg = Color( 93, 118, 215 ), - bg = Color( 25, 23, 47 ), - caption = Color( 87, 187, 253 ), - name = "CIA", - }, - ["mp_plasof"] = { - fg = Color( 255, 103, 103 ), - bg = Color( 35, 25, 20 ), - caption = Color( 87, 187, 253 ), - name = "PLASOF", - }, - ["mp_militia"] = { - fg = Color( 255, 199, 133 ), - bg = Color( 33, 18, 18 ), - caption = Color( 87, 187, 253 ), - name = "MILITIA", - }, - ["mp_natguard"] = { - fg = Color( 208, 226, 132 ), - bg = Color( 23, 25, 23 ), - caption = Color( 87, 187, 253 ), - name = "ARNG", - }, - ["mp_viper"] = { - fg = Color( 255, 230, 245 ), - bg = Color( 40, 30, 30 ), - caption = Color( 87, 187, 253 ), - name = "VIPER", - }, - ["mp_halo"] = { - fg = Color( 200, 255, 246 ), - bg = Color( 30, 40, 38 ), - caption = Color( 87, 187, 253 ), - name = "HALO", - }, - ["enemy"] = { - caption = Color( 199, 0, 0 ), - name = "ENEMY", - }, - ["pistol"] = { - caption = Color( 61, 61, 61 ), - name = "PISTOL", - } -} - -local activescheme = ConVarCL("hud_tempactive") -function schema( i2, alpha ) - local i1 = activescheme:GetString() - return schemes[i1][i2].r, schemes[i1][i2].g, schemes[i1][i2].b, (alpha or 1)*255 -end - -local junker = Color( 0, 0, 0, 0 ) -function schema_c( i2, alpha ) - local r,g,b,a=schema( i2, alpha ) - junker.r=r - junker.g=g - junker.b=b - junker.a=a - return junker -end - -captions = { - --{ - -- name = "YANG-HAO", - -- color = schemes["yanghao"]["caption"], - -- text = { "..." }, - -- time = 1, - --}, - --{ - -- name = "BENNY", - -- color = schemes["benny"]["caption"], - -- text = { "Bleh." }, - -- time = 2, - --}, - --{ - -- name = "NICKY", - -- color = schemes["nicky"]["caption"], - -- text = { "You have a big weapon, sir!" }, - -- time = 3, - --}, - --{ - -- name = "IGOR", - -- color = schemes["igor"]["caption"], - -- text = { "I need more bullets!", "I need more bullets!", "I need more bullets!" }, - -- time = 4, - --}, - --{ - -- name = "ENEMY GUARD", - -- color = schemes["enemy"]["caption"], - -- text = { "Bigger weapons! Bigger weapons!", "Ratatatata!" }, - -- time = 5, - --}, -} - -function AddCaption( name, color, text, time_to_type, lifetime ) - if captions[#captions] and captions[#captions].name == name then - local weh = captions[#captions] - local wehlast = weh.lines[#weh.lines] - if wehlast.text == text then - wehlast.repeated = wehlast.repeated + 1 - else - table.insert( weh.lines, { text = text, time_to_type=time_to_type, starttime=CurTime(), repeated = 1 } ) - end - weh.lifetime = math.max( CurTime() + lifetime, weh.lifetime ) - else - table.insert( captions, { name = name, color=color, lifetime=CurTime()+lifetime, lines = { { text=text, time_to_type=time_to_type, starttime=CurTime(), repeated = 1 } } }) - end -end - -local color_caption = Color( 0, 0, 0, 127 ) -local mat_grad = Material( "benny/hud/grad.png", "mips smooth" ) - -local lonk = { - { - Glyph = "W", - Glyph2 = "S", - Text1 = "MOVE", - Text2 = "Forward and backward", - }, - { - Glyph = "A", - Glyph2 = "D", - Text1 = "STRAFE", - Text2 = "Left and right", - }, - { - Spacer = true, - }, - { - Glyph = "R", - Glyph2 = "T", - Text1 = "RELOAD", - Text2 = "Reload weapon", - }, - { - Glyph = "F", - Text1 = "AIM", - Text2 = "Enter weapon mode", - }, - { - Spacer = true, - }, - { - Glyph = "SHIFT", - Text1 = "STUNT", - Text2 = "Do a barrel roll", - }, - { - Glyph = "CTRL", - Text1 = "STANCE", - Text2 = "Get down", - }, - { - Spacer = true, - }, - { - Glyph = "F1", - Text1 = "SETTINGS", - Text2 = "Set settings", - }, - { - Glyph = "F2", - Text1 = "DEV. INVENTORY", - Text2 = "Manage inventory", - }, - { - Glyph = "F3", - Text1 = "DEV. SPAWN", - Text2 = "Cheat items in", - }, - --{ - -- Glyph = "F4", - -- Text1 = "CHOREOGRAPHER", - -- Text2 = "Manage scenes", - --}, -} - --- Stew port -globhit = Vector() -globang = Angle() -tr1f = Vector() -tr2f = Vector() -local col_1 = Color(255, 255, 255, 200) -local col_1a = Color(100, 100, 255, 200) -local col_2 = Color(0, 0, 0, 255) -local col_3 = Color(255, 127, 127, 255) -local col_4 = Color(255, 222, 222, 255) -local mat_dot = Material("benny/hud/xhair/dotx.png", "smooth") -local mat_long = Material("benny/hud/xhair/long.png", "smooth") -local mat_dot_s = Material("benny/hud/xhair/dot_s.png", "mips smooth") -local mat_long_s = Material("benny/hud/xhair/long_s.png", "mips smooth") -local spacer_long = 3 -- screenscaled -local spacer = 1 -- screenscaled - -local trash_vec, trash_ang = Vector(), Angle() - -bucket_selected = bucket_selected or 1 -item_selected = item_selected or 1 - -hook.Add( "HUDPaint", "Benny_HUDPaint", function() - local sw, sh = ScrW(), ScrH() - local Wb = sh*0.05--ss(20) - local Hb = sh*0.05--ss(20) - - -- Wb = (sh*(4/3)) - -- Wb = (sw-Wb)/2 - - local p = LocalPlayer() - local wep = p:BennyCheck() - - local active = GetConVar("benny_hud_tempactive"):GetString() - local scheme = schemes[active] - - if ConVarCL_Bool("hud_enable_health") then -- Health - local b_w, b_h = ss(142), ss(32) - local b_bh = ss(14) - local b_bh2 = ss(8) - local b_s = ss(4) - local b_s2 = b_s*2 - local b_x, b_y = Wb, sh - Hb - b_h - -- BG - surface.SetDrawColor( scheme["bg"] ) - surface.DrawRect( b_x, b_y, b_w, b_h ) - - local hp = p:Health()/100 --CurTime()*0.5 % 1 - local ti = (CurTime()*0.75 / (hp)) % 1 - - -- Text underneath - surface.SetFont( "Benny_18" ) - surface.SetTextColor( scheme["fg"] ) - surface.SetTextPos( b_x + ss(6), b_y + ss(3) ) - surface.DrawText( scheme["name"] ) - - -- Bar - surface.SetDrawColor( scheme["fg"] ) - surface.DrawOutlinedRect( b_x + b_s, b_y + b_s, ss(142-8), b_bh, ss( 0.5 ) ) - surface.DrawRect( b_x + b_s + ss(1), b_y + b_s + ss(1), ss(142*hp-8-2), b_bh - ss(2) ) - - surface.SetDrawColor( 255, 255, 255, math.ease.OutQuint(1-ti)*255 ) - surface.SetMaterial( mat_grad ) - surface.DrawTexturedRect( b_x + b_s + ss(1), b_y + b_s + ss(1), ss(142*hp*ti-8-2), b_bh - ss(2) ) - - -- Bar text - surface.SetTextColor( scheme["bg"] ) - surface.SetTextPos( b_x + ss(6), b_y + ss(3) ) - render.SetScissorRect( b_x + b_s, b_y + b_s, b_x + b_s + ss(142*hp-8), b_y + b_s + b_bh, true ) -- Enable the rect - surface.DrawText( scheme["name"] ) - render.SetScissorRect( 0, 0, 0, 0, false ) -- Disable after you are done - - if true then -- Stamina - local perc = p:GetStamina() - for i=1, 4 do - local localperc = math.Clamp( math.Remap( perc, (0.25*(i-1)), (0.25*(i)), 0, 1 ), 0, 1 ) - surface.SetDrawColor( scheme["fg"] ) - surface.DrawOutlinedRect( b_x + b_s + ((i-1)*ss(32+2)), b_y + b_bh + ss(4+2), ss(32), b_bh2, ss(0.5) ) - surface.DrawRect( b_x + b_s + ((i-1)*ss(32+2)) + ss(1), b_y + b_bh + ss(4+2) + ss(1), ss(32*localperc) - ss(2), b_bh2 - ss(2) ) - end - end - - if true then - surface.SetDrawColor( schema("bg") ) - local s_h = ss(14) - local s_w = ss(46) - surface.DrawRect( b_x, b_y - s_h - ss(2), s_w, s_h ) - - draw.SimpleText( string.format( "%f", p:GetVelocity():Length2D()/39.3701 ):Left( 4 ), "Benny_12", b_x + ss(4), b_y - s_h - ss(2-2), schema_c("fg") ) - draw.SimpleText( "m/s", "Benny_12", b_x + s_w - ss(4), b_y - s_h - ss(2-2), schema_c("fg"), TEXT_ALIGN_RIGHT ) - end - end - - do -- Vaulting - if vaultsave then - local tex = "[SPACE] VAULT OVER" - if vaultsave == 2 then tex = "[SPACE] MANTLE OVER" end - - surface.SetFont( "Benny_16" ) - local tox, toy = surface.GetTextSize( tex ) - local box, boy = ss( 8 ) + tox, ss( 18 ) - surface.SetDrawColor( scheme["bg"] ) - surface.DrawRect( sw/2 - box/2, sh/2 + ss( 96 ) - boy/2 - ss( 2 ), box, boy ) - - surface.SetTextColor( scheme["fg"] ) - surface.SetTextPos( sw/2 - tox/2, sh/2 + ss( 96 ) - toy/2 ) - surface.DrawText( tex ) - end - end - - if ConVarCL_Bool("hud_enable_hints") then -- Hints - local b_w, b_h = ss(130), ss(0) - local b_x, b_y = sw - Wb - b_w, Hb + ss(200)--sh/2 - b_h/2 - - local honk = ss(1) - local honk2 = honk*2 - - local tbw, tbh, tbg = ss(6), ss(2), ss(12) - - local bump = 0 - local tbump = 0 - - - for _, data in ipairs( lonk ) do - if _==1 then - tbump = tbump + ss(4) - end - if data.Spacer then - tbump = tbump + ss(5) - else - tbump = tbump + ss(16) - end - if _==#lonk then - tbump = tbump + ss(4) - end - end - - b_h = b_h + tbump - b_y = sh/2 - b_h/2 - - surface.SetDrawColor( scheme["bg"] ) - surface.DrawRect( b_x, b_y, b_w, b_h ) - - surface.SetDrawColor( scheme["fg"] ) - surface.DrawOutlinedRect( b_x + honk, b_y + honk, b_w - honk2, b_h - honk2, ss(0.5) ) - for _, data in ipairs( lonk ) do - if _==1 then - bump = bump + ss(4) - end - - -- surface.SetDrawColor( 0, 100, 255, 32 ) - -- surface.DrawRect( b_x, b_y + bump, b_w, ss(16) ) - if data.Spacer then - surface.SetDrawColor( scheme["fg"] ) - surface.DrawRect( b_x + ss(4), b_y + ss(2) + bump, b_w - ss(8), ss(1) ) - bump = bump + ss(5) - else - draw.SimpleText( data.Text1, "Benny_12", b_x + b_w - tbw, - b_y + bump, - scheme["fg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) - - draw.SimpleText( data.Text2, "Benny_8", b_x + b_w - tbw, - b_y+ss(8) + bump, - scheme["fg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) - - if #data.Glyph == 1 then - surface.SetDrawColor( scheme["fg"] ) - surface.DrawOutlinedRect( b_x + tbw, - b_y + ss(2) + bump, tbg, tbg, ss(1) ) - draw.SimpleText( data.Glyph, "Benny_12", b_x + tbw + tbg/2, - b_y + ss(2.6) + bump, - scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP ) - - if data.Glyph2 then - surface.SetDrawColor( scheme["fg"] ) - surface.DrawOutlinedRect( b_x + tbw + tbg + ss(2), - b_y + ss(2) + bump, tbg, tbg, ss(1) ) - draw.SimpleText( data.Glyph2, "Benny_12", b_x + tbw + tbg/2 + tbg + ss(2), - b_y + ss(2.6) + bump, - scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP ) - end - else - surface.SetFont( "Benny_10" ) - local tx = ss((#data.Glyph*5)+5) surface.GetTextSize( data.Glyph ) - --tx = math.max( tx + ss(8), tbg ) - - surface.SetDrawColor( scheme["fg"] ) - surface.DrawOutlinedRect( b_x + tbw, - b_y + ss(2) + bump, tx, tbg, ss(1) ) - draw.SimpleText( data.Glyph, "Benny_10", b_x + tbw + tx/2, - b_y + ss(3.6) + bump, - scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP ) - end - bump = bump + ss(16) - end - if _==#lonk then - bump = bump + ss(4) - end - end - end - - - if false and wep and ConVarCL_Bool("hud_enable_active") then -- Weapon - local inv = p:INV_Get() - local wep1 = wep:bWepTable( false ) - local wep1c = wep:bWepClass( false ) - local wep2 = wep:bWepTable( true ) - local wep2c = wep:bWepClass( true ) - - for i=1, 2 do - local hand = i==2 - if wep:bWepTable( hand ) then -- New Weapon HUD - local wep_table = wep:bWepTable( hand ) - local wep_class = wep:bWepClass( hand ) - - local p_w, p_h = ss(156), ss(64) - local p_x, p_y = sw - p_w - Wb, Hb - if hand then p_x = Wb end - local pb = ss(4) - local pb2 = pb*2 - - surface.SetDrawColor( scheme["bg"] ) - surface.DrawRect( p_x, p_y, p_w, p_h ) - - do -- Name tag - local t_h = ss(15) - surface.SetDrawColor( scheme["fg"] ) - surface.DrawRect( p_x+pb, p_y+pb, p_w-pb2, t_h ) - - draw.SimpleText( wep_class.Name, "Benny_16", p_x+ss(6), p_y+ss(5), scheme["bg"], TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) - - local identicallist = p:INV_Find( wep:bWepTable( hand ).Class ) - identicallist = table.Flip( identicallist ) - local numba = identicallist[ wep:bGetInvID( hand ) ] - draw.SimpleText( "#" .. tostring(numba) .. ", " .. wep:bGetInvID( hand ), "Benny_10", p_x+p_w-pb2, p_y+ss(7), scheme["bg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) - - if wep_class.Firemodes then -- Firemode - surface.SetDrawColor( scheme["fg"] ) - surface.DrawRect( p_x+pb, p_y + pb + t_h + ss(2), ss(30), ss(10) ) - - draw.SimpleText( wep:B_FiremodeName( hand ), "Benny_12", p_x + pb + ss(14.5), p_y + pb + t_h + ss(8), scheme["bg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) - -- draw.SimpleText( "[AMMO TYPE]", "Benny_10", p_x + pb + ss(30+4), p_y + pb + t_h + ss(8), scheme["fg"], TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER ) - end - if wep_table.Thrown then - - draw.SimpleText( "X", "Benny_48", p_x+p_w/2, p_y+p_h/2 + ss(8), scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) - - end - if wep:bMagClass( hand ) then -- Ammo - local b_w, b_h = ss(3), ss(10) - local lw, lh = ss(2), ss(2) - surface.SetDrawColor( scheme["fg"] ) - - local ammo = math.max( wep:bGetIntClip( hand ), wep:bMagClass( hand ).Ammo ) - if ammo>30 then b_w, b_h = ss(3), ss(4) end - - local offset = b_h - local count = 1 - for i=1, ammo do - local thefunk = surface.DrawRect - if i > wep:bGetIntClip( hand ) then - thefunk = surface.DrawOutlinedRect - end - if i!=1 and i%30 == 1 then - count = 1 - offset = offset + b_h + lh - end - thefunk( p_x + p_w - b_w - pb - ((count-1)*(b_w+lw)), p_y + p_h - offset - pb, b_w, b_h, ss(0.5) ) - count = count + 1 - end - draw.SimpleText( wep:bGetIntClip( hand ), "Benny_12", p_x + p_w - pb - ss(1), p_y + p_h - offset - ss(12+3), scheme["fg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) - - if wep:bGetMagInvID( hand ) != wep_table.Loaded then - surface.SetDrawColor( scheme["bg"] ) - surface.DrawRect( p_x, p_y - ss( 12+3 ), ss( 66 ), ss( 12 ) ) - draw.SimpleText( "!! Mag desync.", "Benny_12", p_x + ss( 2 ), p_y - ss( 12+2 ), scheme["fg"], TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) - end - end - if wep_class.AmmoStd then -- Magazines - local m_w, m_h = ss( 12 ), ss( 20 ) - local m_x, m_y = p_x + p_w - m_w, p_y + p_h + ss(1)--p_x - m_w, p_y + p_h - m_h - local bb = ss( 1 ) - local b2 = ss( 2 ) - local b3 = ss( 3 ) - local b4 = ss( 4 ) - local maglist = p:INV_FindMagSmart( wep_class.ClassName, wep:bGetInvID( hand ) ) - for id, tag in ipairs( maglist ) do - --assert( inv[tag], "That magazine doesn't exist. " .. tag ) - local chunk = ((ss(1)+m_w)*(id-1)) - surface.SetDrawColor( scheme["bg"] ) - surface.DrawRect( m_x - chunk, m_y, m_w, m_h ) - - surface.SetDrawColor( scheme["fg"] ) - surface.DrawOutlinedRect( m_x + bb - chunk, m_y + bb, m_w - b2, m_h - b2, ss( 0.5 ) ) - - local s1 = (m_h - b2 - b2) - local s2 = (m_h - b2 - b2) * (inv[tag] and ( inv[tag].Ammo / ITEMS[inv[tag].Class].Ammo ) or 8) - local s3 = math.floor( s2 - s1 ) - - local m1, m2, m3, m4 = m_x + bb + bb - chunk, m_y + bb + bb - s3, m_w - b2 - b2, s2 - local active = tag == wep:bGetMagInvID( hand ) - local active2 = tag == wep:bGetMagInvID( !hand ) - if active or active2 then - draw.SimpleText( active2 and "|" or "x", "Benny_10", m_x + (m_w/2) - chunk, m_y + (m_h/2), scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) - end - surface.DrawRect( m1, m2, m3, m4 ) - - if active or active2 then - render.SetScissorRect( m1, m2, m1 + m3, m2 + m4, true ) - draw.SimpleText( active2 and "|" or "x", "Benny_10", m_x + (m_w/2) - chunk, m_y + (m_h/2), scheme["bg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) - render.SetScissorRect( 0, 0, 0, 0, false ) - end - end - end - end - end - end - end - - if false and wep then -- Crosshair - - local dispersion = math.rad( 1 ) - cam.Start3D() - local lool = ( EyePos() + ( EyeAngles():Forward()*8192 ) + ( dispersion * EyeAngles():Up()*8192 ) ) :ToScreen() - cam.End3D() - local gap = ( (ScrH()/2) - lool.y ) - - do - local tr1 = util.TraceLine({ - start = p:EyePos(), - endpos = p:EyePos() + (p:EyeAngles():Forward()*16000), - filter = p - }) - - local tr2 = util.TraceLine({ - start = globhit, - endpos = globhit + (globang:Forward()*16000), - filter = p - }) - - tr1f:Set(tr1.HitPos) - tr2f:Set(tr2.HitPos) - end - - pl_x = tr2f:ToScreen().x - pl_y = tr2f:ToScreen().y - ps_x = tr2f:ToScreen().x - ps_y = tr2f:ToScreen().y - - local touse1 = col_1 - local touse1_primary = col_1a - local touse2 = col_2 - if ConVarCL_String("cam_override") != "" then - pl_x = tr1f:ToScreen().x - pl_y = tr1f:ToScreen().y - ps_x = tr1f:ToScreen().x - ps_y = tr1f:ToScreen().y - elseif util.TraceLine({start = tr2f, endpos = tr1f, filter = p}).Fraction != 1 and !tr2f:IsEqualTol(tr1f, 1) then - touse1 = col_4 - touse2 = col_3 - pl_x = tr1f:ToScreen().x - pl_y = tr1f:ToScreen().y - end - - pl_x = math.Round( pl_x ) - pl_y = math.Round( pl_y ) - ps_x = math.Round( ps_x ) - ps_y = math.Round( ps_y ) - - for hhhh=1, 2 do - local hand = hhhh==2 - if wep:GetUserAim() and wep:bWepClass( hand ) then -- Crosshair - local s, w, h = ss, ScrW(), ScrH() - - local gap = gap - if wep:bWepClass( hand ).Spread then - gap = gap * wep:BSpread( hand ) - end - - local meow = wep:hFlipHand() - - for i=1, 2 do - local cooler = i == 1 and touse2 or (hand!=meow and touse1_primary or touse1) - local poosx, poosy = i == 1 and ps_x or pl_x, i == 1 and ps_y or pl_y - local mat1 = i == 1 and mat_long_s or mat_long - local mat2 = i == 1 and mat_dot_s or mat_dot - surface.SetDrawColor( cooler ) - local typ = wep:bWepClass( hand ).Category - if typ == "rifle" or typ == "sniper" then - surface.SetMaterial( mat1 ) - surface.DrawTexturedRectRotated( poosx - s(spacer_long) - gap, poosy, s(16), s(16), 0 ) - surface.DrawTexturedRectRotated( poosx + s(spacer_long) + gap, poosy, s(16), s(16), 0 ) - - surface.SetMaterial( mat2 ) - surface.DrawTexturedRectRotated( poosx, poosy - gap - s(spacer), s(24), s(24), 0 ) - surface.DrawTexturedRectRotated( poosx, poosy + gap + s(spacer), s(24), s(24), 0 ) - elseif typ == "shotgun" or typ == "smg" or typ == "machinegun" then - local smg = typ == "smg" - local lmg = typ == "machinegun" - surface.SetMaterial( mat1 ) - local split = smg and 3 or lmg and 4 or 8 - for i=(360/split), 360, 360/split do - local i = i-(360/split)+180 + (lmg and 45 or 0) -- + ( CurTime()*0.25 % 1 )*360 - local ra = math.rad(i) - local co, si, sl = math.cos(ra), math.sin(ra), s(spacer_long) - surface.SetMaterial( mat1 ) - local fx, fy = poosx + si*gap + si*sl, poosy + co*gap + co*sl - fx, fy = math.Round( fx ), math.Round( fy ) - surface.DrawTexturedRectRotated( fx, fy, s(16), s(16), i+(lmg and 0 or 90) ) - end - elseif typ == "pistol" or typ == "special" then -- pistol - surface.SetMaterial( mat2 ) - surface.DrawTexturedRectRotated( poosx - gap - s(spacer), poosy, s(24), s(24), 0 ) - surface.DrawTexturedRectRotated( poosx + gap + s(spacer), poosy, s(24), s(24), 0 ) - - surface.SetMaterial( mat2 ) - surface.DrawTexturedRectRotated( poosx, poosy - gap - s(spacer), s(24), s(24), 0 ) - surface.DrawTexturedRectRotated( poosx, poosy + gap + s(spacer), s(24), s(24), 0 ) - elseif typ == "grenade" then -- grenade - surface.SetMaterial( mat2 ) - surface.DrawTexturedRectRotated( poosx, poosy, s(32), s(32), 0 ) - surface.DrawTexturedRectRotated( poosx, poosy, s(32), s(32), 0 ) - end - end - end - end - - end - - if false and wep and ConVarCL_Bool("hud_enable_hotbar") then -- Newinv - local weighted = p:INV_Weight() - local inv = p:INV_Get() - local iflip = table.Flip( p:INV_Get()) - - local b_w = 48 - local b_h = 15 - - local b_x, b_y = sw - Wb, sh - Hb - ss(b_h) - - local bump = 0 - local fbump = 0 - - local num, tcount = 0, table.Count( weighted ) - for _, item in pairs( weighted ) do - num = num + 1 - local class = ITEMS[item.Class] - local boxsize = ss(b_w) - fbump = fbump + boxsize - if num != tcount then - fbump = fbump + ss(2) - end - end - b_x = b_x - fbump - - local invid = 0 - for _, item in pairs( weighted ) do - local id = iflip[item] - local active = wep:bGetReqInvID( false ) == id or wep:bGetReqInvID( true ) == id - local active_r = wep:bGetReqInvID( false ) == id - local active_l = wep:bGetReqInvID( true ) == id - local class = ITEMS[item.Class] - local boxsize = ss(b_w) - surface.SetDrawColor( scheme[active and "fg" or "bg"] ) - surface.DrawRect( b_x + bump, b_y, boxsize, ss(b_h) ) - draw.SimpleText( class.Name, "Benny_8", b_x + bump + boxsize/2, b_y + ss(4), scheme[active and "bg" or "fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP ) - if active then - if active_r then - draw.SimpleText( "R", "Benny_10", b_x + bump + boxsize - ss(2), b_y + ss(b_h) - ss(9), scheme["bg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) - elseif active_l then - draw.SimpleText( "L", "Benny_10", b_x + bump + ss(2), b_y + ss(b_h) - ss(9), scheme["bg"], TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) - end - end - if class.Equipable or class.Features == "firearm" or class.Features == "grenade" or class.Features == "melee" then - invid = invid + 1 - surface.SetDrawColor( scheme[active and "bg" or "fg"] ) - surface.DrawOutlinedRect( b_x + bump + ss(1), b_y + ss(1), boxsize-ss(2), ss(b_h-2), ss(0.5) ) - if invid < 11 then - surface.SetDrawColor( scheme[active and "fg" or "bg"] ) - surface.DrawRect( b_x + bump, b_y - ss(2+12), ss(12), ss(12) ) - draw.SimpleText( invid==10 and 0 or invid, "Benny_10", b_x + bump + ss(6), b_y - ss(2+10), scheme[active and "bg" or "fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP ) - end - end - - local maginv = p:INV_FindMagSmart( item.Class, id ) - local magbump = 0 - for _, mag in ipairs( maginv ) do - local mitem = inv[mag] - if !mitem then continue end - local loaded = (item.Loaded == mag) - local perc = mitem.Ammo/ITEMS[mitem.Class].Ammo - surface.SetDrawColor( scheme["bg"] ) - surface.DrawRect( b_x + bump + magbump + ss(13), b_y - ss(14), ss(3), ss(12) ) - surface.SetDrawColor( scheme["fg"] ) - - local mstart = ss(10) - local meow = math.Round(ss(10*perc)) - surface.DrawRect( b_x + bump + magbump + ss(14), b_y - ss(13) + (mstart-meow), ss(1), meow ) - magbump = magbump + ss(2) - end - bump = bump + boxsize + ss(2) - end - end - - do -- Captions - local space = Hb - for aaa, caption in pairs(captions) do - if caption.lifetime <= CurTime() then captions[aaa] = nil end - if #caption.lines == 0 then captions[aaa] = nil end - end - for aaa, caption in SortedPairsByMemberValue(captions, "starttime", false) do - surface.SetFont("Benny_Caption_9I") - local tw = 0 - for i, v in pairs( caption.lines ) do - local repeater = ( v.repeated > 1 and (" (x" .. v.repeated .. ")") or "" ) - tw = math.max( tw, surface.GetTextSize( v.text .. repeater ) ) - end - surface.SetFont("Benny_10") - tw = math.max( tw, surface.GetTextSize( caption.name ) ) - space = space + ss(22)+ss(8*(#caption.lines-1)) - - -- BG - surface.SetDrawColor( color_caption ) - surface.DrawRect( (sw/2) - (ss(8)+tw)/2, sh - space - ss(0), ss(8)+tw, ss(22)+ss(8*(#caption.lines-1)) ) - - -- PROTO: Would be nice to be able to change italics or bold inline. - for i, v in SortedPairsByMemberValue( caption.lines, "starttime" ) do - local repeater = ( v.repeated > 1 and (" (x" .. v.repeated .. ")") or "" ) - surface.SetFont("Benny_Caption_9I") - surface.SetTextColor( color_white ) - surface.SetTextPos( (sw/2) - (tw/2), sh - space + ss(10) + (ss(8)*(i-1)) ) - local waah = "" - for i=1, #v.text do - waah = waah .. ( ((i-1)/#v.text) <= math.TimeFraction( v.starttime, v.starttime + v.time_to_type, CurTime() ) and v.text[i] or " ") - end - surface.DrawText( waah .. repeater ) - end - - surface.SetTextColor( caption.color ) - surface.SetFont("Benny_10") - surface.SetTextPos( (sw/2) - (tw/2), sh - space + ss(2) ) - surface.DrawText( caption.name ) - end - end - - if false then -- MP / Arena UI - surface.SetDrawColor( scheme["bg"] ) - - local r_x, r_y, r_w, r_h = sw/2 - ss(180/2), Hb, ss(180), ss(30) - local ib, ic = ss(20), ss(2) - surface.DrawRect( r_x, r_y, r_w, r_h ) - - do -- Time - local tt = string.FormattedTime( (60*1)-(CurTime() % 60) ) - local d1, d2 - if tt.m > 0 then - d1 = tt.m -- .. ":" - d2 = tt.s - if tt.h > 0 then - -- d1 = tt.h .. ":" .. d1 - end - else - d1 = tt.s -- .. "." - d2 = math.floor( tt.ms ) - end - - d1 = string.format( "%02i", d1 ) - d2 = string.format( "%02i", d2 ) - - if tt.h > 0 then - d1 = tt.h .. ":" .. d1 .. ":" - elseif tt.m > 0 then - d1 = d1 .. ":" - else - d1 = d1 .. "." - end - - surface.SetFont( "Benny_36") - local tx = surface.GetTextSize( d1 ) - - local c1, c2, c3, c4 = schema( "fg", ((tt.ms/100)%1)) - - surface.SetTextColor( c1, c2, c3, c4 ) - surface.SetTextPos( ib + r_x + ss( 24 ) - tx, r_y ) - surface.SetFont( "BennyS_36") - surface.DrawText( d1 ) - - surface.SetTextColor( scheme["fg"] ) - surface.SetTextPos( ib + r_x + ss( 24 ) - tx, r_y ) - surface.SetFont( "Benny_36") - surface.DrawText( d1 ) - - surface.SetTextColor( c1, c2, c3, c4 ) - surface.SetTextPos( ib + r_x + ss( 24 ), r_y + ss(5) ) - surface.SetFont( "BennyS_28") - surface.DrawText( d2 ) - - surface.SetTextColor( scheme["fg"] ) - surface.SetTextPos( ib + r_x + ss( 24 ), r_y + ss(5) ) - surface.SetFont( "Benny_28") - surface.DrawText( d2 ) - end - do -- Score - for i=0, 1 do - local s_w, s_h = ss(100), ss(12) - local s_x, s_y = r_x + r_w - ic - s_w, ic + r_y + (s_h*i) + (ss(2*i)) - - surface.SetDrawColor( scheme["fg"] ) - if i==1 then -- Losing - surface.DrawOutlinedRect( s_x, s_y, s_w, s_h, math.max( ss(0.5), 1 ) ) - surface.SetTextColor( scheme["fg"] ) - else - surface.DrawRect( s_x, s_y, s_w, s_h ) - surface.SetTextColor( scheme["bg"] ) - end - - surface.SetFont( "Benny_12") - surface.SetTextPos( s_x + ss(2), s_y + ss(1) ) - surface.DrawText( i==1 and "HALO" or "CIA" ) - - local score = i==1 and "100" or "1200" - surface.SetTextPos( s_x + s_w - surface.GetTextSize( score ) - ss(2), s_y + ss(1) ) - surface.DrawText( score ) - end - end - end - - if false and wep then - local bx, by = sw/2, sh*(0.75) - local mx = 50 - - local wep1_table, wep1_class = wep:bWepTable( false ), wep:bWepClass( false ) - if wep1_table then - draw.SimpleText( wep1_class.Name, "Benny_14", bx-mx, by+ss(8)*-1, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) - draw.SimpleText( "Clip1: " .. wep:Clip1(), "Benny_14", bx-mx, by+ss(8)*0, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) - draw.SimpleText( "ID1: " .. wep:GetWep1(), "Benny_14", bx-mx, by+ss(8)*1, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) - draw.SimpleText( "MagID1: " .. wep:bGetMagInvID( false ), "Benny_14", bx-mx, by+ss(8)*2, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) - if wep1_table.Loaded then - draw.SimpleText( "T_MagID1: " .. wep1_table.Loaded, "Benny_14", bx-mx, by+ss(8)*3, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) - end - end - - local wep2_table, wep2_class = wep:bWepTable( true ), wep:bWepClass( true ) - if wep2_table then - draw.SimpleText( wep2_class.Name, "Benny_14", bx+mx, by+ss(8)*-1, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) - draw.SimpleText( "Clip2: " .. wep:Clip2(), "Benny_14", bx+mx, by+ss(8)*0, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) - draw.SimpleText( "ID2: " .. wep:GetWep2(), "Benny_14", bx+mx, by+ss(8)*1, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) - draw.SimpleText( "MagID2: " .. wep:bGetMagInvID( true ), "Benny_14", bx+mx, by+ss(8)*2, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) - if wep2_table.Loaded then - draw.SimpleText( "T_MagID2: " .. wep2_table.Loaded, "Benny_12", bx+mx, by+24*3, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) - end - end - end - - if false and wep then - local bump1 = ss(1) - local bump2 = ss(1) - local bump4 = ss(2) - local boost = ss(44) - local r_w, r_h = ss(8), ss(72) - for i=1, 2 do - local hand = i==2 - if hand then boost = -boost end - - local wr = wep:bGetReloadTime( hand ) - local wrt = wep:bGetReloadType( hand ) - if wr > 0 then - local b1 = math.TimeFraction( wr, wr + wep:GetStat( hand, "Reload_MagIn" ), wr + wep:GetStat( hand, "Reload_MagIn_Bonus1" ) ) - local b2 = math.TimeFraction( wr, wr + wep:GetStat( hand, "Reload_MagIn" ), wr + wep:GetStat( hand, "Reload_MagIn_Bonus2" ) ) - wr = math.TimeFraction( wr, wr + (wrt==1 and wep:GetStat( hand, "Reload_MagIn" ) or wrt==2 and wep:GetStat( hand, "Reload_MagOut" )), RealTime() ) - local r_x, r_y = sw/2 - r_w/2 + boost, sh/2 - r_h/2 - - surface.SetDrawColor( schema("bg") ) - surface.DrawRect( r_x - bump4, r_y - bump4, r_w + bump4*2, r_h + bump4*2 ) - - surface.SetDrawColor( schema("fg") ) - surface.DrawOutlinedRect( r_x - bump2, r_y - bump2, r_w + bump2*2, r_h + bump2*2, ss(0.5) ) - - if wrt == 1 then - local gump = math.Round( r_h*(1-wr) ) - surface.SetDrawColor( schema("fg") ) - surface.DrawRect( r_x, r_y+gump, r_w, r_h-gump ) - else - local gump = math.Round( r_h*(wr) ) - surface.SetDrawColor( schema("fg") ) - surface.DrawRect( r_x, r_y+gump, r_w, r_h-gump ) - end - - -- TODO: Unshitify this. - if wrt == 1 then - local gump1 = math.Round( r_h*(1-b1) ) - local gump2 = math.Round( r_h*(1-b2) ) - surface.SetDrawColor( 255, 100, 100, 100 ) - surface.DrawRect( r_x, r_y+gump2, r_w, gump1-gump2 ) - surface.SetDrawColor( 255, 100, 100 ) - surface.DrawRect( r_x, r_y+gump1, r_w, ss(1) ) - surface.DrawRect( r_x, r_y+gump2, r_w, ss(1) ) - end - end - end - end -end ) - -do - local qt = { - ["slot1"] = true, - ["slot2"] = true, - ["slot3"] = true, - ["slot4"] = true, - ["slot5"] = true, - ["slot6"] = true, - ["slot7"] = true, - ["slot8"] = true, - ["slot9"] = true, - ["slot0"] = true, - } - - hook.Add( "PlayerBindPress", "Benny_PlayerBindPress_Original", function( ply, bind, pressed, code ) - if qt[bind] and pressed then - return true - end - end) -end \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/player/sh_basic.lua b/gamemodes/benny/gamemode/modules/player/sh_basic.lua deleted file mode 100644 index aa47656..0000000 --- a/gamemodes/benny/gamemode/modules/player/sh_basic.lua +++ /dev/null @@ -1,131 +0,0 @@ - -if SERVER then - util.AddNetworkString( "benny_sendinvitem" ) - util.AddNetworkString( "benny_discardinvitem" ) -end - -function BENNY.CreateItem( classname ) - local class = ItemDef(classname) - - assert( class, "Invalid Class " .. tostring(classname) ) - - local item = { - Class = classname, - Acquisition = CurTime(), - } - - class.Init_Item( class, item ) - - --if class.Features == "firearm" then - -- item.Loaded = "" - --elseif class.Features == "magazine" then - -- item.Ammo = class.Ammo - --end - -- - return item -end - -concommand.Add("benny_debug_give", function(ply, cmd, args) - assert(SERVER, "not server") - local inv = ply:INV_Get() - local str = UUID_generate() - - local newitem = BENNY.CreateItem( args[1] ) - inv[str] = newitem - - -- PROTO: WriteTable. - net.Start( "benny_sendinvitem" ) - net.WriteString( str ) - net.WriteTable( newitem ) - net.Send( ply ) -end, -function(cmd, args) - args = string.Trim(args:lower()) - local meow = {} - for i, v in SortedPairs( ITEMS ) do - if string.lower(i):find(args) then - table.insert( meow, cmd .. " " .. i ) - end - end - return meow -end, "arg 1: classname") - -if CLIENT then - net.Receive( "benny_sendinvitem", function() - LocalPlayer():INV_Get()[net.ReadString()] = net.ReadTable() - end) - net.Receive( "benny_discardinvitem", function() - LocalPlayer():INV_Get()[net.ReadString()] = nil - end) -end - -function InvDiscard( ply, ID ) - local inv = ply:INV_Get() - local wep = ply:GetActiveWeapon() - local item = inv[ID] - -- PROTO: Check that this is the correct 'benny' weapon. - assert( item, "That item doesn't exist. " .. tostring(item) ) - - inv[ID] = nil - net.Start( "benny_discardinvitem" ) - net.WriteString( ID ) - net.Send( ply ) - - if wep:bGetInvID( false ) == ID then - print( "Disequipped " .. ID .. " for " .. tostring(wep) ) - wep:SetWep1( "" ) - wep:SetWep1_Clip( "" ) - wep:SetClip1( 0 ) - end - if wep:bGetInvID( true ) == ID then - print( "Disequipped " .. ID .. " for " .. tostring(wep) ) - wep:SetWep2( "" ) - wep:SetWep2_Clip( "" ) - wep:SetClip2( 0 ) - end - if wep:bGetMagInvID( false ) == ID then - print( "Unloaded " .. ID .. " for " .. tostring(wep) ) - inv[wep:bGetInvID( false )].Loaded = "" - wep:SetWep1_Clip( "" ) - wep:SetClip1( 0 ) - end - if wep:bGetMagInvID( true ) == ID then - print( "Unloaded " .. ID .. " for " .. tostring(wep) ) - inv[wep:bGetInvID( true )].Loaded = "" - wep:SetWep2_Clip( "" ) - wep:SetClip2( 0 ) - end -end - -concommand.Add("benny_inv_discard", function( ply, cmd, args ) - InvDiscard( ply, args[1] ) -end) - -hook.Add( "PlayerDeathSound", "Benny_PlayerDeathSound", function( ply ) - return true -- we don't want the default sound! -end ) - -if CLIENT then -hook.Add( "PlayerButtonDown", "Benny_PlayerButtonDown_Dev", function( ply, button ) - local wep = ply:BennyCheck() - - if IsFirstTimePredicted() then - if button == KEY_F1 then - OpenSettingsMenu() - elseif button == KEY_F2 then - OpenDebugInv() - elseif button == KEY_F3 then - OpenSMenu() - elseif button == KEY_F4 then - -- OpenDeadeye() - elseif button == KEY_F5 then - elseif button == KEY_F6 then - elseif button == KEY_F7 then - elseif button == KEY_F8 then - elseif button == KEY_F9 then - elseif button == KEY_F11 then - elseif button == KEY_F12 then - end - end -end) -end \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/player/sh_checker.lua b/gamemodes/benny/gamemode/modules/player/sh_checker.lua deleted file mode 100644 index e75da48..0000000 --- a/gamemodes/benny/gamemode/modules/player/sh_checker.lua +++ /dev/null @@ -1,182 +0,0 @@ - -local easywaycvar = CreateConVar( "benny_net_easyway", 0, FCVAR_ARCHIVE + FCVAR_REPLICATED, "Use a disgusting way of networking inventories for maximum duplication." ) -local easyway = easywaycvar:GetBool() -local UINTBITS = 8 - -if easyway then - if SERVER then - gameevent.Listen( "player_activate" ) - hook.Add( "player_activate", "Benny_Activate", function( data ) - Player(data.userid).CheckerReady = true - end ) - - local checkerinterval = 1 - util.AddNetworkString( "Benny_Checker" ) - - hook.Add( "PlayerTick", "Benny_Checker", function( ply ) - if ply.CheckerReady then - if (ply.CheckerLast or 0) + checkerinterval <= CurTime() then - local inv = ply:INV_Get() - net.Start( "Benny_Checker" ) - net.WriteUInt( table.Count(inv), UINTBITS ) - for i, v in pairs( inv ) do - net.WriteString( i ) - net.WriteTable( v ) - end - print( ply, net.BytesWritten() ) - net.Send( ply ) - ply.CheckerLast = CurTime() - end - end - end) - else -- client begin - net.Receive( "Benny_Checker", function( len, ply ) - local ply = LocalPlayer() - - local inv = ply:INV_Get() - local amt = net.ReadUInt( UINTBITS ) - for i=1, amt do - local id = net.ReadString() - inv[id] = net.ReadTable() - end - end) - end -- client end - -else -- hardway - -if SERVER then - gameevent.Listen( "player_activate" ) - hook.Add( "player_activate", "Benny_Activate", function( data ) - Player(data.userid).CheckerReady = true - end ) - - local checkerinterval = 1 - util.AddNetworkString( "Benny_Checker" ) - util.AddNetworkString( "Benny_Checker_CL_Request" ) - - hook.Add( "PlayerTick", "Benny_Checker", function( ply ) - if ply.CheckerReady then - if (ply.CheckerLast or 0) + checkerinterval <= CurTime() then - local inv = ply:INV_Get() - net.Start( "Benny_Checker" ) - net.WriteUInt( table.Count(inv), UINTBITS ) - for i, v in pairs( inv ) do - net.WriteString( i ) - - net.WriteBool( v.Loaded ) - if v.Loaded then net.WriteString( v.Loaded ) end - end - net.Send( ply ) - ply.CheckerLast = CurTime() - end - end - end) - - net.Receive("Benny_Checker_CL_Request", function( len, ply ) - if (ply.CheckerRequestBan or 0) <= CurTime() then - local amt = net.ReadUInt( UINTBITS ) - - local inv = ply:INV_Get() - local regenlist = {} - - -- Make sure they all exist first - for i=1, amt do - local id = net.ReadString() - if inv[id] then - table.insert( regenlist, id ) - else - -- Punish - print( ply, "The item the client requested, '" .. tostring(id) .."' didn't exist. Malicious?") -- Matters in public servers!! -- Not supporting for 5 seconds." ) - -- ply.CheckerRequestBan = CurTime() + 5 - -- return - end - end - - net.Start("Benny_Checker_CL_Request") - net.WriteUInt( #regenlist, UINTBITS ) - for i, id in ipairs( regenlist ) do - if inv[id] then - print( "Doing " .. id ) - net.WriteString( id ) - net.WriteTable( inv[id] ) - end - end - net.Send( ply ) - end - end) -else - net.Receive( "Benny_Checker", function( len, ply ) - local ply = LocalPlayer() - -- Get started - local amt = net.ReadUInt( UINTBITS ) - local evallist = {} - for i=1, amt do - local id = net.ReadString() - local loaded_exists = net.ReadBool() - local loaded = nil - if loaded_exists then - loaded = net.ReadString() - end - evallist[id] = loaded or true - end - - local inv = ply:INV_Get() - - -- Check which items DO NOT exist - local missinglist = {} - for i, v in pairs( evallist ) do - if inv[i] then - -- Success - if isstring(v) then - inv[i].Loaded = v - end - else - missinglist[i] = true - end - end - - -- Check any ghost items we have - local ghostlist = {} - for i, v in pairs( inv ) do - if evallist[i] then - -- Success - else - ghostlist[i] = true - end - end - - -- Regenerate missing items - if table.Count(missinglist) > 0 then - local concat = "" - for i, v in pairs( missinglist ) do - concat = concat .. "'" .. i .. "' " - end - print( "[".. string.FormattedTime( CurTime(), "%02i:%02i") .. "] [Checker]: You are missing items " .. concat ) - net.Start( "Benny_Checker_CL_Request" ) - net.WriteUInt( table.Count( missinglist ), UINTBITS ) - for i, v in pairs( missinglist ) do - net.WriteString( i ) - end - net.SendToServer() - end - - -- Remove ghost items - for i, v in pairs( ghostlist ) do - inv[i] = nil - print( "[".. string.FormattedTime( CurTime(), "%02i:%02i") .. "] [Checker]: Removed a ghost item with ID '" .. i .. "'" ) - end - end ) - net.Receive( "Benny_Checker_CL_Request", function( len, ply ) - local ply = LocalPlayer() - - local inv = ply:INV_Get() - local amt = net.ReadUInt( UINTBITS ) - for i=1, amt do - local id = net.ReadString() - print( "[".. string.FormattedTime( CurTime(), "%02i:%02i") .. "] [Checker]: Restoring " .. id ) - inv[id] = net.ReadTable() - end - end) -end - -end -- hardway \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/player/sh_hud.lua b/gamemodes/benny/gamemode/modules/player/sh_hud.lua deleted file mode 100644 index 37cfd0a..0000000 --- a/gamemodes/benny/gamemode/modules/player/sh_hud.lua +++ /dev/null @@ -1,74 +0,0 @@ - --- Predicted weapon switching - -local dads = { - [KEY_1] = 1, - [KEY_2] = 2, - [KEY_3] = 3, - [KEY_4] = 4, - [KEY_5] = 5, - [KEY_6] = 6, - [KEY_7] = 7, - [KEY_8] = 8, - [KEY_9] = 9, - [KEY_0] = 0, -} - -local function beatup( ply, num ) - local weighted = ply:INV_Weight() - local inv = ply:INV_Get() - local wep = ply:BennyCheck() - local iflip = table.Flip( inv ) - local hand = ply:KeyDown(IN_ZOOM) - - local invid = 0 - if CLIENT and !IsFirstTimePredicted() then return end - for _, item in pairs( weighted ) do - local class = ITEMS[item.Class] - local id = iflip[item] - if class.Equipable or class.Features == "firearm" or class.Features == "grenade" or class.Features == "melee" then - invid = invid + 1 - if num == 0 then num = 10 end - if num == invid then - if id == wep:bGetReqInvID( hand ) then - -- If we are selected our currently equipped weapon, holster it. - return wep:bSetReqInvID( hand, "" ) - else - if wep:bGetReqInvID( hand ) != "" then - -- Something is in this hand - - if wep:bGetReqInvID( !hand ) != "" then - -- Something in the other hand - wep:bSetReqInvID( !hand, wep:bGetReqInvID( hand ) ) - wep:bSetReqInvID( hand, id ) - return - else - -- Nothing in the other hand - wep:bSetReqInvID( !hand, "" ) - wep:bSetReqInvID( hand, id ) - return - end - else - -- Nothing in this hand. - if wep:bGetReqInvID( !hand ) == id then - -- Weapon we want is in the other hand. - wep:bSetReqInvID( !hand, "" ) - wep:bSetReqInvID( hand, id ) - return - end - end - return wep:bSetReqInvID( hand, id ) - end - end - end - end - return wep:bSetReqInvID( hand, "" ) -end - -hook.Add( "PlayerButtonDown", "Benny_PlayerButtonDown_Inv", function( ply, button ) - local wep = ply:BennyCheck() - - if dads[button] then - beatup( ply, dads[button] ) - end -end) \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/player/sh_movement.lua b/gamemodes/benny/gamemode/modules/player/sh_movement.lua deleted file mode 100644 index 5ca890c..0000000 --- a/gamemodes/benny/gamemode/modules/player/sh_movement.lua +++ /dev/null @@ -1,155 +0,0 @@ - --- Movement - -local blop = Angle() -if CLIENT then - lastmoveangle = lastmoveangle or 0 - lastmoveangle_lerp = lastmoveangle_lerp or nil - TPSOverride = TPSOverride or Angle() -end - -hook.Add( "PlayerNoClip", "Benny_PlayerNoClip", function( ply, desiredNoClipState ) - if CLIENT then - if desiredNoClipState then - ply:SetEyeAngles( TPSOverride ) - else - TPSOverride:Set( LocalPlayer():EyeAngles() ) - lastmoveangle = LocalPlayer():EyeAngles().y - lastmoveangle_lerp = LocalPlayer():EyeAngles().y - end - end -end) - -hook.Add( "InputMouseApply", "Benny_InputMouseApply", function( cmd, x, y, ang ) - local p = LocalPlayer() - local w = p:BennyCheck() - local cdis = false - if false and w and w:bWepClass( false ) and w:bWepClass( false ).Custom_DisableSpecialMovement and w:bWepClass( false ).Custom_DisableSpecialMovement( w ) then cdis = true end - if false and w and w:bWepClass( true ) and w:bWepClass( true ).Custom_DisableSpecialMovement and w:bWepClass( true ).Custom_DisableSpecialMovement( w ) then cdis = true end - if GetConVar("benny_cam_override"):GetString() != "" then cdis = true end - if p:NoclippingAndNotVaulting() then cdis = true end - if w and !cdis and (y!=0 or x!=0) then - TPSOverride:Add( Angle( y*0.022, -x*0.022, 0 ) ) - return true - end -end) - -hook.Add( "CreateMove", "Benny_CreateMove", function( cmd ) - if false and BENNY_ACTIVECAMERA and !LocalPlayer():NoclippingAndNotVaulting() then - 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 - - local ad = Vector( x, y, 0 ) - - local an = Angle() - an:Set( RenderAngles() ) - an.p = 0 - - local am = Angle() - am:Set( cmd:GetViewAngles() ) - am.p = 0 - - ad:Rotate( am ) - ad:Rotate( -an ) - - -- ad:Normalize() - -- ad:Mul(320) - - --cmd:ClearMovement() - cmd:SetForwardMove( ad.x ) - cmd:SetSideMove( ad.y ) - - if x != 0 or y != 0 then - local thing = Vector( x, -y, 0 ):Angle() - thing.y = thing.y + an.y - blop.y = math.ApproachAngle( blop.y, thing.y, FrameTime() * 360 ) - end - cmd:SetViewAngles( blop ) - - end - - local p = LocalPlayer() - local w = p:BennyCheck() - local cdis = false - --if w then - -- if w:bWepClass( false ) and w:bWepClass( false ).Custom_DisableSpecialMovement and w:bWepClass( false ).Custom_DisableSpecialMovement( w ) then cdis = true end - -- if w:bWepClass( true ) and w:bWepClass( true ).Custom_DisableSpecialMovement and w:bWepClass( true ).Custom_DisableSpecialMovement( w ) then cdis = true end - --end - if GetConVar("benny_cam_override"):GetString() != "" then cdis = true end - if LocalPlayer():NoclippingAndNotVaulting() then cdis = true end - if w and !cdis then -- FPS cam - local aimed = false--w:GetUserAim() - local opos, ang = p:CamSpot( TPSOverride ) - - 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 - - local moveintent - if lx != 0 or ly != 0 then - moveintent = Vector( ly * -320, lx * 320, 0 ) - else - moveintent = Vector( cmd:GetForwardMove(), cmd:GetSideMove(), 0 ) - end - - local dir_p, dir_y = lr>0, lu>0 - dir_p = dir_p and 1 or -1 - dir_y = dir_y and -1 or 1 - local look_p, look_y = dir_p * math.ease.InCirc( math.abs(lr) ), dir_y * math.ease.InCirc( math.abs(lu) ) - - -- ang:Add( Angle( cmd:GetMouseY()*0.022, -cmd:GetMouseX()*0.022, 0 ) ) - ang:Add( Angle( look_p * 180 * 0.5 * FrameTime(), look_y * 180 * FrameTime(), 0 ) ) - ang.p = math.Clamp( ang.p, -89.9, 89.9 ) - ang:Normalize() - - if aimed then - local tr = util.TraceLine( { - start = opos, - endpos = opos+(ang:Forward()*(2^16)), - filter = p, - mask = MASK_SHOT, - } ) - - local planner = (tr.HitPos-p:EyePos()):Angle() - planner:Normalize() - cmd:SetViewAngles( planner ) - lastmoveangle = planner.y - end - - if !aimed then - if !moveintent:IsEqualTol( vector_origin, 1 ) then - lastmoveangle = ang.y - moveintent:Angle().y - end - lastmoveangle_lerp = math.ApproachAngle( lastmoveangle_lerp or lastmoveangle, lastmoveangle, FrameTime() * 360 ) - cmd:SetViewAngles( Angle( ang.p, lastmoveangle_lerp, 0 ) ) - else - lastmoveangle_lerp = lastmoveangle - end - - local fixang = Angle() - fixang.y = cmd:GetViewAngles().y - ang.y - moveintent:Rotate( fixang ) - - - -- cmd:ClearMovement() - cmd:SetForwardMove( moveintent.x ) - cmd:SetSideMove( moveintent.y ) - end -end) - -function GM:PlayerNoClip() - return true -end \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua b/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua deleted file mode 100644 index cef5e45..0000000 --- a/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua +++ /dev/null @@ -1,207 +0,0 @@ - -local small = Vector( 1, 1, 1 ) -local smale = -small - -local moe = Vector( 0, 0, 1/16 ) - -local dmaxs = Vector( 1, 1, 1 ) -local dmins = -dmaxs -local dcol = Color( 255, 0, 255, 0 ) - -local dW = Color( 255, 255, 255, 0 ) -local dB = Color( 0, 0, 0, 0 ) -local dS = Color( 255, 0, 0, 0 ) -local dC = Color( 0, 0, 255, 0 ) - -hook.Add( "PlayerTick", "Benny_PlayerTick", function( ply, mv ) - if ply:GetVaultTransition() == 0 then - ply:SetVaultDebuff( math.Approach( ply:GetVaultDebuff(), 0, FrameTime()/0.25 ) ) - end -end) - -hook.Add( "SetupMove", "Benny_SetupMove", function( ply, mv, cmd ) - if !ply:OnGround() and mv:KeyDown( IN_DUCK ) then - local newbuttons = bit.band(mv:GetButtons(), bit.bnot(IN_DUCK)) - mv:SetButtons(newbuttons) - end -end) - -local function Vault_GetAngle( ply, pos, ang, vel ) - return true -end - -local VAULTCHECKDIST = 8 -local VAULTMOVEDIST = 32 - -local MAXVAULTHEIGHT = 64 - -local MAXVAULTHEIGHT_FUCKERY = MAXVAULTHEIGHT+1 -local MAXVAULTHEIGHT_V = Vector( 0, 0, MAXVAULTHEIGHT_FUCKERY ) - -if CLIENT then -hook.Add( "CreateMove", "Benny_ADV_CreateMove", function( cmd ) - local ply = LocalPlayer() - if ply:KeyDown( IN_SPEED ) then - cmd:AddKey( IN_ALT1 ) - end -end) -end - -hook.Add( "StartCommand", "Benny_StartCommand", function( ply, cmd ) -end) - -hook.Add( "Move", "Benny_Move", function( ply, mv ) - local ang = mv:GetMoveAngles() - local pos = mv:GetOrigin() - local vel = mv:GetVelocity() - - local speed = mv:GetMaxSpeed() * (1-ply:GetVaultDebuff()) - mv:SetMaxSpeed( speed ) - mv:SetMaxClientSpeed( speed ) - - local forw, side = mv:GetForwardSpeed(), mv:GetSideSpeed() - local ba, bb = ply:GetHull() - if ply:Crouching() then ba, bb = ply:GetHullDuck() end - - - local WishDir = Vector( forw, -side, 0 ):GetNormalized() - WishDir:Rotate( Angle( 0, ang.y, 0 ) ) - - local Target = Vector( pos ) - local TargetNor = Vector() - - if !WishDir:IsZero() then - TargetNor:Set( WishDir ) - elseif vel:Length2D() > 100 then - local NoZ = Vector( vel ) - NoZ.z = 0 - NoZ:Normalize() - TargetNor:Set( NoZ ) - else - local NoUp = Angle( ang ) - NoUp.p = 0 - TargetNor = NoUp:Forward() - end - - local CR = HSVToColor( math.Rand( 0, 360 ), 1, 1 ) - CR.a = 8 - --debugoverlay.Box( Target, ba, bb, 0, CR ) - - local Checker = Target + TargetNor*VAULTCHECKDIST - local Desire = Target + TargetNor*VAULTMOVEDIST - local T1 = util.TraceHull( { - start = Target, - endpos = Checker, - mins = ba, - maxs = bb, - filter = ply, - } ) - if CLIENT then vaultsave = false end - if ply:GetVaultDebuff() == 0 and !ply:NoclippingAndNotVaulting() and T1.Hit then -- A challenger approaches - - -- How tall is it, basically? We still need to do a ledge check - local T2 = util.TraceHull( { - start = Desire + MAXVAULTHEIGHT_V, - endpos = Desire, - mins = ba, - maxs = bb, - filter = ply, - } ) - -- debugoverlay.Box( T2.HitPos, ba, bb, 0, CR ) - - -- Let's check our vertical clearance - local Clearance = Vector( Target.x, Target.y, T2.HitPos.z ) - local T3 = util.TraceHull( { - start = Target, - endpos = Clearance, - mins = ba, - maxs = bb, - filter = ply, - } ) - -- debugoverlay.SweptBox( T3.StartPos, T3.HitPos, ba, bb, angle_zero, 0, CR ) - local VertClearance = T3.HitPos.z - T3.StartPos.z - - -- If we try to go so high and it's TOO high then give up - if VertClearance > ply:GetStepSize() and VertClearance <= MAXVAULTHEIGHT then - -- Trace from clearance to final - local T4 = util.TraceHull( { - start = T3.HitPos, - endpos = T2.HitPos, - mins = ba, - maxs = bb, - filter = ply, - } ) - -- debugoverlay.SweptBox( T4.StartPos, T4.HitPos, ba, bb, angle_zero, 0, CR ) - - local Compare1, Compare2 = Vector( Target.x, Target.y, 0 ), Vector( T4.HitPos.x, T4.HitPos.y, 0 ) - if !Compare1:IsEqualTol( Compare2, 1/16 ) then - if CLIENT then vaultsave = true end - - if mv:KeyDown( IN_JUMP ) then - ply:SetVaultPos1( ply:GetPos() ) - ply:SetVaultPos2( T4.HitPos ) - ply:SetVaultTransition( 1 ) - ply:SetVaultDebuff( 1 ) - ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, ply:SelectWeightedSequence( ACT_GMOD_GESTURE_BOW ), 0.75, true ) - --mv:SetOrigin( T4.HitPos ) - return true - end - end - end - end - - if ply:GetVaultTransition() != 0 then - ply:SetVaultTransition( math.Approach( ply:GetVaultTransition(), 0, FrameTime()/0.25 ) ) - local t, vp1, vp2 = ply:GetVaultTransition(), ply:GetVaultPos1(), ply:GetVaultPos2() - local Meow = Vector( Lerp( (1-t), vp1.x, vp2.x ), Lerp( (1-t), vp1.y, vp2.y ), Lerp( math.ease.OutQuint(1-t), vp1.z, vp2.z ) ) - mv:SetOrigin( Meow ) - mv:SetVelocity( Vector( 0, 0, 0 ) ) - ply:SetVaultDebuff( 1 ) - ply:SetMoveType( (ply:GetVaultTransition() == 0) and MOVETYPE_WALK or MOVETYPE_NOCLIP ) - return true - end - - local w = ply:BennyCheck() - local hand = false - if false and w and w:bWepClass( hand ) then - local targetspeed = mv:GetMaxSpeed() - - targetspeed = targetspeed * w:GetStat( hand, "Speed_Move" ) - - targetspeed = targetspeed * Lerp( w:GetAim(), 1, w:GetStat( hand, "Speed_Aiming" ) ) - - local st = w:bGetShotTime( hand ) - targetspeed = targetspeed * (st+w:GetStat( hand, "Speed_FiringTime" ) > CurTime() and w:GetStat( hand, "Speed_Firing" ) or 1) - - targetspeed = targetspeed * (w:bGetReloadTime( hand ) > 0 and w:GetStat( hand, "Speed_Reloading" ) or 1) - - mv:SetMaxSpeed( targetspeed ) - mv:SetMaxClientSpeed( targetspeed ) - end - - if ply:GetJumpBoost() == 0 then - if mv:KeyDown( IN_ALT1 ) then - local dig = Vector( mv:GetForwardSpeed()+0.01, mv:GetSideSpeed(), 0 ):GetNormalized() - local dug = Angle( 0, ply:EyeAngles().y, 0 ) - local upspeed = 180 - local movespeed = 250 - dig:Mul( movespeed ) - if !ply:OnGround() then upspeed = mv:GetVelocity().z end - ply:SetGroundEntity( NULL ) - mv:SetVelocity( dug:Forward()*dig.x + dug:Right()*dig.y + (vector_up*upspeed) ) - ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, ply:SelectWeightedSequence( ACT_GMOD_GESTURE_RANGE_ZOMBIE_SPECIAL ), 0.6, true ) - ply:SetJumpBoost( 1 ) - if CLIENT and IsFirstTimePredicted() then - ply:EmitSound( "weapons/slam/throw.wav", 70, 200, 0.5 ) - end - end - elseif ply:OnGround() then - if mv:KeyDown( IN_ALT1 ) then - ply:SetJumpBoost( -1 ) - else - ply:SetJumpBoost( 0 ) - end - end - - --debugoverlay.Box( Target+(TargetNor*16), ba, bb, 0, CR ) -end) \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/player/sh_player.lua b/gamemodes/benny/gamemode/modules/player/sh_player.lua deleted file mode 100644 index a510faa..0000000 --- a/gamemodes/benny/gamemode/modules/player/sh_player.lua +++ /dev/null @@ -1,356 +0,0 @@ - -function GM:PlayerSpawn( ply ) - player_manager.SetPlayerClass( ply, "player_benny" ) - ply:SetViewOffset( Vector( 0, 0, 64 ) ) - ply:SetViewOffsetDucked( Vector( 0, 0, 50 ) ) - ply:Give( "itemhandler" ) - - ply:SetStamina( 1 ) - - ply:SetCrouchedWalkSpeed( 0.3 ) - ply:SetDuckSpeed( 0.1 ) - ply:SetUnDuckSpeed( 0.1 ) - ply:SetSlowWalkSpeed( 100 ) - ply:SetWalkSpeed( 200 ) - ply:SetRunSpeed( 200 ) - ply:SetStepSize( 16 ) - ply:SetCanZoom( false ) - - ply:MakeCharacter() -end - -local PT = FindMetaTable( "Player" ) - -local bgl = { - ["benny"] = { - [0] = Vector( 0.275, 0.7, 0.7 ), - [1] = 17, - [2] = 7, - [3] = 2, - [4] = 11, - [5] = 3, - [6] = 0, - [7] = 0, - [8] = 3, - [9] = 0, - [10] = 0, - [11] = 0, - [12] = 3, - [13] = 0, - }, - ["nikki"] = { - [0] = Vector( 0.9, 0.3, 0.9 ), - [1] = 17, - [2] = 7, - [3] = 2, - [4] = 11, - [5] = 3, - [6] = 0, - [7] = 0, - [8] = 2, - [9] = 1, - [10] = 5, - [11] = 0, - [12] = 3, - [13] = 0, - }, - ["igor"] = { - [0] = Vector( 0.776, 0.929, 0.89 ), - [1] = 4, - [2] = 6, - [3] = 2, - [4] = 3, - [5] = 1, - [6] = 0, - [7] = 2, - [8] = 3, - [9] = 3, - [10] = 6, - [11] = 2, - [12] = 1, - [13] = 0, - }, - ["yanghao"] = { - [0] = Vector( 0.627, 0.21, 0.186 ), - [1] = 13, - [2] = 2, - [3] = 0, - [4] = 3, - [5] = 0, - [6] = 1, - [7] = 3, - [8] = 0, - [9] = 3, - [10] = 4, - [11] = 0, - [12] = 0, - [13] = 0, - }, - ["mp_cia"] = { - [0] = Vector( 1, 1, 1 ) - }, - ["mp_plasof"] = { - [0] = Vector( 1, 1, 1 ) - }, - ["mp_militia"] = { - [0] = Vector( 1, 1, 1 ) - }, - ["mp_natguard"] = { - [0] = Vector( 1, 1, 1 ) - }, - ["mp_viper"] = { - [0] = Vector( 1, 1, 1 ) - }, - ["mp_halo"] = { - [0] = Vector( 1, 1, 1 ) - }, -} - -function PT:MakeCharacter() - local char = ConVarSV_String("tempchar") - self:SetModel( "models/player/infoplayerrealism.mdl" ) - self:SetPlayerColor( bgl[char][0] ) - self:SetBodygroup( 0, 0 ) - self:SetSkin( 3 ) - for i, v in ipairs( bgl[char] ) do - self:SetBodygroup( i, v ) - end -end - -function PT:BennyCheck() - local wep = self:GetActiveWeapon() - return ( wep:IsValid() and wep:GetClass() == "itemhandler" and wep.GetActiveR ) and wep or false -end - -function PT:CamSpot( ang ) - local w = self:GetActiveWeapon() - if !IsValid( w ) then w = false end - - --local aim = w and w:GetAim() or 0 - --if w then aim = w:GetUserAim() and math.ease.OutCubic( aim ) or math.ease.InCubic( aim ) end - - local aim = 0 - - local pos = self:GetPos() - - local perc = math.TimeFraction( self:GetViewOffset().z, self:GetViewOffsetDucked().z, self:GetCurrentViewOffset().z ) - pos.z = pos.z + Lerp( perc, 64, 52 ) - - pos:Add( Lerp( aim, 16, 16 ) * ang:Right() ) - pos:Add( Lerp( aim, -64, -32 ) * ang:Forward() ) - pos:Add( 0 * ang:Up() ) - - pos:Add( Lerp( aim, 16, 16 ) * ang:Up() * (ang.p/90) ) - - local tr = util.TraceHull( { - start = self:GetPos() + Vector( 0, 0, Lerp( perc, 64, 52 ) ), - endpos = pos, - mins = -Vector( 4, 4, 4 ), - maxs = Vector( 4, 4, 4 ), - filter = self - }) - - return tr.HitPos, ang, 90 -end - -function PT:NoclippingAndNotVaulting() - return (self:GetMoveType() == MOVETYPE_NOCLIP and self:GetVaultTransition() == 0) -end - -function PT:INV_Get() - if !self.INV then - print( "Inventory created for " .. tostring(self) ) - self.INV = {} - end - return self.INV -end - -function PT:INV_Discard( id ) - if self:INV_Get()[ id ] then - self:INV_Get()[ id ] = nil - end -end - -SORTS = { - ["Acquisition"] = function( a, b ) return inv[b]["Acquisition"] > inv[a]["Acquisition"] end, -} - -function PT:INV_Find( class, exclude ) - local inv = self:INV_Get() - local results = {} - for i, v in pairs( inv ) do - if v.Class == class and i != (exclude or "") then - table.insert( results, i ) - end - end - -- PROTO: HOLY SHIT THIS SUCKS, MAKES A FUNCTION AND MIGHT RUN EVERY FRAME!!! - table.sort( results, function( a, b ) return inv[b]["Acquisition"] > inv[a]["Acquisition"] end ) - -- table.sort( results, SORTS["Acquisition"] ) - return results -end - -local T_WEIGHT = { - ["sniper"] = 45, - ["machinegun"] = 40, - ["rifle"] = 35, - ["shotgun"] = 30, - ["smg"] = 25, - ["pistol"] = 20, - ["melee"] = 15, - ["special"] = 10, - ["utility"] = 05, - ["equipment"] = 00, - ["grenade"] = -10, - ["magazine"] = -100, - ["base"] = -1000, -} - -function PT:INV_Weight() - local inv = self:INV_Get() - local results = {} - for i, v in pairs( inv ) do - if ITEMS[v.Class].Features != "magazine" then - table.insert( results, { inv[i], ITEMS[v.Class] } ) - end - end - -- PROTO: HOLY SHIT THIS SUCKS, MAKES A FUNCTION AND MIGHT RUN EVERY FRAME!!! - table.sort( results, function( a, b ) - return (T_WEIGHT[b[2]["Category"]] - b[1]["Acquisition"]*(1e-5)) - < (T_WEIGHT[a[2]["Category"]] - a[1]["Acquisition"]*(1e-5)) - end ) - local finale = {} - for i, v in ipairs( results ) do - table.insert( finale, v[1] ) - end - return finale -end - -function PT:INV_FindMag( class, exclude ) - local inv = self:INV_Get() - local results = {} - for i, v in pairs( inv ) do - -- PROTO: STANAG mags and such should share, and this'll need to be changed. - if v.Class == ("mag_" .. class) and (exclude and !exclude[i] or !exclude and true) then - table.insert( results, i ) - end - end - -- PROTO: HOLY SHIT THIS SUCKS, MAKES A FUNCTION AND MIGHT RUN EVERY FRAME!!! - table.sort( results, function( a, b ) return (inv[b]["Ammo"] - (inv[b]["Acquisition"]*(1e-5))) < (inv[a]["Ammo"] - (inv[a]["Acquisition"]*(1e-5))) end ) - return results -end - -function PT:INV_FindMagSmart( class, loader ) - local inv = self:INV_Get() - local loadm = inv[loader] - - local addexc = {} - for i, v in pairs( inv ) do - if v.Loaded and v.Loaded != "" then - addexc[v.Loaded] = true - end - end - local findmag = self:INV_FindMag( class, addexc ) - - local f_maginv = {} - if addexc[loadm.Loaded] or loadm.Loaded != "" then table.insert( f_maginv, loadm.Loaded ) end - for i, v in ipairs( findmag ) do - table.insert( f_maginv, v ) - end - - return f_maginv -end - -do - local translat = { - ["melee"] = { 1, 1 }, - ["special"] = { 1, 2 }, - ["pistol"] = { 2, 1 }, - ["smg"] = { 3, 1 }, - ["shotgun"] = { 4, 1 }, - ["sniper"] = { 5, 1 }, - ["rifle"] = { 5, 2 }, - ["machinegun"] = { 5, 3 }, - ["grenade"] = { 6, 1 }, - ["utility"] = { 6, 2 }, - ["equipment"] = { 7, 1 }, - ["magazine"] = { 8, 1 }, - ["base"] = { 8, 2 }, - } - - -- PROTO: Cache this! - function PT:INV_Buckets() - local inventorylist = { - [1] = {}, - [2] = {}, - [3] = {}, - [4] = {}, - [5] = {}, - [6] = {}, - [7] = {}, - [8] = {}, - } - -- PROTO: HOLY SHIT THIS SUCKS, MAKES A FUNCTION EVERY FRAME, AND RUNS EVERY FRAME!!! - local inv = self:INV_Get() - local function BucketSorter(a, b) - return (inv[b[1]]["Acquisition"] + (b[2]*10000)) > (inv[a[1]]["Acquisition"] + (a[2]*10000)) - end - for i, bucket in ipairs( inventorylist ) do - local temp = {} - for id, data in pairs( inv ) do - local idata = ITEMS[data.Class] - local translated = translat[idata.Category] - - if i == translated[1] then - table.insert( temp, { id, translated[2] } ) - end - end - table.sort( temp, BucketSorter ) - for i, v in ipairs( temp ) do - table.insert( bucket, v[1] ) - end - end - return inventorylist - end - function PT:INV_ListFromBuckets() - local buckets = self:INV_Buckets() - - local complete = {} - for n, bucket in ipairs( buckets ) do - for i, v in ipairs( bucket ) do - table.insert( complete, v ) - end - end - - return complete - end -end - --- weapon select - -hook.Add("StartCommand", "Benny_INV_StartCommand", function( ply, cmd ) - -- local wep = ply:BennyCheck() - -- if wep then - -- local hand = wep:GetTempHandedness() - -- local inv = ply:INV_Get() - -- local inv_bucketlist = ply:INV_ListFromBuckets() - -- local inv_bucketlist_flipped = table.Flip( inv_bucketlist ) - -- if CLIENT and ply.CLIENTDESIRE and inv[ply.CLIENTDESIRE ] and inv_bucketlist_flipped[ ply.CLIENTDESIRE ] then - -- cmd:SetUpMove( inv_bucketlist_flipped[ ply.CLIENTDESIRE ] ) - -- end - -- if CLIENT and (wep:bGetInvID( hand ) == ply.CLIENTDESIRE) then - -- ply.CLIENTDESIRE = 0 - -- print("Fixed") - -- end - -- local id = cmd:GetUpMove() - -- if id > 0 and inv_bucketlist[id] and inv[inv_bucketlist[id]] then - -- wep:BDeploy( hand, inv_bucketlist[ id ] ) - -- end - -- end -end) - - --- cmd:KeyDown( IN_WEAPON1 ) --- cmd:KeyDown( IN_WEAPON2 ) --- cmd:KeyDown( IN_BULLRUSH ) --- cmd:KeyDown( IN_GRENADE1 ) --- cmd:KeyDown( IN_GRENADE2 ) \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/player/sh_player_class.lua b/gamemodes/benny/gamemode/modules/player/sh_player_class.lua deleted file mode 100644 index d35c8a3..0000000 --- a/gamemodes/benny/gamemode/modules/player/sh_player_class.lua +++ /dev/null @@ -1,45 +0,0 @@ - -AddCSLuaFile() - -local PLAYER = {} - -PLAYER.DisplayName = "Benny Player Class" - -PLAYER.SlowWalkSpeed = 200 -PLAYER.WalkSpeed = 250 -PLAYER.RunSpeed = 280 -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:Init() - self.Player:AddEFlags( EFL_NO_DAMAGE_FORCES ) -end - -function PLAYER:SetupDataTables() - self.Player:NetworkVar( "Bool", 0, "Shoulder" ) - - self.Player:NetworkVar( "Int", 0, "JumpBoost" ) - - self.Player:NetworkVar( "Float", 0, "VaultDebuff" ) - self.Player:NetworkVar( "Float", 1, "VaultTransition" ) - self.Player:NetworkVar( "Float", 2, "Stamina" ) - - self.Player:NetworkVar( "Vector", 0, "VaultPos1") - self.Player:NetworkVar( "Vector", 1, "VaultPos2") - - self.Player:NetworkVar( "String", 0, "ReqID1") - self.Player:NetworkVar( "String", 1, "ReqID2") -end - -player_manager.RegisterClass( "player_benny", PLAYER, "player_default" ) diff --git a/gamemodes/benny/gamemode/modules/vgui/cl_bcategorycollapse.lua b/gamemodes/benny/gamemode/modules/vgui/cl_bcategorycollapse.lua deleted file mode 100644 index ba8f988..0000000 --- a/gamemodes/benny/gamemode/modules/vgui/cl_bcategorycollapse.lua +++ /dev/null @@ -1,318 +0,0 @@ - -local PANEL = { - Init = function( self ) - end, - - DoClick = function( self ) - self:GetParent():Toggle() - end, - - UpdateColours = function( self, skin ) - end, - - Paint = function( self ) - return true - end, - - GenerateExample = function() - end -} - -derma.DefineControl( "BCategoryHeader", "Category Header", PANEL, "DButton" ) - -local PANEL = {} - -AccessorFunc( PANEL, "m_bSizeExpanded", "Expanded", FORCE_BOOL ) -AccessorFunc( PANEL, "m_iContentHeight", "StartHeight" ) -AccessorFunc( PANEL, "m_fAnimTime", "AnimTime" ) -AccessorFunc( PANEL, "m_bDrawBackground", "PaintBackground", FORCE_BOOL ) -AccessorFunc( PANEL, "m_bDrawBackground", "DrawBackground", FORCE_BOOL ) -- deprecated -AccessorFunc( PANEL, "m_iPadding", "Padding" ) -AccessorFunc( PANEL, "m_pList", "List" ) - -function PANEL:Init() - - self.Header = vgui.Create( "BCategoryHeader", self ) - self.Header:Dock( TOP ) - self.Header:SetSize( ss(12), ss(12) ) - - self:SetSize( ss(8), ss(8) ) - self:SetExpanded( true ) - self:SetMouseInputEnabled( true ) - - self:SetAnimTime( 0.2 ) - self.animSlide = Derma_Anim( "Anim", self, self.AnimSlide ) - - self:SetPaintBackground( true ) -end - -function PANEL:Add( strName ) - - local button = vgui.Create( "DButton", self ) - button.Paint = function( panel, w, h ) end - button.UpdateColours = function( button, skin ) - - if ( button.AltLine ) then - - if ( button.Depressed || button.m_bSelected ) then return button:SetTextStyleColor( skin.Colours.Category.LineAlt.Text_Selected ) end - if ( button.Hovered ) then return button:SetTextStyleColor( skin.Colours.Category.LineAlt.Text_Hover ) end - return button:SetTextStyleColor( skin.Colours.Category.LineAlt.Text ) - - end - - if ( button.Depressed || button.m_bSelected ) then return button:SetTextStyleColor( skin.Colours.Category.Line.Text_Selected ) end - if ( button.Hovered ) then return button:SetTextStyleColor( skin.Colours.Category.Line.Text_Hover ) end - return button:SetTextStyleColor( skin.Colours.Category.Line.Text ) - - end - - button:SetHeight( ss(8) ) - button.DoClickInternal = function() - - if ( self:GetList() ) then - self:GetList():UnselectAll() - else - self:UnselectAll() - end - - button:SetSelected( true ) - - end - - button:Dock( TOP ) - - self:InvalidateLayout( true ) - self:UpdateAltLines() - - return button - -end - -function PANEL:UnselectAll() - - for k, v in ipairs( self:GetChildren() ) do - - if ( v.SetSelected ) then - v:SetSelected( false ) - end - - end - -end - -function PANEL:UpdateAltLines() - - for k, v in ipairs( self:GetChildren() ) do - v.AltLine = k % 2 != 1 - end - -end - -function PANEL:Think() - - self.animSlide:Run() - -end - -function PANEL:SetLabel( strLabel ) - - self.Header:SetText( strLabel ) - -end - -function PANEL:SetHeaderHeight( height ) - - self.Header:SetTall( height ) - -end - -function PANEL:GetHeaderHeight() - - return self.Header:GetTall() - -end - -function PANEL:Paint( w, h ) - local h1 = self:GetHeaderHeight() - local ex = self:GetExpanded() - if ex then - surface.SetDrawColor( schema( "fg" ) ) - surface.DrawRect( 0, 0, w, h1, ss(0.5) ) - else - surface.SetDrawColor( schema( "fg" ) ) - surface.DrawOutlinedRect( 0, 0, w, h1, ss(0.5) ) - end - - surface.SetDrawColor( schema( "fg" ) ) - surface.DrawOutlinedRect( 0, h1, w, h-h1, ss(0.5) ) - draw.SimpleText( (ex and "- " or "> "), "Benny_12", ss(3), ss(0.5), schema_c(ex and "bg" or "fg"), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) - draw.SimpleText( self.Header:GetText(), "Benny_12", ss(3+8), ss(1), schema_c(ex and "bg" or "fg"), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) - - return false - -end - -function PANEL:SetContents( pContents ) - - self.Contents = pContents - self.Contents:SetParent( self ) - self.Contents:Dock( FILL ) - - if ( !self:GetExpanded() ) then - - self.OldHeight = self:GetTall() - - elseif ( self:GetExpanded() && IsValid( self.Contents ) && self.Contents:GetTall() < 1 ) then - - self.Contents:SizeToChildren( false, true ) - self.OldHeight = self.Contents:GetTall() - self:SetTall( self.OldHeight ) - - end - - self:InvalidateLayout( true ) - -end - -function PANEL:SetExpanded( expanded ) - - self.m_bSizeExpanded = tobool( expanded ) - - if ( !self:GetExpanded() ) then - if ( !self.animSlide.Finished && self.OldHeight ) then return end - self.OldHeight = self:GetTall() - end - -end - -function PANEL:Toggle() - - self:SetExpanded( !self:GetExpanded() ) - - self.animSlide:Start( self:GetAnimTime(), { From = self:GetTall() } ) - - self:InvalidateLayout( true ) - self:GetParent():InvalidateLayout() - self:GetParent():GetParent():InvalidateLayout() - - local open = "1" - if ( !self:GetExpanded() ) then open = "0" end - self:SetCookie( "Open", open ) - - self:OnToggle( self:GetExpanded() ) - -end - -function PANEL:OnToggle( expanded ) - - -- Do nothing / For developers to overwrite - -end - -function PANEL:DoExpansion( b ) - - if ( self:GetExpanded() == b ) then return end - self:Toggle() - -end - -function PANEL:PerformLayout() - - if ( IsValid( self.Contents ) ) then - - if ( self:GetExpanded() ) then - self.Contents:InvalidateLayout( true ) - self.Contents:SetVisible( true ) - else - self.Contents:SetVisible( false ) - end - - end - - if ( self:GetExpanded() ) then - - if ( IsValid( self.Contents ) && #self.Contents:GetChildren() > 0 ) then self.Contents:SizeToChildren( false, true ) end - self:SizeToChildren( false, true ) - - else - - if ( IsValid( self.Contents ) && !self.OldHeight ) then self.OldHeight = self.Contents:GetTall() end - self:SetTall( self:GetHeaderHeight() ) - - end - - -- Make sure the color of header text is set - self.Header:ApplySchemeSettings() - - self.animSlide:Run() - self:UpdateAltLines() - -end - -function PANEL:OnMousePressed( mcode ) - - if ( !self:GetParent().OnMousePressed ) then return end - - return self:GetParent():OnMousePressed( mcode ) - -end - -function PANEL:AnimSlide( anim, delta, data ) - - self:InvalidateLayout() - self:InvalidateParent() - - if ( anim.Started ) then - if ( !IsValid( self.Contents ) && ( self.OldHeight || 0 ) < self.Header:GetTall() ) then - -- We are not using self.Contents and our designated height is less - -- than the header size, something is clearly wrong, try to rectify - self.OldHeight = 0 - for id, pnl in ipairs( self:GetChildren() ) do - self.OldHeight = self.OldHeight + pnl:GetTall() - end - end - - if ( self:GetExpanded() ) then - data.To = math.max( self.OldHeight, self:GetTall() ) - else - data.To = self:GetTall() - end - end - - if ( IsValid( self.Contents ) ) then self.Contents:SetVisible( true ) end - - self:SetTall( Lerp( delta, data.From, data.To ) ) - -end - -function PANEL:LoadCookies() - - local Open = self:GetCookieNumber( "Open", 1 ) == 1 - - self:SetExpanded( Open ) - self:InvalidateLayout( true ) - self:GetParent():InvalidateLayout() - self:GetParent():GetParent():InvalidateLayout() - -end - -function PANEL:GenerateExample( ClassName, PropertySheet, Width, Height ) - - local ctrl = vgui.Create( ClassName ) - ctrl:SetLabel( "Category List Test Category" ) - ctrl:SetSize( 300, 300 ) - ctrl:SetPadding( 10 ) - ctrl:SetHeaderHeight( 32 ) - - -- The contents can be any panel, even a DPanelList - local Contents = vgui.Create( "DButton" ) - Contents:SetText( "This is the content of the control" ) - ctrl:SetContents( Contents ) - - ctrl:InvalidateLayout( true ) - - PropertySheet:AddSheet( ClassName, ctrl, nil, true, true ) - -end - -derma.DefineControl( "BCollapsibleCategory", "Collapsable Category Panel", PANEL, "Panel" ) diff --git a/gamemodes/benny/gamemode/modules/vgui/cl_bframe.lua b/gamemodes/benny/gamemode/modules/vgui/cl_bframe.lua deleted file mode 100644 index 16c7c06..0000000 --- a/gamemodes/benny/gamemode/modules/vgui/cl_bframe.lua +++ /dev/null @@ -1,202 +0,0 @@ - -local tall = 12 -local PANEL = {} - -AccessorFunc( PANEL, "m_bIsMenuComponent", "IsMenu", FORCE_BOOL ) -AccessorFunc( PANEL, "m_bDraggable", "Draggable", FORCE_BOOL ) -AccessorFunc( PANEL, "m_bSizable", "Sizable", FORCE_BOOL ) -AccessorFunc( PANEL, "m_bScreenLock", "ScreenLock", FORCE_BOOL ) -AccessorFunc( PANEL, "m_bDeleteOnClose", "DeleteOnClose", FORCE_BOOL ) -AccessorFunc( PANEL, "m_bPaintShadow", "PaintShadow", FORCE_BOOL ) - -AccessorFunc( PANEL, "m_iMinWidth", "MinWidth", FORCE_NUMBER ) -AccessorFunc( PANEL, "m_iMinHeight", "MinHeight", FORCE_NUMBER ) - -AccessorFunc( PANEL, "m_bBackgroundBlur", "BackgroundBlur", FORCE_BOOL ) - -PANEL.Title = "No title" - -function PANEL:Init() - - self:SetFocusTopLevel( true ) - - self:SetPaintShadow( true ) - - self.btnClose = vgui.Create( "DButton", self ) - self.btnClose:SetText( "" ) - self.btnClose.DoClick = function ( button ) self:Close() end - self.btnClose.Paint = function( panel, w, h ) - surface.SetDrawColor( schema( "fg" ) ) - surface.DrawRect( 0, 0, w, h ) - - draw.SimpleText( "X", "Benny_10", ss(3.3), ss(0), schema_c( "bg" ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) - - return true - end - - self:SetDraggable( true ) - self:SetSizable( false ) - self:SetScreenLock( false ) - self:SetDeleteOnClose( true ) - self:SetTitle( "Window" ) - - self:SetMinWidth( ss(50) ) - self:SetMinHeight( ss(50) ) - - -- This turns off the engine drawing - self:SetPaintBackgroundEnabled( false ) - self:SetPaintBorderEnabled( false ) - - self.m_fCreateTime = SysTime() - - self:DockPadding( ss(2), ss(2+tall), ss(2), ss(2) ) - -end - -function PANEL:ShowCloseButton( bShow ) - self.btnClose:SetVisible( bShow ) -end - -function PANEL:GetTitle() - return self.Title -end - -function PANEL:SetTitle( strTitle ) - self.Title = strTitle -end - -function PANEL:Close() - - self:SetVisible( false ) - - if ( self:GetDeleteOnClose() ) then - self:Remove() - end - - self:OnClose() - -end - -function PANEL:OnClose() -end - -function PANEL:Center() - - self:InvalidateLayout( true ) - self:CenterVertical() - self:CenterHorizontal() - -end - -function PANEL:IsActive() - - if ( self:HasFocus() ) then return true end - if ( vgui.FocusedHasParent( self ) ) then return true end - - return false - -end - -function PANEL:Think() - - local mousex = math.Clamp( gui.MouseX(), 1, ScrW() - 1 ) - local mousey = math.Clamp( gui.MouseY(), 1, ScrH() - 1 ) - - if ( self.Dragging ) then - - local x = mousex - self.Dragging[1] - local y = mousey - self.Dragging[2] - - -- Lock to screen bounds if screenlock is enabled - if ( self:GetScreenLock() ) then - - x = math.Clamp( x, 0, ScrW() - self:GetWide() ) - y = math.Clamp( y, 0, ScrH() - self:GetTall() ) - - end - - self:SetPos( x, y ) - - end - - if ( self.Sizing ) then - - local x = mousex - self.Sizing[1] - local y = mousey - self.Sizing[2] - local px, py = self:GetPos() - - if ( x < self.m_iMinWidth ) then x = self.m_iMinWidth elseif ( x > ScrW() - px && self:GetScreenLock() ) then x = ScrW() - px end - if ( y < self.m_iMinHeight ) then y = self.m_iMinHeight elseif ( y > ScrH() - py && self:GetScreenLock() ) then y = ScrH() - py end - - self:SetSize( x, y ) - self:SetCursor( "sizenwse" ) - return - - end - - local screenX, screenY = self:LocalToScreen( 0, 0 ) - - if ( self.Hovered && self.m_bSizable && mousex > ( screenX + self:GetWide() - 20 ) && mousey > ( screenY + self:GetTall() - 20 ) ) then - - self:SetCursor( "sizenwse" ) - return - - end - - if ( self.Hovered && self:GetDraggable() && mousey < ( screenY + ss(tall) ) ) then - self:SetCursor( "sizeall" ) - return - end - - self:SetCursor( "arrow" ) - - -- Don't allow the frame to go higher than 0 - if ( self.y < 0 ) then - self:SetPos( self.x, 0 ) - end - -end - -function PANEL:Paint( w, h ) - surface.SetDrawColor( schema( "bg" ) ) - surface.DrawRect( 0, 0, w, h ) - - surface.SetDrawColor( schema( "fg" ) ) - surface.DrawOutlinedRect( 0, 0, w, ss(tall), ss(0.5) ) - - draw.SimpleText( self.Title, "Benny_12", ss(2), ss(1), schema_c( "fg" ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) - return true -end - -function PANEL:OnMousePressed() - - local screenX, screenY = self:LocalToScreen( 0, 0 ) - - if ( self.m_bSizable && gui.MouseX() > ( screenX + self:GetWide() - 20 ) && gui.MouseY() > ( screenY + self:GetTall() - 20 ) ) then - self.Sizing = { gui.MouseX() - self:GetWide(), gui.MouseY() - self:GetTall() } - self:MouseCapture( true ) - return - end - - if ( self:GetDraggable() && gui.MouseY() < ( screenY + ss(tall) ) ) then - self.Dragging = { gui.MouseX() - self.x, gui.MouseY() - self.y } - self:MouseCapture( true ) - return - end - -end - -function PANEL:OnMouseReleased() - - self.Dragging = nil - self.Sizing = nil - self:MouseCapture( false ) - -end - -function PANEL:PerformLayout() - self.btnClose:SetPos( self:GetWide() - ss(12+2), ss(2) ) - self.btnClose:SetSize( ss(12), ss(tall-4) ) -end - -derma.DefineControl( "BFrame", "A simple window", PANEL, "EditablePanel" ) diff --git a/gamemodes/benny/gamemode/shared.lua b/gamemodes/benny/gamemode/shared.lua index 4e8f2aa..54afc24 100644 --- a/gamemodes/benny/gamemode/shared.lua +++ b/gamemodes/benny/gamemode/shared.lua @@ -1,39 +1,14 @@ --- Thing - GM.Name = "Your Name Is Benny" -GM.Author = "Fesiug, Oranche" +GM.Author = "Fesiug, Oranche, Alex" GM.Email = "N/A" GM.Website = "N/A" BENNY = {} --- Load modules -local path = GM.FolderName .. "/gamemode/modules/" -local modules, folders = file.Find(path .. "*", "LUA") +local AC, IN = AddCSLuaFile, include -for _, folder in SortedPairs(folders, false) do - if folder == "." or folder == ".." then continue end - - -- Shared modules - for _, f in SortedPairs(file.Find(path .. folder .. "/sh_*.lua", "LUA"), false) do - AddCSLuaFile(path .. folder .. "/" .. f) - include(path .. folder .. "/" .. f) - end - - -- Server modules - if SERVER then - for _, f in SortedPairs(file.Find(path .. folder .. "/sv_*.lua", "LUA"), false) do - include(path .. folder .. "/" .. f) - end - end - - -- Client modules - for _, f in SortedPairs(file.Find(path .. folder .. "/cl_*.lua", "LUA"), false) do - AddCSLuaFile(path .. folder .. "/" .. f) - - if CLIENT then - include(path .. folder .. "/" .. f) - end - end -end \ No newline at end of file +AC("camera.lua") +IN("camera.lua") +AC("items.lua") +IN("items.lua") \ No newline at end of file diff --git a/gamemodes/benny/gamemode/sound/sh_basic.lua b/gamemodes/benny/gamemode/sound/sh_basic.lua deleted file mode 100644 index e69de29..0000000