Added title for dialogue menu

master
E. Almqvist 5 years ago
parent 0bb0a092b1
commit 92c2258b19
  1. 4
      entities/entities/q_npc/init.lua
  2. 23
      gamemode/engine/derma/menus/menu_dialogue.lua
  3. 2
      gamemode/settings/sv_crafting_stations_locations.lua

@ -31,7 +31,7 @@ function ENT:Use( activator, caller )
if( self.node != nil ) then if( self.node != nil ) then
if( self.node.dialogueID ) then if( self.node.dialogueID ) then
-- open up dialogue menu -- 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 end
if( #self.node.voiceLines > 0 ) then if( #self.node.voiceLines > 0 ) then
self:EmitSound(self.node.voiceLines[math.random(1, #self.node.voiceLines)]) -- emit a voiceline 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
end end
end end

@ -40,16 +40,23 @@ function menu.open( dt )
Quantum.Client.Cam.Start( scenes, true, false ) Quantum.Client.Cam.Start( scenes, true, false )
local dialogue = Quantum.Dialogue.Get( dt.cont.dialogueID ) 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" ) local f = vgui.Create( "DFrame" )
f:SetSize( sw, sh ) f:SetSize( sw, sh )
f:SetTitle( "" ) f:SetTitle( "" )
f:ShowCloseButton( false ) f:ShowCloseButton( false )
local borderHeight = 90 * resScale
f.Paint = function( self, w, h ) f.Paint = function( self, w, h )
surface.SetDrawColor( Color( 20, 20, 20, 255 ) ) surface.SetDrawColor( Color( 20, 20, 20, 255 ) )
local height = 90 * resScale surface.DrawRect( 0, 0, w, borderHeight )
surface.DrawRect( 0, 0, w, height ) surface.DrawRect( 0, h - borderHeight, w, borderHeight )
surface.DrawRect( 0, h - height, w, height )
end end
f:SetDraggable( false ) f:SetDraggable( false )
f:MakePopup() f:MakePopup()
@ -70,9 +77,13 @@ function menu.open( dt )
end end
f.w, f.h = f:GetSize() f.w, f.h = f:GetSize()
local q = vgui.Create( "DLabel", f ) local title = vgui.Create( "DLabel", f ) -- dialogue title, useally the npcs name or something
q:SetText("Test") 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
end end

@ -5,4 +5,4 @@
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
Quantum.Server.Station.Register( "barrel", Vector( 3815.68359375, -1565.5415039063, -129.41325378418 ), Angle( 0, 173.51203918457, 0 ) ) Quantum.Server.Station.Register( "barrel", Vector( 3815.68359375, -1565.5415039063, -129.41325378418 ), Angle( 0, 173.51203918457, 0 ) )

Loading…
Cancel
Save