diff --git a/gamemode/engine/core/server/sv_player_init.lua b/gamemode/engine/core/server/sv_player_init.lua index 96501fc..e57273e 100644 --- a/gamemode/engine/core/server/sv_player_init.lua +++ b/gamemode/engine/core/server/sv_player_init.lua @@ -12,6 +12,8 @@ local ply = FindMetaTable( "Player" ) function GM:PlayerInitialSpawn( ply ) --ply.isloaded = true -- REMOVE THIS WHEN MYSQL DB IS ADDED -- load in all of the players characters and stuff from the MySQL DB + + Quantum.Net.OpenMenu( pl, "character", Quantum.Server.Char.GetPlayerChars( ply ) ) -- open the char select screen end local function setUpPlayer( ply ) @@ -28,8 +30,9 @@ end function GM:PlayerSpawn( ply ) - if( ply.isloaded ) then + if( !ply.isloaded ) then ply:Spectate( OBS_MODE_FIXED ) + -- set cinematic view here else ply:UnSpectate() setUpPlayer( ply ) diff --git a/gamemode/engine/core/sh_player_binds.lua b/gamemode/engine/core/sh_player_binds.lua index 5a969a3..cdd1b08 100644 --- a/gamemode/engine/core/sh_player_binds.lua +++ b/gamemode/engine/core/sh_player_binds.lua @@ -13,7 +13,7 @@ if SERVER then Quantum.Debug( tostring( pl ) .. " pressed IN_USE" ) end, ["openCharMenu"] = function( pl ) - Quantum.Net.OpenMenu( pl, "character", {} ) + Quantum.Net.OpenMenu( pl, "character", Quantum.Server.Char.GetPlayerChars( pl ) ) end } diff --git a/gamemode/engine/derma/cl_menu.lua b/gamemode/engine/derma/cl_menu.lua index d9b2968..8749668 100644 --- a/gamemode/engine/derma/cl_menu.lua +++ b/gamemode/engine/derma/cl_menu.lua @@ -15,6 +15,14 @@ Quantum.Client.Menu.GetAPI = function( lib ) return include( libs[lib] ) end net.Receive( "quantum_menu_net", function( len, pl ) local dt = net.ReadTable() -- TO DO: merge datatable with cached ( if same id/type ) + + if( Quantum.Client.EnableDebug ) then -- debug + Quantum.Debug( "Datatable size: " .. len/8 .. " bytes" ) + Quantum.Debug( "--Datatable contents--") + PrintTable( dt ) + Quantum.Debug( "--End of datatable contens--" ) + end + local menu = include( GAMEMODE.FolderName .. "/gamemode/engine/derma/menus/menu_" .. dt.id .. ".lua" ) menu.open( dt ) end) \ No newline at end of file diff --git a/gamemode/engine/derma/menus/menu_character.lua b/gamemode/engine/derma/menus/menu_character.lua index aead11e..efd11c5 100644 --- a/gamemode/engine/derma/menus/menu_character.lua +++ b/gamemode/engine/derma/menus/menu_character.lua @@ -26,16 +26,30 @@ local pages = { } local p, c = page.New( parent, args ) p:SetVisible( true ) + p.w, p.h = p:GetSize() c:SetSize( 85 * resScale, 25 * resScale ) - local closeW, closeH = c:GetSize() - c:SetPos( padding*4, (pH - closeH) - padding*4 ) + c.w, c.h = c:GetSize() + c:SetPos( (p.w - c.w) - padding*4, (p.h - c.h) - padding*4 ) c.DoClick = function() surface.PlaySound( "UI/buttonclick.wav" ) parent.page:SetVisible( true ) p:Remove() end + + local ip = vgui.Create( "DPanel", p ) -- input panel + ip:SetSize( 400 * resScale, p.h * 0.9 ) + ip.w, ip.h = ip:GetSize() + ip:SetPos( padding*4, p.h/2 - ip.h/2 ) + ip.Paint = function( self ) theme.blurpanel(self) end + + local inputs = {} + + -- input panel contens -- + + + return p, c end } @@ -96,23 +110,38 @@ function menu.open( dt ) header:SetTextColor( Color( 255, 255, 255, 255 ) ) header.Paint = function( self, w, h ) end - local chars = { - {name="Vernull", lvl=81, model="models/player/Group01/male_09.mdl"}, - {name="Devoe", lvl=22}, - {name="Leeroy", lvl=2} - } + local chars = {} local cpanels = {} local selectedChar local errorMdl = "models/player.mdl" - -- Char model - local mdl = vgui.Create( "DModelPanel", p ) - mdl:SetSize( 600 * resScale, 1000 * resScale ) - mdl.w, mdl.h = mdl:GetSize() - mdl:SetPos( p.w/2 - mdl.w/2, p.h/2 - mdl.h/2 ) - mdl:SetFOV( 55 ) - function mdl:LayoutEntity( ent ) return end + if( selectedChar ) then + -- Char model + local mdl = vgui.Create( "DModelPanel", p ) + mdl:SetSize( 600 * resScale, 1000 * resScale ) + mdl.w, mdl.h = mdl:GetSize() + mdl:SetPos( p.w/2 - mdl.w/2, p.h/2 - mdl.h/2 ) + mdl:SetFOV( 55 ) + function mdl:LayoutEntity( ent ) return end + + else + + local titles = { + "404 - Characters not found :(", + "No Characters Found" + } + + local info = vgui.Create( "DLabel", p ) + info:SetText( titles[ math.random( 1, #titles ) ] ) + info:SetFont( "q_header" ) + info:SizeToContents() + + info.w, info.h = info:GetSize() + + info:SetPos( p.w/2 - info.w/2, p.h/2 - info.h/2 ) + + end for k, v in pairs( chars ) do cpanels[k] = vgui.Create( "DButton", clist ) @@ -156,13 +185,14 @@ function menu.open( dt ) lvl:SetPos( txtX, txtY + lvlH ) end - mdl:SetModel( selectedChar.char.model ) -- set the char model - local minv, maxv = mdl.Entity:GetRenderBounds() - local eyepos = mdl.Entity:GetBonePosition( mdl.Entity:LookupBone( "ValveBiped.Bip01_Head1" ) ) - eyepos:Add( Vector( 40, 0, -15 ) ) - mdl:SetCamPos( eyepos - Vector( -10, 0, -2 ) ) - mdl:SetLookAt( eyepos ) - -- + if( selectedChar ) then + mdl:SetModel( selectedChar.char.model ) -- set the char model + local minv, maxv = mdl.Entity:GetRenderBounds() + local eyepos = mdl.Entity:GetBonePosition( mdl.Entity:LookupBone( "ValveBiped.Bip01_Head1" ) ) + eyepos:Add( Vector( 40, 0, -15 ) ) + mdl:SetCamPos( eyepos - Vector( -10, 0, -2 ) ) + mdl:SetLookAt( eyepos ) + end -- create char button local cr = vgui.Create( "DButton", p ) @@ -183,24 +213,25 @@ function menu.open( dt ) cr.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end - -- Delete char button - local dl = vgui.Create( "DButton", p ) - dl:SetText("Delete Character") - dl:SetFont( "q_text" ) - dl:SetTextColor( Color( 0, 0, 0, 255 ) ) - dl:SizeToContents() - dl.w, dl.h = dl:GetSize() - dl:SetPos( clist.x, clist.y + ( clist.h + dl.h ) ) - dl.Paint = function( self ) - theme.button( self ) - end - dl.DoClick = function() - surface.PlaySound( "UI/buttonclick.wav" ) - LocalPlayer():ChatPrint( "Comming soon!" ) - end - - dl.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end - + if( selectedChar ) then + -- Delete char button + local dl = vgui.Create( "DButton", p ) + dl:SetText("Delete Character") + dl:SetFont( "q_text" ) + dl:SetTextColor( Color( 0, 0, 0, 255 ) ) + dl:SizeToContents() + dl.w, dl.h = dl:GetSize() + dl:SetPos( clist.x, clist.y + ( clist.h + dl.h ) ) + dl.Paint = function( self ) + theme.button( self ) + end + dl.DoClick = function() + surface.PlaySound( "UI/buttonclick.wav" ) + LocalPlayer():ChatPrint( "Comming soon!" ) + end + + dl.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end + end end end diff --git a/gamemode/engine/lib/client/cl_config_vars.lua b/gamemode/engine/lib/client/cl_config_vars.lua index aa6de83..86af336 100644 --- a/gamemode/engine/lib/client/cl_config_vars.lua +++ b/gamemode/engine/lib/client/cl_config_vars.lua @@ -7,4 +7,5 @@ Quantum.Client.Config = {} Quantum.Client.Config.EnableHUD = true -Quantum.Client.ShowCrosshair = true \ No newline at end of file +Quantum.Client.ShowCrosshair = true +Quantum.Client.EnableDebug = true \ No newline at end of file diff --git a/gamemode/init.lua b/gamemode/init.lua index 36eafaf..49d2acd 100644 --- a/gamemode/init.lua +++ b/gamemode/init.lua @@ -7,6 +7,7 @@ if SERVER then AddCSLuaFile( "engine/sh_debug.lua" ) + AddCSLuaFile( "settings/sh_models.lua" ) AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) diff --git a/gamemode/settings/sh_models.lua b/gamemode/settings/sh_models.lua new file mode 100644 index 0000000..b4c25df --- /dev/null +++ b/gamemode/settings/sh_models.lua @@ -0,0 +1,33 @@ +-- __ _ _______ _ __ +-- / / /\ | | |__ __| | | \ \ +-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \ +-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > > +-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / +-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ + +Quantum.Models = { + NPC = {}, + Player = { + + Male = { + "models/player/Group01/male_01.mdl", + "models/player/Group01/male_02.mdl", + "models/player/Group01/male_03.mdl", + "models/player/Group01/male_04.mdl", + "models/player/Group01/male_05.mdl", + "models/player/Group01/male_06.mdl", + "models/player/Group01/male_07.mdl", + "models/player/Group01/male_08.mdl", + "models/player/Group01/male_09.mdl" + }, + + Female = { + "models/player/group01/female_01.mdl", + "models/player/group01/female_02.mdl", + "models/player/group01/female_03.mdl", + "models/player/group01/female_04.mdl", + "models/player/group01/female_05.mdl", + "models/player/group01/female_06.mdl" + } + } +} \ No newline at end of file diff --git a/gamemode/settings/sv_settings.lua b/gamemode/settings/sv_settings.lua index 40c13da..30bd68f 100644 --- a/gamemode/settings/sv_settings.lua +++ b/gamemode/settings/sv_settings.lua @@ -63,7 +63,7 @@ Quantum.Server.Settings.PainSounds.Male = { "vo/npc/male01/pain09.wav" } -Quantum.Server.Settings.DamageHurtSoundRepeatChance = 90 +Quantum.Server.Settings.DamageHurtSoundRepeatChance = 90 -- % Quantum.Server.Settings.IdlePainSounds = {} Quantum.Server.Settings.IdlePainSounds.Male = { diff --git a/gamemode/shared.lua b/gamemode/shared.lua index 0d3c0f5..6a324de 100644 --- a/gamemode/shared.lua +++ b/gamemode/shared.lua @@ -12,4 +12,6 @@ GM.Website = "N/A" Quantum = {} -include( "engine/sh_debug.lua" ) -- add the debug functions and stuff \ No newline at end of file +include( "engine/sh_debug.lua" ) -- add the debug functions and stuff + +include( "settings/sh_models.lua" ) \ No newline at end of file