From 92c2258b19f12966a82f750bb10e51e728a0c80f Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Sun, 24 May 2020 21:05:26 +0200 Subject: [PATCH] Added title for dialogue menu --- entities/entities/q_npc/init.lua | 4 ++-- gamemode/engine/derma/menus/menu_dialogue.lua | 23 ++++++++++++++----- .../sv_crafting_stations_locations.lua | 2 +- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/entities/entities/q_npc/init.lua b/entities/entities/q_npc/init.lua index 2ca365c..b6cc2af 100644 --- a/entities/entities/q_npc/init.lua +++ b/entities/entities/q_npc/init.lua @@ -31,7 +31,7 @@ function ENT:Use( activator, caller ) if( self.node != nil ) then if( self.node.dialogueID ) then -- open up dialogue menu - Quantum.Net.OpenMenu(activator, "dialogue", { ent = self, dialogueID = self.node.dialogueID }) + Quantum.Net.OpenMenu(activator, "dialogue", { ent = self, dialogueID = self.node.dialogueID, nodeid = self.node.id }) end if( #self.node.voiceLines > 0 ) then self:EmitSound(self.node.voiceLines[math.random(1, #self.node.voiceLines)]) -- emit a voiceline @@ -47,4 +47,4 @@ function ENT:OnTakeDamage( dmgInfo ) end end end -end \ No newline at end of file +end diff --git a/gamemode/engine/derma/menus/menu_dialogue.lua b/gamemode/engine/derma/menus/menu_dialogue.lua index ec386b3..64ccf9b 100644 --- a/gamemode/engine/derma/menus/menu_dialogue.lua +++ b/gamemode/engine/derma/menus/menu_dialogue.lua @@ -40,16 +40,23 @@ function menu.open( dt ) Quantum.Client.Cam.Start( scenes, true, false ) local dialogue = Quantum.Dialogue.Get( dt.cont.dialogueID ) + local node + if( dt.cont.nodeid != nil ) then + node = Quantum.Node.Get(dt.cont.nodeid) + else + Quantum.Error("Unable to fetch node table. Node ID is nil.") + return + end local f = vgui.Create( "DFrame" ) f:SetSize( sw, sh ) f:SetTitle( "" ) f:ShowCloseButton( false ) + local borderHeight = 90 * resScale f.Paint = function( self, w, h ) surface.SetDrawColor( Color( 20, 20, 20, 255 ) ) - local height = 90 * resScale - surface.DrawRect( 0, 0, w, height ) - surface.DrawRect( 0, h - height, w, height ) + surface.DrawRect( 0, 0, w, borderHeight ) + surface.DrawRect( 0, h - borderHeight, w, borderHeight ) end f:SetDraggable( false ) f:MakePopup() @@ -70,9 +77,13 @@ function menu.open( dt ) end f.w, f.h = f:GetSize() - local q = vgui.Create( "DLabel", f ) - q:SetText("Test") - + local title = vgui.Create( "DLabel", f ) -- dialogue title, useally the npcs name or something + title:SetText(node.name) + title:SetFont("q_header_s") + title:SetTextColor(Color(255, 255, 255, 120)) + title:SizeToContents() + title.w, title.h = title:GetSize() + title:SetPos( padding*2, borderHeight/2 - title.h/2 ) end end diff --git a/gamemode/settings/sv_crafting_stations_locations.lua b/gamemode/settings/sv_crafting_stations_locations.lua index f055540..0eb5d9b 100644 --- a/gamemode/settings/sv_crafting_stations_locations.lua +++ b/gamemode/settings/sv_crafting_stations_locations.lua @@ -5,4 +5,4 @@ -- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -Quantum.Server.Station.Register( "barrel", Vector( 3815.68359375, -1565.5415039063, -129.41325378418 ), Angle( 0, 173.51203918457, 0 ) ) \ No newline at end of file +Quantum.Server.Station.Register( "barrel", Vector( 3815.68359375, -1565.5415039063, -129.41325378418 ), Angle( 0, 173.51203918457, 0 ) )