1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-01-24 00:40:20 +01:00

Merge branch 'master' of github.com:MinetestForFun/minetest-minetestforfun-server

This commit is contained in:
fabienwang 2015-09-06 19:55:17 +02:00
commit 1cff87fd2d
4 changed files with 90 additions and 57 deletions

View File

@ -1803,8 +1803,8 @@ minetest.register_node("default:torch", {
}) })
local chest_formspec = local chest_formspec =
"size[8,9]".. "size[8,9]" ..
default.gui_slots .. default.gui_bg ..
default.gui_bg_img .. default.gui_bg_img ..
default.gui_slots .. default.gui_slots ..
"list[current_name;main;0,0.3;8,4;]" .. "list[current_name;main;0,0.3;8,4;]" ..
@ -1812,8 +1812,7 @@ local chest_formspec =
"list[current_player;main;0,6.08;8,3;8]" .. "list[current_player;main;0,6.08;8,3;8]" ..
"listring[current_name;main]" .. "listring[current_name;main]" ..
"listring[current_player;main]" .. "listring[current_player;main]" ..
default.get_hotbar_bg(0, 4.85) .. default.get_hotbar_bg(0,4.85)
default.get_hotbar_bg(0, 5.85)
local function get_locked_chest_formspec(pos) local function get_locked_chest_formspec(pos)
local spos = pos.x .. "," .. pos.y .. "," .. pos.z local spos = pos.x .. "," .. pos.y .. "," .. pos.z
@ -1823,12 +1822,11 @@ local function get_locked_chest_formspec(pos)
default.gui_bg_img .. default.gui_bg_img ..
default.gui_slots .. default.gui_slots ..
"list[nodemeta:".. spos .. ";main;0,0.3;8,4;]".. "list[nodemeta:".. spos .. ";main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,4;]".. "list[current_player;main;0,4.85;8,1;]"..
"list[current_player;main;0,6.08;8,3;8]" .. "list[current_player;main;0,6.08;8,3;8]" ..
"listring[nodemeta:" .. spos .. ";main]" .. "listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]" .. "listring[current_player;main]" ..
default.get_hotbar_bg(0, 4.85) .. default.get_hotbar_bg(0,4.85)
default.get_hotbar_bg(0, 5.85)
return formspec return formspec
end end
@ -1875,7 +1873,6 @@ minetest.register_node("default:chest", {
end, end,
}) })
minetest.register_node("default:chest_locked", { minetest.register_node("default:chest_locked", {
description = "Locked Chest", description = "Locked Chest",
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
@ -1883,6 +1880,7 @@ minetest.register_node("default:chest_locked", {
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {choppy = 2, oddly_breakable_by_hand = 2}, groups = {choppy = 2, oddly_breakable_by_hand = 2},
legacy_facedir_simple = true, legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
@ -1949,7 +1947,6 @@ minetest.register_node("default:chest_locked", {
minetest.log("action", player:get_player_name() .. minetest.log("action", player:get_player_name() ..
" takes stuff from locked chest at " .. minetest.pos_to_string(pos)) " takes stuff from locked chest at " .. minetest.pos_to_string(pos))
end, end,
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if has_locked_chest_privilege(meta, clicker) then if has_locked_chest_privilege(meta, clicker) then
@ -1960,7 +1957,6 @@ minetest.register_node("default:chest_locked", {
) )
end end
end, end,
on_blast = function() end, on_blast = function() end,
}) })

View File

@ -634,6 +634,17 @@ columnia.register_column_ia("wood", "default:wood",
"Wooden Column Linkdown", "Wooden Column Linkdown",
default.node_sound_wood_defaults()) default.node_sound_wood_defaults())
columnia.register_column_ia("tree", "default:tree",
{choppy = 2, oddly_breakable_by_hande = 1, flammable = 2},
{"default_tree.png"},
"Tree Column",
"Tree Column Top",
"Tree Column Bottom",
"Tree Column Crosslink",
"Tree Column Link",
"Tree Column Linkdown",
default.node_sound_wood_defaults())
columnia.register_column_ia("junglewood", "default:junglewood", columnia.register_column_ia("junglewood", "default:junglewood",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}, {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"default_junglewood.png"}, {"default_junglewood.png"},

View File

@ -448,6 +448,14 @@ function homedecor.flip_door(pos, node, player, name, side, isClosed)
local rside = nil local rside = nil
local nfdir = nil local nfdir = nil
local ofdir = node.param2 or 0 local ofdir = node.param2 or 0
-- //MFF_BEGIN(Mg|09/06/15)
local upnode = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name
if upnode ~= "air" then
minetest.add_item(pos, upnode)
end
-- //MFF_END(Mg|06/09/15)
if side == "left" then if side == "left" then
rside = "right" rside = "right"
nfdir=ofdir - 1 nfdir=ofdir - 1

View File

@ -13,18 +13,9 @@ mff.quests.quests = {
awards = {["maptools:superapple"] = 1}, awards = {["maptools:superapple"] = 1},
tasks = { tasks = {
diggy = { diggy = {
title = "Dig 99 stone", title = "Dig 100 stone",
description = "Show you can dig through stone", description = "Show you can dig through stone",
max = 99, max = 100,
objective = {
dig = {"default:stone"}
}
},
diggysrevenge = {
title = "Dig the last stone",
description = "You really thought 99 was a good number? Dig the last one.",
requires = {"diggy"},
max = 1,
objective = { objective = {
dig = {"default:stone"} dig = {"default:stone"}
} }
@ -38,18 +29,9 @@ mff.quests.quests = {
awards = {["default:diamond"] = 1}, awards = {["default:diamond"] = 1},
tasks = { tasks = {
diggy = { diggy = {
title = "Dig 19 coal", title = "Dig 20 coal",
description = "Get the fire mineral", description = "Get the fire mineral",
max = 19, max = 20,
objective = {
dig = {"default:stone_with_coal"}
}
},
diggysrevenge = {
title = "Dig the last one",
description = "I do this because of a technical issue, sorry",
requires = {"diggy"},
max = 1,
objective = { objective = {
dig = {"default:stone_with_coal"} dig = {"default:stone_with_coal"}
} }
@ -63,18 +45,9 @@ mff.quests.quests = {
awards = {["moreores:mithril_ingot"] = 1}, awards = {["moreores:mithril_ingot"] = 1},
tasks = { tasks = {
diggy = { diggy = {
title = "Dig 4 diamond", title = "Dig 5 diamonds",
description = "Yarr harr fiddle dee-dee, being a pirate is alright with me! Do what you want 'cause a pirate is free, you are a pirate! Go get the precious booty... underground. Mine it :/", description = "Yarr harr fiddle dee-dee, being a pirate is alright with me! Do what you want 'cause a pirate is free, you are a pirate! Go get the precious booty... underground. Mine it :/",
max = 4, max = 5,
objective = {
dig = {"default:stone_with_diamond"}
}
},
diggysrevenge = {
title = "Ultimate calbon atom alignement",
description = "Really, we must fix this",
requires = {"diggy"},
max = 1,
objective = { objective = {
dig = {"default:stone_with_diamond"} dig = {"default:stone_with_diamond"}
} }
@ -111,27 +84,72 @@ for qname, quest in pairs(mff.quests.quests) do
local ret = quests.register_quest(mff.QPREFIX .. qname, quest) local ret = quests.register_quest(mff.QPREFIX .. qname, quest)
end end
-- TODO -- The callback function parameters are as follows:
-- implement magical iterator, going through BOTH the simple quests -- questname, questdef,
-- AND tasked quests objectives, returning a tuple like this: -- taskname (nil?), taskdef (nil?),
-- questname, questdef, taskname (nil?), taskdef (nil?), objective_container (that is, either questdef or taskdef), pointer_to_function_to_update_the_objective_progress_with_only_one_parameter_the_others_being_automagically_passed_to_the_quests_API_so_that_we_dont_have_to_write_ifs_and_elses_everywhere_to_handle_both_quest_and_tasks_cases_because_it_would_give_crap_code -- objective_container (that is, either questdef or taskdef),
-- objective (=objectives_container.objectives),
minetest.register_on_dignode(function(pos, oldnode, digger) -- function_to_update_the_objective_progress(value)
if not digger or digger.is_fake_player then return end local function iterate_through_objectives(pname, callback)
local pname = digger:get_player_name()
for qname, quest in pairs(mff.quests.quests) do for qname, quest in pairs(mff.quests.quests) do
if quest.tasks then if quest.tasks then
for tname, task in pairs(quest.tasks) do for tname, task in pairs(quest.tasks) do
if quests.is_task_visible(pname, mff.QPREFIX .. qname, tname) if not quests.is_task_disabled(pname, mff.QPREFIX .. qname, tname) then
and not quests.is_task_disabled(pname, mff.QPREFIX .. qname, tname) callback(qname, quest, tname, task, task, task.objective, function (value)
and task.objective.dig then quests.update_quest_task(pname, mff.QPREFIX .. qname, tname, value)
if table.contains(task.objective.dig, oldnode.name) then end)
quests.update_quest_task(pname, mff.QPREFIX .. qname, tname, 1)
end
end end
end end
else
callback(qname, quest, nil, nil, quest, quest.objective, function (value)
quests.update_quest(pname, mff.QPREFIX .. qname, value)
end)
end end
end end
end
local function contains_node_or_group(table, element)
for _, value in pairs(table) do
if value == element or -- Simple node match
(value:len() > 6 and value:sub(0,6) == "group:" and
minetest.get_item_group(element, value:sub(7)) > 0) then -- Group
return true
end
end
return false
end
-- Quest objective: node digging
minetest.register_on_dignode(function(pos, oldnode, digger)
if not digger or digger.is_fake_player then return end
local pname = digger:get_player_name()
iterate_through_objectives(pname, function (_, _, _, _, _, objective, update)
if objective.dig and contains_node_or_group(objective.dig, oldnode.name) then
update(1)
end
end)
end)
-- Quest objective: node punching
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
if not puncher or puncher.is_fake_player then return end
local pname = puncher:get_player_name()
iterate_through_objectives(pname, function (_, _, _, _, _, objective, update)
if objective.punch and contains_node_or_group(objective.punch, node.name) then
update(1)
end
end)
end)
-- Quest objective: node placement
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
if not placer or placer.is_fake_player then return end
local pname = placer:get_player_name()
iterate_through_objectives(pname, function (_, _, _, _, _, objective, update)
if objective.place and contains_node_or_group(objective.place, newnode.name) then
update(1)
end
end)
end) end)
minetest.register_on_joinplayer(function (player) minetest.register_on_joinplayer(function (player)