From 2df6dbcad98f592299c5b36ec65d96601ee9c10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Mart=C3=ADnez?= Date: Wed, 15 Feb 2017 23:53:52 -0300 Subject: [PATCH] Fix warnings issued by `luacheck`. --- .luacheckrc | 1 + homedecor/bathroom_furniture.lua | 4 ++-- homedecor/bedroom.lua | 4 +++- homedecor/books.lua | 2 -- homedecor/crafts.lua | 12 ------------ homedecor/fences.lua | 2 -- homedecor/furniture.lua | 13 +------------ homedecor/handlers/expansion.lua | 9 --------- homedecor/lighting.lua | 10 +--------- homedecor/tables.lua | 2 +- homedecor/window_treatments.lua | 19 +++++++------------ lavalamp/init.lua | 2 -- lrfurn/armchairs.lua | 3 +-- lrfurn/init.lua | 2 -- lrfurn/longsofas.lua | 1 - lrfurn/sofas.lua | 1 - 16 files changed, 17 insertions(+), 70 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 2bba18cf..8d9814da 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -15,6 +15,7 @@ read_globals = { "beds", "technic", "mesecon", + "unifieddyes", } globals = { diff --git a/homedecor/bathroom_furniture.lua b/homedecor/bathroom_furniture.lua index 585327bb..50ee8419 100644 --- a/homedecor/bathroom_furniture.lua +++ b/homedecor/bathroom_furniture.lua @@ -142,8 +142,8 @@ minetest.register_lbm({ action = function(pos, node) local name = node.name local newname = "homedecor:bathroom_tiles_light" - local a,b = string.find(node.name, "_") - local color = string.sub(node.name, a + 1) + local a = string.find(name, "_") + local color = string.sub(name, a + 1) if color == "tan" then color = "yellow_s50" diff --git a/homedecor/bedroom.lua b/homedecor/bedroom.lua index 8e29ee33..ffab0490 100644 --- a/homedecor/bedroom.lua +++ b/homedecor/bedroom.lua @@ -233,7 +233,9 @@ minetest.register_lbm({ action = function(pos, node) local name = node.name local color = string.sub(name, string.find(name, "_") + 1) - local color = string.sub(color, 1, string.find(color, "_", -10) - 1) -- -10 puts us near the end of the color field + + -- -10 puts us near the end of the color field + color = string.sub(color, 1, string.find(color, "_", -10) - 1) if color == "darkgrey" then color = "dark_grey" diff --git a/homedecor/books.lua b/homedecor/books.lua index 27127e38..b33941ae 100644 --- a/homedecor/books.lua +++ b/homedecor/books.lua @@ -1,8 +1,6 @@ local S = homedecor_i18n.gettext -local function N_(x) return x end - local BOOK_FORMNAME = "homedecor:book_form" local player_current_book = { } diff --git a/homedecor/crafts.lua b/homedecor/crafts.lua index 9877f84b..e2570cbe 100644 --- a/homedecor/crafts.lua +++ b/homedecor/crafts.lua @@ -2476,18 +2476,6 @@ minetest.register_craft( { }, }) -local bedcolors = { - { "red", "red"}, - { "orange", "orange" }, - { "yellow", "yellow"}, - { "green", "dark_green"}, - { "blue", "blue"}, - { "violet", "violet"}, - { "pink", "pink"}, - { "darkgrey", "dark_grey"}, - { "brown", "brown" }, -} - minetest.register_craft( { output = "homedecor:bed_regular", recipe = { diff --git a/homedecor/fences.lua b/homedecor/fences.lua index 642b7c9f..3affefe2 100644 --- a/homedecor/fences.lua +++ b/homedecor/fences.lua @@ -16,8 +16,6 @@ end local S = homedecor_i18n.gettext -local function N_(x) return x end - local materials = { { S("brass"), "brass" }, { S("wrought iron"), "wrought_iron" }, diff --git a/homedecor/furniture.lua b/homedecor/furniture.lua index d1e24a97..a2b2775d 100644 --- a/homedecor/furniture.lua +++ b/homedecor/furniture.lua @@ -32,16 +32,6 @@ for _, t in ipairs(table_colors) do }) end -local chaircolors = { - { "", S("plain") }, - { "black", S("black") }, - { "red", S("red") }, - { "pink", S("pink") }, - { "violet", S("violet") }, - { "blue", S("blue") }, - { "dark_green", S("dark green") }, -} - local kc_cbox = { type = "fixed", fixed = { -0.3125, -0.5, -0.3125, 0.3125, 0.5, 0.3125 }, @@ -93,7 +83,6 @@ homedecor.register("kitchen_chair_padded", { after_place_node = homedecor.fix_rotation_nsew, after_dig_node = unifieddyes.after_dig_node, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() pos.y = pos.y+0 -- where do I put my ass ? homedecor.sit(pos, node, clicker) return itemstack @@ -200,7 +189,7 @@ minetest.register_lbm({ color = "dark_grey" end - paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "wallmounted") + paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color, "wallmounted") end local old_fdir = math.floor(node.param2 % 32) diff --git a/homedecor/handlers/expansion.lua b/homedecor/handlers/expansion.lua index 13c69f99..17d6d315 100644 --- a/homedecor/handlers/expansion.lua +++ b/homedecor/handlers/expansion.lua @@ -230,18 +230,9 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks end local toppos = {x=pos.x, y=pos.y+1.0, z=pos.z} - local botpos = {x=pos.x, y=pos.y-1.0, z=pos.z} - local topposfwd = {x=toppos.x+fxd, y=toppos.y, z=toppos.z+fzd} - local topnodefwd = minetest.get_node(topposfwd) - - local topnode = minetest.get_node(toppos) - local bottomnode = minetest.get_node(botpos) - - print(topnode.name, thisnode.name, bottomnode.name, itemstack:get_name(), dump(trybunks)) if trybunks and is_buildable_to(placer_name, toppos, topposfwd) then - print("want to stack beds, top seems to be clear") local newname = string.gsub(thisnode.name, "_regular", "_extended") minetest.set_node(toppos, { name = thisnode.name, param2 = fdir}) minetest.set_node(pos, { name = newname, param2 = fdir}) diff --git a/homedecor/lighting.lua b/homedecor/lighting.lua index f7314d0f..d359b7fb 100644 --- a/homedecor/lighting.lua +++ b/homedecor/lighting.lua @@ -1,13 +1,7 @@ -- This file supplies glowlights -local dirs2 = { 9, 18, 7, 12 } - local S = homedecor_i18n.gettext -local function N_(x) return x end - -local colors = { N_("yellow"), N_("white") } - local glowlight_nodebox = { half = homedecor.nodebox.slab_y(1/2), quarter = homedecor.nodebox.slab_y(1/4), @@ -579,7 +573,7 @@ minetest.register_lbm({ end local lampname - if string.find(name, "standing_lamp") then + if string.find(name, "standing_lamp") then lampname = "homedecor:standing_lamp" elseif string.find(name, "table_lamp") then lampname = "homedecor:table_lamp" @@ -617,7 +611,6 @@ minetest.register_lbm({ local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, false) - local old_node = node.name local old_fdir local new_node = newname local new_fdir = 1 @@ -668,7 +661,6 @@ minetest.register_lbm({ nodenames = homedecor.old_static_desk_lamps, action = function(pos, node) local name = node.name - local newname local color = string.sub(name, string.find(name, "_", -8) + 1) if color == "green" then diff --git a/homedecor/tables.lua b/homedecor/tables.lua index d0aa812e..70ced410 100644 --- a/homedecor/tables.lua +++ b/homedecor/tables.lua @@ -4,7 +4,7 @@ local S = homedecor_i18n.gettext -- Various kinds of tables local materials = { - { "glass", + { "glass", S("Small square glass table"), S("Small round glass table"), S("Large glass table piece"), diff --git a/homedecor/window_treatments.lua b/homedecor/window_treatments.lua index 3b981231..b1f7aff6 100644 --- a/homedecor/window_treatments.lua +++ b/homedecor/window_treatments.lua @@ -1,8 +1,6 @@ local S = homedecor_i18n.gettext -local function N_(x) return x end - homedecor.register("window_quartered", { description = S("Window (quartered)"), tiles = { @@ -117,7 +115,6 @@ minetest.register_node("homedecor:curtain_closed", { after_dig_node = unifieddyes.after_dig_node, after_place_node = homedecor.fix_rotation, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}) if string.find(topnode.name, "homedecor:curtainrod") then -- Open the curtains @@ -144,7 +141,6 @@ minetest.register_node("homedecor:curtain_open", { after_dig_node = unifieddyes.after_dig_node, after_place_node = homedecor.fix_rotation, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}) if string.find(topnode.name, "homedecor:curtainrod") then -- Close the curtains @@ -216,18 +212,17 @@ homedecor.register("stained_glass", { -- Convert old curtain nodes to param2-colorization local curtaincolors = { - { N_("red"), "ad2323" }, - { N_("green"), "27a927" }, - { N_("blue"), "2626c6" }, - { N_("white"), "ffffff" }, - { N_("pink"), "ff8fb7" }, - { N_("violet"), "7f29d7" }, + "red", + "green", + "blue", + "white", + "pink", + "violet", } homedecor.old_static_curtain_nodes = {} -for _, i in ipairs(curtaincolors) do - local color,hue = unpack(i) +for _, color in ipairs(curtaincolors) do table.insert(homedecor.old_static_curtain_nodes, "homedecor:curtain_"..color) table.insert(homedecor.old_static_curtain_nodes, "homedecor:curtain_open_"..color) end diff --git a/lavalamp/init.lua b/lavalamp/init.lua index 42b70af6..bd60e3b9 100644 --- a/lavalamp/init.lua +++ b/lavalamp/init.lua @@ -34,7 +34,6 @@ minetest.register_node("lavalamp:lavalamp", { sounds = default.node_sound_glass_defaults(), after_dig_node = unifieddyes.after_dig_node, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() node.name = "lavalamp:lavalamp_off" minetest.swap_node(pos, node) return itemstack @@ -102,7 +101,6 @@ minetest.register_lbm({ nodenames = lavalamp.old_static_nodes, action = function(pos, node) local name = node.name - local newname local color if string.find(name, "red") then diff --git a/lrfurn/armchairs.lua b/lrfurn/armchairs.lua index e471267f..3891266a 100644 --- a/lrfurn/armchairs.lua +++ b/lrfurn/armchairs.lua @@ -13,7 +13,7 @@ minetest.register_node("lrfurn:armchair", { drawtype = "mesh", mesh = "lrfurn_armchair.obj", tiles = { - "lrfurn_upholstery.png", + "lrfurn_upholstery.png", { name = "lrfurn_sofa_bottom.png", color = 0xffffffff } }, paramtype = "light", @@ -26,7 +26,6 @@ minetest.register_node("lrfurn:armchair", { after_place_node = lrfurn.fix_rotation, after_dig_node = unifieddyes.after_dig_node, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() if not clicker:is_player() then return itemstack end diff --git a/lrfurn/init.lua b/lrfurn/init.lua index 64341362..1074482e 100644 --- a/lrfurn/init.lua +++ b/lrfurn/init.lua @@ -1,6 +1,4 @@ -local S = homedecor_i18n.gettext - lrfurn = {} screwdriver = screwdriver or {} diff --git a/lrfurn/longsofas.lua b/lrfurn/longsofas.lua index b5216c2e..06f66fbe 100644 --- a/lrfurn/longsofas.lua +++ b/lrfurn/longsofas.lua @@ -39,7 +39,6 @@ minetest.register_node("lrfurn:longsofa", { end, after_dig_node = unifieddyes.after_dig_node, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() if not clicker:is_player() then return itemstack end diff --git a/lrfurn/sofas.lua b/lrfurn/sofas.lua index 57d4904c..98925960 100644 --- a/lrfurn/sofas.lua +++ b/lrfurn/sofas.lua @@ -39,7 +39,6 @@ minetest.register_node("lrfurn:sofa", { end, after_dig_node = unifieddyes.after_dig_node, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() if not clicker:is_player() then return itemstack end