From 1c8a37a29a991add9a117f5da8c9131cededf508 Mon Sep 17 00:00:00 2001 From: AlmTech Date: Wed, 16 Oct 2019 22:16:17 +0200 Subject: [PATCH] Improved theme stuff & character classes --- .../engine/derma/menus/menu_character.lua | 29 ++++++++++--------- gamemode/settings/sh_settings.lua | 6 +++- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/gamemode/engine/derma/menus/menu_character.lua b/gamemode/engine/derma/menus/menu_character.lua index 74acaeb..3f77d6f 100644 --- a/gamemode/engine/derma/menus/menu_character.lua +++ b/gamemode/engine/derma/menus/menu_character.lua @@ -24,7 +24,13 @@ local function getClassModels( class ) end end local function getMaxModel( tbl, index ) return tbl[math.Clamp( index, 1, #tbl )] end - +local function renderSelectedButton( b, sel ) + if( sel ) then + b:SetTextColor( Color( 252, 248, 212 ) ) + else + b:SetTextColor( Color( 255, 255, 255 ) ) + end +end local pages = { charCreate = function( parent ) @@ -116,10 +122,7 @@ local pages = { gbuttons.female:SetFont( "q_button2" ) gbuttons.female.Paint = function( self, w, h ) theme.sharpbutton( self ) - if( selectedGenderButton == self ) then - surface.SetDrawColor( 100, 100, 100, 100 ) - surface.DrawRect( 0, 0, w, h ) - end + renderSelectedButton( self, selectedGenderButton == self ) end gbuttons.female:SizeToContents() gbuttons.female.w, gbuttons.female.h = gbuttons.female:GetSize() @@ -144,10 +147,7 @@ local pages = { gbuttons.male.Paint = function( self, w, h ) theme.sharpbutton( self ) - if( selectedGenderButton == self ) then - surface.SetDrawColor( 100, 100, 100, 100 ) - surface.DrawRect( 0, 0, w, h ) - end + renderSelectedButton( self, selectedGenderButton == self ) end gbuttons.male.DoClick = function( self ) if( selectedGenderButton ~= self ) then @@ -167,7 +167,7 @@ local pages = { local classButtons = {} local classCount = 0 - for n, class in pairs( Quantum.Classes ) do + for id, class in pairs( Quantum.Classes ) do classCount = classCount + 1 -- keep count classButtons[classCount] = vgui.Create( "DButton", cscroll ) classButtons[classCount].class = class @@ -181,8 +181,8 @@ local pages = { classButtons[classCount]:SetPos( cscroll.w/2 - classButtons[classCount].w/2, (classCount-1) * ( padding + classButtons[classCount].h ) ) classButtons[classCount].Paint = function( self ) theme.sharpbutton( self, Color( 0, 0, 0, 0 ) ) end classButtons[classCount].DoClick = function( self ) - if( inputs.class ~= class ) then - inputs.class = class + if( inputs.class ~= id ) then + inputs.class = id surface.PlaySound( "UI/buttonclick.wav" ) end end @@ -198,8 +198,9 @@ local pages = { mdl:SetLookAt( eyepos ) mdl.Think = function( self ) - if( self:GetModel() ~= getMaxModel( getClassModels( inputs.class )[inputs.gender], inputs.modelIndex ) ) then - self:SetModel( getMaxModel( getClassModels( inputs.class )[inputs.gender], inputs.modelIndex ) ) + --getClassModels(inputs.class) + if( self:GetModel() ~= getMaxModel( getClassModels(inputs.class)[inputs.gender], inputs.modelIndex ) ) then + self:SetModel( getMaxModel( getClassModels(inputs.class)[inputs.gender], inputs.modelIndex ) ) end end diff --git a/gamemode/settings/sh_settings.lua b/gamemode/settings/sh_settings.lua index cf47709..04a67a9 100644 --- a/gamemode/settings/sh_settings.lua +++ b/gamemode/settings/sh_settings.lua @@ -29,6 +29,10 @@ Quantum.Models = { "models/player/group01/female_05.mdl", "models/player/group01/female_06.mdl" } + }, + Nobleman = { + Male = { "models/player/breen.mdl" }, + Female = { "models/player/alyx.mdl" } } } } @@ -42,7 +46,7 @@ Quantum.Classes = { Nobleman = { Name = "Nobleman", Desc = "A nobleman is someone who originates from a family of wealth and power and tend to look down upon those who are not 'fit' in their eyes. They often expects everyone to do their bidding without question.", - Models = Quantum.Models.Player.Citizen -- change this to better models + Models = Quantum.Models.Player.Nobleman -- change this to better models }, Worker = { Name = "Worker",