mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-11 10:30:25 +01:00
Fix various quest issues
- Fix global variable 'quests' (quests/init.lua) - Fix minetest.register_on_dignode's function to handle the rare case where 'digger' == nil (mff/mff_quests/init.lua) - Made the only available quests (yet) more explicit (mff/mff_quests/init.lua)
This commit is contained in:
parent
25d748c244
commit
fd2582ed88
@ -17,9 +17,9 @@ mff.QPREFIX = "mff_quests:"
|
||||
|
||||
mff.quests.quests = {
|
||||
testdiggydiggyhole = {
|
||||
title = "Dig 10 nodes",
|
||||
title = "Dig 10 stone nodes",
|
||||
max = 10,
|
||||
desc = "As long as you can not dig, you are not a real miner.",
|
||||
desc = "As long as you can not dig stone, you are not a real miner.",
|
||||
periodicity = 10,
|
||||
objective = {
|
||||
dig = {"default:stone"}
|
||||
@ -84,6 +84,7 @@ end
|
||||
|
||||
-- For quests where you have to dig something, the updates happen here
|
||||
minetest.register_on_dignode(function(pos, oldnode, digger)
|
||||
if not digger then return end -- Already happened before
|
||||
local qstatus = mff.quests.quest_status[digger:get_player_name()]
|
||||
for qname, quest in pairs(mff.quests.quests) do
|
||||
if qstatus[qname] ~= nil and qstatus[qname] >= 0 then
|
||||
@ -116,4 +117,4 @@ end)
|
||||
|
||||
minetest.register_on_shutdown(function()
|
||||
-- TODO save data
|
||||
end)
|
||||
end)
|
||||
|
@ -1,5 +1,6 @@
|
||||
-- reading previous quests
|
||||
local file = io.open(minetest.get_worldpath().."/quests", "r")
|
||||
quests = {}
|
||||
if file then
|
||||
minetest.log("action", "Reading quests...")
|
||||
quests = minetest.deserialize(file:read("*all"))
|
||||
|
Loading…
Reference in New Issue
Block a user