mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-07-16 14:40:26 +02:00
Chmod and removal of whitespaces
This commit is contained in:
@ -80,7 +80,7 @@ end
|
||||
-- * Simple quests are made of a single objective
|
||||
-- * Taked quests are made of tasks, allowing simultaneous progress
|
||||
-- within the quest as well as branching quest objectives
|
||||
--
|
||||
--
|
||||
-- Both quest types are defined by a table, and they share common information:
|
||||
-- {
|
||||
-- title, -- Self-explanatory. Should describe the objective for simple quests.
|
||||
@ -94,7 +94,7 @@ end
|
||||
-- abortcallback, -- Called when a player cancels the quest. function(playername, questname, metadata)
|
||||
-- repeating -- Delay in seconds before the quest becomes available again. If nil, 0 or false, doesn't restart.
|
||||
-- }
|
||||
--
|
||||
--
|
||||
-- In addition, simple quests have a number-type `max` element indicating the max progress of the quest.
|
||||
-- As for tasked quests, they have a table-type `tasks` element which value is like this:
|
||||
-- tasks = {
|
||||
@ -106,11 +106,11 @@ end
|
||||
-- },
|
||||
-- another_task = {
|
||||
-- [...],
|
||||
--
|
||||
--
|
||||
-- requires = {"start"},
|
||||
-- -- Table of task names which one must be completed for this task to unlock.
|
||||
-- -- To to task completion groups (i.e. where ALL must be compileted), pass said names in a (sub)table.
|
||||
--
|
||||
--
|
||||
-- availablecallback,
|
||||
-- -- Called when the task becomes available. Not called when there are no task requirements (i.e. task is available from the start).
|
||||
-- -- function(playername, questname, taskname, enablingtaskname, metadata)
|
||||
@ -123,10 +123,10 @@ end
|
||||
-- something = {
|
||||
-- [...],
|
||||
-- requires = {"start"},
|
||||
--
|
||||
--
|
||||
-- disables_on = {"another_task"},
|
||||
-- -- Same as `requires`, but *disables* the task (it then does not count towards quest completion)
|
||||
--
|
||||
--
|
||||
-- disablecallback,
|
||||
-- -- Called when the task becomes disabled. Not called when the task is disabled upon quest start.
|
||||
-- -- function(playername, questname, taskname, disablingtaskname, metadata)
|
||||
@ -160,7 +160,7 @@ function quests.register_quest(questname, quest)
|
||||
autoaccept = not(quest.autoaccept == false),
|
||||
completecallback = quest.completecallback or empty_callback,
|
||||
abortcallback = quest.abortcallback or empty_callback,
|
||||
repeating = quest.repeating or 0
|
||||
repeating = quest.repeating or 0
|
||||
}
|
||||
local new_quest = quests.registered_quests[questname]
|
||||
if quest.max ~= nil then -- Simple quest
|
||||
|
@ -105,7 +105,7 @@ function quests.create_config(playername, integrated)
|
||||
formspec = formspec .. "true"
|
||||
else
|
||||
formspec = formspec .. "false"
|
||||
end
|
||||
end
|
||||
formspec = formspec .. "]checkbox[.25,1.25;quests_config_central_message;" .. S("Central messages") .. ";"
|
||||
if(quests.hud[playername] ~= nil and quests.hud[playername].central_message_enabled) then
|
||||
formspec = formspec .. "true"
|
||||
@ -217,7 +217,7 @@ function quests.create_info(playername, questname, taskid, integrated)
|
||||
end
|
||||
|
||||
-- show the player playername his/her questlog
|
||||
function quests.show_formspec(playername)
|
||||
function quests.show_formspec(playername)
|
||||
minetest.show_formspec(playername, "quests:questlog", quests.create_formspec(playername))
|
||||
end
|
||||
|
||||
@ -264,7 +264,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
quests.formspec_lists[playername].id = event.index
|
||||
if formname == "quests:questlog" then
|
||||
minetest.show_formspec(playername, "quests:questlog", quests.create_formspec(playername))
|
||||
else
|
||||
else
|
||||
unified_inventory.set_inventory_formspec(player, "quests")
|
||||
end
|
||||
end
|
||||
@ -273,7 +273,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if quests.formspec_lists[playername].id == nil then
|
||||
return
|
||||
end
|
||||
quests.abort_quest(playername, quests.formspec_lists[playername].list[quests.formspec_lists[playername].id])
|
||||
quests.abort_quest(playername, quests.formspec_lists[playername].list[quests.formspec_lists[playername].id])
|
||||
if formname == "quests:questlog" then
|
||||
minetest.show_formspec(playername, "quests:questlog", quests.create_formspec(playername))
|
||||
else
|
||||
@ -300,7 +300,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
quests.set_quest_hud_visibility(playername, questname, fields.quests_show_quest_in_hud == "true")
|
||||
if formname == "quests:questlog" then
|
||||
minetest.show_formspec(playername, "quests:questlog", quests.create_formspec(playername))
|
||||
else
|
||||
else
|
||||
unified_inventory.set_inventory_formspec(player, "quests")
|
||||
end
|
||||
end
|
||||
@ -309,7 +309,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
-- config
|
||||
if (fields["quests_config_enable"]) then
|
||||
quests.hud[playername].autohide = false
|
||||
if (fields["quests_config_enable"] == "true") then
|
||||
if (fields["quests_config_enable"] == "true") then
|
||||
quests.show_hud(playername)
|
||||
else
|
||||
quests.hide_hud(playername)
|
||||
@ -349,7 +349,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if (fields["quests_config_return"]) then
|
||||
if (formname == "quests:config") then
|
||||
minetest.show_formspec(playername, "quests:questlog", quests.create_formspec(playername))
|
||||
else
|
||||
else
|
||||
unified_inventory.set_inventory_formspec(player, "quests")
|
||||
end
|
||||
end
|
||||
@ -370,17 +370,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if quests.formspec_lists[playername].id == nil then
|
||||
return
|
||||
end
|
||||
quests.abort_quest(playername, quests.formspec_lists[playername].list[quests.formspec_lists[playername].id])
|
||||
quests.abort_quest(playername, quests.formspec_lists[playername].list[quests.formspec_lists[playername].id])
|
||||
if formname == "quests:info" then
|
||||
minetest.show_formspec(playername, "quests:questlog", quests.create_formspec(playername))
|
||||
else
|
||||
else
|
||||
unified_inventory.set_inventory_formspec(player, "quests")
|
||||
end
|
||||
end
|
||||
if fields.quests_info_return then
|
||||
if formname == "quests:info" then
|
||||
minetest.show_formspec(playername, "quests:questlog", quests.create_formspec(playername))
|
||||
else
|
||||
else
|
||||
unified_inventory.set_inventory_formspec(player, "quests")
|
||||
end
|
||||
end
|
||||
|
@ -225,7 +225,7 @@ function quests.update_hud(playername)
|
||||
local diff = table_diff(old_hud, new_hud)
|
||||
-- Copy the HUD IDs from the old table to the new one, to avoid loosing them
|
||||
for questname, hud_elms in pairs(old_hud) do
|
||||
for elm_name, elm_def in pairs(hud_elms) do
|
||||
for elm_name, elm_def in pairs(hud_elms) do
|
||||
if new_hud[questname] and new_hud[questname][elm_name] then
|
||||
new_hud[questname][elm_name].id = elm_def.id
|
||||
end
|
||||
@ -238,7 +238,7 @@ function quests.update_hud(playername)
|
||||
player:hud_remove(elm_def.id)
|
||||
end
|
||||
else
|
||||
for elm_name, elm_def in pairs(hud_elms) do
|
||||
for elm_name, elm_def in pairs(hud_elms) do
|
||||
if not old_hud[questname] or not old_hud[questname][elm_name] or not old_hud[questname][elm_name].id then
|
||||
new_hud[questname][elm_name].id = player:hud_add(elm_def)
|
||||
else
|
||||
|
@ -18,7 +18,7 @@ end
|
||||
|
||||
|
||||
quests.formspec_lists = {}
|
||||
function quests.round(num, n)
|
||||
function quests.round(num, n)
|
||||
local mult = 10^(n or 0)
|
||||
return math.floor(num * mult + .5) / mult
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
inventory_plus.register_button(player, "quests")
|
||||
end)
|
||||
|
||||
|
@ -8,7 +8,7 @@ unified_inventory.register_button("quests", {
|
||||
})
|
||||
|
||||
unified_inventory.register_page("quests", {
|
||||
get_formspec = function(player)
|
||||
get_formspec = function(player)
|
||||
local playername = player:get_player_name()
|
||||
local formspec = quests.create_formspec(playername, "1", true)
|
||||
return {formspec = formspec, draw_inventory=false}
|
||||
@ -16,7 +16,7 @@ unified_inventory.register_page("quests", {
|
||||
})
|
||||
|
||||
unified_inventory.register_page("quests_successfull", {
|
||||
get_formspec = function(player)
|
||||
get_formspec = function(player)
|
||||
local playername = player:get_player_name()
|
||||
local formspec = quests.create_formspec(playername, "2", true)
|
||||
return {formspec = formspec, draw_inventory=false}
|
||||
@ -24,7 +24,7 @@ unified_inventory.register_page("quests_successfull", {
|
||||
})
|
||||
|
||||
unified_inventory.register_page("quests_failed", {
|
||||
get_formspec = function(player)
|
||||
get_formspec = function(player)
|
||||
local playername = player:get_player_name()
|
||||
local formspec = quests.create_formspec(playername, "3", true)
|
||||
return {formspec = formspec, draw_inventory=false}
|
||||
|
Reference in New Issue
Block a user