diff --git a/gamemode/engine/derma/lib/cl_menu_dialogueBox.lua b/gamemode/engine/derma/lib/cl_menu_dialogueBox.lua index b116122..cfbc4a1 100644 --- a/gamemode/engine/derma/lib/cl_menu_dialogueBox.lua +++ b/gamemode/engine/derma/lib/cl_menu_dialogueBox.lua @@ -5,6 +5,8 @@ -- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ +-- This is mainly used for cinematic, do not confuse it with NPC dialogue + local log = {} local scale = Quantum.Client.ResolutionScale local padding = 10 * scale diff --git a/gamemode/engine/derma/menus/menu_dialogue.lua b/gamemode/engine/derma/menus/menu_dialogue.lua new file mode 100644 index 0000000..f615213 --- /dev/null +++ b/gamemode/engine/derma/menus/menu_dialogue.lua @@ -0,0 +1,24 @@ +-- __ _ _______ _ __ +-- / / /\ | | |__ __| | | \ \ +-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \ +-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > > +-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / +-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ + +local menu = {} + +local snm = Quantum.Client.Menu.GetAPI( "net" ) +local theme = Quantum.Client.Menu.GetAPI( "theme" ) + +local resScale = Quantum.Client.ResolutionScale +local sw, sh = ScrW(), ScrH() +local padding = 10 * resScale +local padding_s = 4 * resScale + +function menu.open( dt ) + if( !f ) then + + end +end + +return menu \ No newline at end of file diff --git a/gamemode/engine/lib/sh_dialogue.lua b/gamemode/engine/lib/sh_dialogue.lua index f023a01..25498e9 100644 --- a/gamemode/engine/lib/sh_dialogue.lua +++ b/gamemode/engine/lib/sh_dialogue.lua @@ -10,27 +10,37 @@ Quantum.Dialogue = {} Quantum.DialogueTbl = {} function Quantum.Dialogue.Create( id, tbl ) + tbl = tbl || {} local dialogue = { bye = tbl.bye || "Nevermind, goodbye.", - options = tbl.options || {} } Quantum.DialogueTbl[id] = dialogue return dialogue end + function Quantum.Dialogue.AddQuestion( id, qid, q ) - Quantum.DialogueTbl[id][qid] = { - question = q || "...", - response = {} - } - return qid + if CLIENT then + if( Quantum.DialogueTbl[id] == nil ) then + Quantum.Error("Dialogue '" .. tostring(id) .. "' does not exist! Can not add question to it.") + return + else + Quantum.DialogueTbl[id][qid] = { + question = q || "...", + response = {} + } + return qid + end + end end function Quantum.Dialogue.AddResponse( id, qid, tbl, order ) - table.insert(Quantum.DialogueTbl[id][qid].response, order, { - text = tbl.text || "...", - func = tbl.func, - newqID = tbl.newqID - }) -end \ No newline at end of file + if CLIENT then + table.insert(Quantum.DialogueTbl[id][qid].response, order, { + text = tbl.text || "...", + func = tbl.func, -- function to be ran on the client side + newqID = tbl.newqID -- if it leads to a new question, then forward it to its id, if nil then terminate conversation + }) + end +end diff --git a/gamemode/settings/sh_dialogues.lua b/gamemode/settings/sh_dialogues.lua new file mode 100644 index 0000000..b4f435f --- /dev/null +++ b/gamemode/settings/sh_dialogues.lua @@ -0,0 +1,36 @@ +-- __ _ _______ _ __ +-- / / /\ | | |__ __| | | \ \ +-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \ +-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > > +-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / +-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ + + +---- CREATE DIALOGUE INSTANCES UNDER THIS LINE ---- +Quantum.Dialogue.Create( "npc_generalvendor" ) + + Quantum.Dialogue.AddQuestion( "npc_generalvendor", "init", "What do you want?" ) + + Quantum.Dialogue.AddResponse( "npc_generalvendor", "init", { + text = "To do business.", + newqID = "sellorbuy", + func = function() + print("You pressed this response!") + end + }, 1 ) + + Quantum.Dialogue.AddQuestion( "npc_generalvendor", "sellorbuy", "What do you have in mind?" ) + + Quantum.Dialogue.AddResponse( "npc_generalvendor", "sellorbuy", { + text = "What do you have for sale?", + func = function() + print("You pressed this response! BUY") + end + }, 1 ) + + Quantum.Dialogue.AddResponse( "npc_generalvendor", "sellorbuy", { + text = "I would like to sell some things.", + func = function() + print("You pressed this response! SELL") + end + }, 2 ) \ No newline at end of file diff --git a/gamemode/settings/sv_nodes_locations.lua b/gamemode/settings/sv_nodes_locations.lua index 77cc3f9..7ce58f0 100644 --- a/gamemode/settings/sv_nodes_locations.lua +++ b/gamemode/settings/sv_nodes_locations.lua @@ -6,7 +6,8 @@ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -- NPC nodes -- -Quantum.Node.Register( "generalvendor", Vector( 12737.1484375, -12749.354492188, -287 ), Angle( 0, 90, 0 ) ) +Quantum.Node.Register( "generalvendor", Vector( 12737.1484375, -12749.354492188, -287 ), Angle( 0, 90, 0 ) ) -- Boat vendor +Quantum.Node.Register( "generalvendor", Vector( 3930.3623046875, 6764.8793945313, 16.03125 ), Angle( 0, -90, 0 ) ) -- Vendor at spawn -- Resource nodes -- Quantum.Node.Register( "stone", Vector( 14877.728515625, -916.02612304688, 768 ), Angle( 0, -139.03350830078, 0 ) ) \ No newline at end of file diff --git a/gamemode/shared.lua b/gamemode/shared.lua index 91b2591..ffe50f2 100644 --- a/gamemode/shared.lua +++ b/gamemode/shared.lua @@ -8,7 +8,7 @@ GM.Name = "Quantum Framework" GM.Author = "AlmTech" GM.Email = "elias@almtech.se" -GM.Website = "N/A" +GM.Website = "www.almtech.se" Quantum = {} Quantum.Version = "v0.5-beta"