Networking stuff for menus and caching

master
AlmTech 5 years ago
parent 02bb941531
commit 3c704e7ee0
  1. 2
      gamemode/engine/derma/cl_menu.lua
  2. 21
      gamemode/engine/lib/server/sv_openmenu.lua

@ -14,7 +14,7 @@ local libs = {
Quantum.Client.Menu.GetAPI = function( lib ) return include( libs[lib] ) end
net.Receive( "quantum_menu_net", function( len, pl )
local dt = net.ReadTable()
local dt = net.ReadTable() -- TO DO: merge datatable with cached ( if same id/type )
local menu = include( GAMEMODE.FolderName .. "/gamemode/engine/derma/menus/menu_" .. dt.id .. ".lua" )
menu.open( dt )
end)

@ -0,0 +1,21 @@
-- __ _ _______ _ __
-- / / /\ | | |__ __| | | \ \
-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \
-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > >
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
local menus = {
character = function( pl )
Quantum.Net.OpenMenu( pl, "character", Quantum.Server.Char.GetPlayerChars( pl ) )
end
}
function Quantum.Server.OpenMenu( pl, menu )
if( menus[menu] ) then
menus[menu]( pl )
else
Quantum.Error( "Tried to open a non-exsistent menu for " .. tostring(pl) .. "." )
end
end
Loading…
Cancel
Save