diff --git a/gamemode/engine/derma/cl_menu.lua b/gamemode/engine/derma/cl_menu.lua index 4a5c4c9..61cd6e7 100644 --- a/gamemode/engine/derma/cl_menu.lua +++ b/gamemode/engine/derma/cl_menu.lua @@ -7,7 +7,7 @@ Quantum.Client.Menu = {} local libs = { - ["net"] = GAMEMODE.FolderName .. "/gamemode/engine/derma/lib/cl_network.lua" + ["net"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_network.lua" } Quantum.Client.Menu.GetAPI = function( lib ) return include( libs[lib] ) end diff --git a/gamemode/engine/derma/menus/menu_character.lua b/gamemode/engine/derma/menus/menu_character.lua index def1b51..a47f96d 100644 --- a/gamemode/engine/derma/menus/menu_character.lua +++ b/gamemode/engine/derma/menus/menu_character.lua @@ -9,29 +9,46 @@ local menu = {} local net = Quantum.Client.Menu.GetAPI( "net" ) +local resScale = Quantum.Client.ResolutionScale + function menu.open( dt ) local sw, sh = ScrW(), ScrH() + local padding = 10 * resScale if( !f ) then local f = vgui.Create( "DFrame" ) f:SetTitle( "Character Menu" ) f:SetSize( sw, sh ) + f.Paint = function( self, w, h ) + surface.SetDrawColor( 0, 0, 0, 190 ) + surface.DrawRect( 0, 0, w, h ) + end f:MakePopup() - local txt = vgui.Create( "DTextEntry", f ) - txt:SetText( "Enter name here" ) - txt:SetSize( 250, 25 ) - local txtW, txtH = txt:GetSize() - txt:SetPos( sw/2 - txtW/2, sh/2 - txtH/2 ) - local txtX, txtY = txt:GetPos() - - local b = vgui.Create( "DButton", f ) - b:SetText( "Create Char" ) - b:SizeToContents() - local bW, bH = b:GetSize() - b:SetPos( sw/2 - bW/2, txtY - bH ) - b.DoClick = function() - net.RunNetworkedFunc( "createChar", { name = txt:GetValue() } ) + + local clist = vgui.Create( "DPanel", f ) + clist:SetSize( 250 * resScale, 800 * resScale ) + clist.w, clist.h = clist:GetSize() + clist:SetPos( (sw - clist.w) - padding*2, sh/2 - clist.h/2 ) + clist.Paint = function( self, w, h ) + surface.SetDrawColor( 0, 0, 0, 200 ) + surface.DrawRect( 0, 0, w, h ) end + + -- local txt = vgui.Create( "DTextEntry", f ) + -- txt:SetText( "Enter name here" ) + -- txt:SetSize( 250, 25 ) + -- local txtW, txtH = txt:GetSize() + -- txt:SetPos( sw/2 - txtW/2, sh/2 - txtH/2 ) + -- local txtX, txtY = txt:GetPos() + + -- local b = vgui.Create( "DButton", f ) + -- b:SetText( "Create Char" ) + -- b:SizeToContents() + -- local bW, bH = b:GetSize() + -- b:SetPos( sw/2 - bW/2, txtY - bH ) + -- b.DoClick = function() + -- net.RunNetworkedFunc( "createChar", { name = txt:GetValue() } ) + -- end end end diff --git a/gamemode/engine/lib/server/sv_character.lua b/gamemode/engine/lib/server/sv_character.lua index a81c6f6..51b0455 100644 --- a/gamemode/engine/lib/server/sv_character.lua +++ b/gamemode/engine/lib/server/sv_character.lua @@ -35,9 +35,10 @@ function Quantum.Server.Char.Load( pl, index, tbl ) local id = pl:SteamID() .. ":" .. index if( Quantum.Server.Char.Players[ id ] ~= nil ) then Quantum.Server.Char.Players[ id ] = CreateCharTable( tbl ) -- create the character - Quantum.Server.Inventory.Create( Quantum.Server.Char.Players[ id ] ) -- give the character a inventory + Quantum.Server.Char.Players[ id ].inventory = tbl.inventory || Quantum.Server.Inventory.Create( Quantum.Server.Char.Players[ id ] ) -- give the character an inventory Quantum.Debug( "Created character (" .. id .. ")" ) + return Quantum.Server.Char.Players[ id ] else Quantum.Error( "Tried to duplicate character! Index already used. (" .. id .. ")" ) end