1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-16 15:30:30 +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:
LeMagnesium 2015-07-24 11:02:35 +02:00
parent 25d748c244
commit fd2582ed88
2 changed files with 5 additions and 3 deletions

View File

@ -17,9 +17,9 @@ mff.QPREFIX = "mff_quests:"
mff.quests.quests = { mff.quests.quests = {
testdiggydiggyhole = { testdiggydiggyhole = {
title = "Dig 10 nodes", title = "Dig 10 stone nodes",
max = 10, 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, periodicity = 10,
objective = { objective = {
dig = {"default:stone"} dig = {"default:stone"}
@ -84,6 +84,7 @@ end
-- For quests where you have to dig something, the updates happen here -- For quests where you have to dig something, the updates happen here
minetest.register_on_dignode(function(pos, oldnode, digger) 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()] local qstatus = mff.quests.quest_status[digger:get_player_name()]
for qname, quest in pairs(mff.quests.quests) do for qname, quest in pairs(mff.quests.quests) do
if qstatus[qname] ~= nil and qstatus[qname] >= 0 then if qstatus[qname] ~= nil and qstatus[qname] >= 0 then

View File

@ -1,5 +1,6 @@
-- reading previous quests -- reading previous quests
local file = io.open(minetest.get_worldpath().."/quests", "r") local file = io.open(minetest.get_worldpath().."/quests", "r")
quests = {}
if file then if file then
minetest.log("action", "Reading quests...") minetest.log("action", "Reading quests...")
quests = minetest.deserialize(file:read("*all")) quests = minetest.deserialize(file:read("*all"))