finished new quest system

This commit is contained in:
cale 2016-02-09 13:13:44 +01:00
parent aa46029aef
commit 044177b91e
3 changed files with 31 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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)