diff --git a/gamemode/cl_init.lua b/gamemode/cl_init.lua index 838dbda..37ea302 100644 --- a/gamemode/cl_init.lua +++ b/gamemode/cl_init.lua @@ -41,10 +41,7 @@ if CLIENT then local function loadAllDermaMenus() local fol = GM.FolderName .. "/gamemode/engine/derma/" - local clFiles = file.Find( fol .. "/cl_*.lua", "LUA" ) - for _, file in pairs( clFiles ) do - include( fol .. file ) - end + include( fol .. "/cl_menu.lua" ) end function Quantum.Client.Load() diff --git a/gamemode/engine/core/server/sv_player_init.lua b/gamemode/engine/core/server/sv_player_init.lua index e89377f..771b678 100644 --- a/gamemode/engine/core/server/sv_player_init.lua +++ b/gamemode/engine/core/server/sv_player_init.lua @@ -28,7 +28,7 @@ end function GM:PlayerSpawn( ply ) - if( ply.isloaded ) then + if( !ply.isloaded ) then ply:Spectate( OBS_MODE_FIXED ) else setUpPlayer( ply ) diff --git a/gamemode/engine/core/sh_player_binds.lua b/gamemode/engine/core/sh_player_binds.lua index 354bff6..2135f0d 100644 --- a/gamemode/engine/core/sh_player_binds.lua +++ b/gamemode/engine/core/sh_player_binds.lua @@ -11,12 +11,16 @@ if SERVER then local keyfuncs = { [IN_USE] = function( pl ) Quantum.Debug( tostring( pl ) .. " pressed IN_USE" ) + end, + ["openCharMenu"] = function( pl ) + end } function GM:KeyRelease( ply, key ) if( keyfuncs[key] ) then keyfuncs[key]( ply ) end end -else - -- + function GM:ShowHelp( ply ) + + end end \ No newline at end of file diff --git a/gamemode/engine/derma/cl_main_menu.lua b/gamemode/engine/derma/cl_menu.lua similarity index 62% rename from gamemode/engine/derma/cl_main_menu.lua rename to gamemode/engine/derma/cl_menu.lua index 046ada7..48c757a 100644 --- a/gamemode/engine/derma/cl_main_menu.lua +++ b/gamemode/engine/derma/cl_menu.lua @@ -5,11 +5,9 @@ -- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -local function mainMenu() - local sw, sh = ScrW(), ScrH() - if( !f ) then - local f = vgui.Create( "DFrame" ) - f:SetTitle( "Main Menu" ) - f:SetSize( sw, sh ) - end -end \ No newline at end of file +net.Receive( "quantum_menu_net", function( len, pl ) + local menu = net.ReadString() + local dt = net.ReadTable() + local menu = include( "lib/cl_" .. menu .. ".lua" ) + menu.open( dt ) +end) \ No newline at end of file diff --git a/gamemode/engine/derma/cl_character.lua b/gamemode/engine/derma/lib/cl_character.lua similarity index 94% rename from gamemode/engine/derma/cl_character.lua rename to gamemode/engine/derma/lib/cl_character.lua index e674201..e8c8335 100644 --- a/gamemode/engine/derma/cl_character.lua +++ b/gamemode/engine/derma/lib/cl_character.lua @@ -5,7 +5,9 @@ -- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -local function char_derma() +local menu = {} + +function menu.open( dt ) local sw, sh = ScrW(), ScrH() if( !f ) then local f = vgui.Create( "DFrame" ) @@ -27,4 +29,6 @@ local function char_derma() net.SendToServer() end end -end \ No newline at end of file +end + +return menu \ No newline at end of file diff --git a/gamemode/init.lua b/gamemode/init.lua index fa7697f..f2264e3 100644 --- a/gamemode/init.lua +++ b/gamemode/init.lua @@ -63,11 +63,15 @@ if SERVER then end local function addAllDermaMenus() + + AddCSLuaFile( fol .. "/cl_menu.lua" ) + local fol = GM.FolderName .. "/gamemode/engine/derma/" - local clFiles = file.Find( fol .. "/cl_*.lua", "LUA" ) - for _, file in pairs( clFiles ) do + local menuFiles = file.Find( fol .. "/lib/menu_*.lua", "LUA" ) + for _, file in pairs( menuFiles ) do AddCSLuaFile( fol .. "/" .. file ) end + end function Quantum.Server.Load()