From 044177b91ece71e947f59bf3d45f556a182b8af0 Mon Sep 17 00:00:00 2001 From: cale Date: Tue, 9 Feb 2016 13:13:44 +0100 Subject: [PATCH] finished new quest system --- mods/clans/init.lua | 2 +- mods/quests/init.lua | 27 +++++++++++++++++++++++++++ mods/story/api.lua | 6 +++--- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/mods/clans/init.lua b/mods/clans/init.lua index 9614f8b..76a0c9a 100644 --- a/mods/clans/init.lua +++ b/mods/clans/init.lua @@ -23,7 +23,7 @@ function clans.remove_member(clan_name, plname) end function clans.show_my_clans(plname) - str = "" + local str = "" for k,v in pairs(clans.all_clans) do for m,n in pairs(clans.all_clans[k]) do if n == plname then diff --git a/mods/quests/init.lua b/mods/quests/init.lua index 48f6445..6df27fe 100644 --- a/mods/quests/init.lua +++ b/mods/quests/init.lua @@ -38,6 +38,33 @@ function quests.add_quest(player, quest) table.insert(quests.player_quests[player], quest) end +quests.show_quests_form = "size[8,7.5;]" +quests.show_quests_form = quests.show_quests_form..default.gui_colors +quests.show_quests_form = quests.show_quests_form..default.gui_bg +quests.show_quests_form = quests.show_quests_form.."label[0,0;%s]" + +minetest.register_chatcommand("quests", { + params = "", + description = "Shows your quests", + privs = {}, + func = function(name, text) + if not quests.player_quests[name] then + local s = quests.show_quests_form + s = string.format(s, "You have not got any quests yet.") + minetest.show_formspec(name, "quests:show_quests", s) + return + end + local s = quests.show_quests_form + local txt = "" + for k,v in pairs(quests.player_quests[name]) do + txt = txt .. " -> " .. k.quest_type .. " " .. v.node .. " (" .. tostring(v.progress) .. "/" .. tostring(v.max) .. ")\n" + end + s = string.format(s, txt) + minetest.show_formspec(name, "quests:show_quests", s) + return true, "" + end, +}) + minetest.register_on_dignode(function(pos, oldnode, digger) if not digger or not digger:is_player() then return diff --git a/mods/story/api.lua b/mods/story/api.lua index 5a8d887..2ce9e6f 100644 --- a/mods/story/api.lua +++ b/mods/story/api.lua @@ -19,9 +19,9 @@ end story.talk_form = "size[8,7.5;]" story.talk_form = story.talk_form..default.gui_colors story.talk_form = story.talk_form..default.gui_bg -story.talk_form = story.talk_form.."image[0,0.0;3,8;story_player.png]" -story.talk_form = story.talk_form.."label[2.5,0;%s]" -story.talk_form = story.talk_form.."image[6,0.0;3,8;story_character_1.png]" +--story.talk_form = story.talk_form.."image[0,0.0;3,8;story_player.png]" +story.talk_form = story.talk_form.."label[0,0;%s]" +--story.talk_form = story.talk_form.."image[6,0.0;3,8;story_character_1.png]" story.get_talk_form = function(text) return string.format(story.talk_form, text)