Added more menu file loading system stuff

master
AlmTech 5 years ago
parent 14dd39e06c
commit e4bda2189b
  1. 2
      gamemode/cl_init.lua
  2. 4
      gamemode/engine/core/sh_player_binds.lua
  3. 3
      gamemode/engine/derma/cl_menu.lua
  4. 0
      gamemode/engine/derma/menus/menu_character.lua
  5. 4
      gamemode/engine/lib/server/sv_networking.lua
  6. 10
      gamemode/init.lua

@ -41,7 +41,7 @@ if CLIENT then
local function loadAllDermaMenus() local function loadAllDermaMenus()
local fol = GM.FolderName .. "/gamemode/engine/derma/" local fol = GM.FolderName .. "/gamemode/engine/derma/"
include( fol .. "/cl_menu.lua" ) include( fol .. "cl_menu.lua" )
end end
function Quantum.Client.Load() function Quantum.Client.Load()

@ -13,7 +13,7 @@ if SERVER then
Quantum.Debug( tostring( pl ) .. " pressed IN_USE" ) Quantum.Debug( tostring( pl ) .. " pressed IN_USE" )
end, end,
["openCharMenu"] = function( pl ) ["openCharMenu"] = function( pl )
Quantum.Net.OpenMenu( pl, "character", {} )
end end
} }
@ -21,6 +21,6 @@ if SERVER then
if( keyfuncs[key] ) then keyfuncs[key]( ply ) end if( keyfuncs[key] ) then keyfuncs[key]( ply ) end
end end
function GM:ShowHelp( ply ) function GM:ShowHelp( ply )
keyfuncs["openCharMenu"]( ply )
end end
end end

@ -6,8 +6,7 @@
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
net.Receive( "quantum_menu_net", function( len, pl ) net.Receive( "quantum_menu_net", function( len, pl )
local menu = net.ReadString()
local dt = net.ReadTable() local dt = net.ReadTable()
local menu = include( "lib/cl_" .. menu .. ".lua" ) local menu = include( "menus/menu_" .. dt.id .. ".lua" )
menu.open( dt ) menu.open( dt )
end) end)

@ -49,6 +49,10 @@ local function SendDatatableToClient( client, dt, type )
net.Send( client ) net.Send( client )
end end
function Quantum.Net.OpenMenu( pl, type, dt )
SendDatatableToClient( pl, dt, type )
end
local funcs = { local funcs = {
["createChar"] = true ["createChar"] = true
} }

@ -63,13 +63,13 @@ if SERVER then
end end
local function addAllDermaMenus() local function addAllDermaMenus()
AddCSLuaFile( fol .. "/cl_menu.lua" )
local fol = GM.FolderName .. "/gamemode/engine/derma/" local fol = GM.FolderName .. "/gamemode/engine/derma/"
local menuFiles = file.Find( fol .. "/lib/menu_*.lua", "LUA" ) AddCSLuaFile( fol .. "cl_menu.lua" )
local libfol = GM.FolderName .. "/gamemode/engine/derma/menus/"
local menuFiles = file.Find( libfol .. "menu_*.lua", "LUA" )
for _, file in pairs( menuFiles ) do for _, file in pairs( menuFiles ) do
AddCSLuaFile( fol .. "/" .. file ) AddCSLuaFile( libfol .. file )
end end
end end

Loading…
Cancel
Save