From 1f08ee8126c8eeaf6a39d6a1d6c92099ac365f2d Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Fri, 17 Jan 2025 22:52:54 -0800 Subject: [PATCH] Clean up whitespace --- core.lua | 2 +- formspecs.lua | 18 +++++++++--------- init.lua | 2 +- unified_inventory.lua | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core.lua b/core.lua index 5b14aa3..5ef629e 100644 --- a/core.lua +++ b/core.lua @@ -139,7 +139,7 @@ end function quests.abort_quest(playername, questname) if (questname == nil) then return false - end + end if (quests.failed_quests[playername] == nil) then quests.failed_quests[playername] = {} end diff --git a/formspecs.lua b/formspecs.lua index 13c8f50..0ffae26 100644 --- a/formspecs.lua +++ b/formspecs.lua @@ -24,7 +24,7 @@ function quests.create_formspec(playername, tab, integrated) questlist = quests.failed_quests[playername] or {} end quests.formspec_lists[playername].tab = tab - + local no_quests = true for questname,questspecs in pairs(questlist) do if (questspecs.finished == nil) then @@ -75,7 +75,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" @@ -122,7 +122,7 @@ function quests.create_info(playername, questname, integrated) if (not integrated) then formspec = formspec .. "size[9,6.5]" end - formspec = formspec .. "label[0.5,0.5;" + formspec = formspec .. "label[0.5,0.5;" if (questname) then formspec = formspec .. quests.registered_quests[questname].title .. "]" .. @@ -192,7 +192,7 @@ core.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 core.show_formspec(playername, "quests:questlog", quests.create_formspec(playername)) else @@ -217,7 +217,7 @@ core.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) @@ -257,7 +257,7 @@ core.register_on_player_receive_fields(function(player, formname, fields) if (fields["quests_config_return"]) then if (formname == "quests:config") then core.show_formspec(playername, "quests:questlog", quests.create_formspec(playername)) - else + else unified_inventory.set_inventory_formspec(player, "quests") end end @@ -267,17 +267,17 @@ core.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 core.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 core.show_formspec(playername, "quests:questlog", quests.create_formspec(playername)) - else + else unified_inventory.set_inventory_formspec(player, "quests") end end diff --git a/init.lua b/init.lua index 6635d89..bd77fd6 100644 --- a/init.lua +++ b/init.lua @@ -17,7 +17,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 diff --git a/unified_inventory.lua b/unified_inventory.lua index 4855533..6be5754 100644 --- a/unified_inventory.lua +++ b/unified_inventory.lua @@ -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}