Fix warnings issued by luacheck.

This commit is contained in:
Diego Martínez 2017-02-15 23:53:52 -03:00
parent c8fa17801b
commit 2df6dbcad9
16 changed files with 17 additions and 70 deletions

View File

@ -15,6 +15,7 @@ read_globals = {
"beds", "beds",
"technic", "technic",
"mesecon", "mesecon",
"unifieddyes",
} }
globals = { globals = {

View File

@ -142,8 +142,8 @@ minetest.register_lbm({
action = function(pos, node) action = function(pos, node)
local name = node.name local name = node.name
local newname = "homedecor:bathroom_tiles_light" local newname = "homedecor:bathroom_tiles_light"
local a,b = string.find(node.name, "_") local a = string.find(name, "_")
local color = string.sub(node.name, a + 1) local color = string.sub(name, a + 1)
if color == "tan" then if color == "tan" then
color = "yellow_s50" color = "yellow_s50"

View File

@ -233,7 +233,9 @@ minetest.register_lbm({
action = function(pos, node) action = function(pos, node)
local name = node.name local name = node.name
local color = string.sub(name, string.find(name, "_") + 1) 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 if color == "darkgrey" then
color = "dark_grey" color = "dark_grey"

View File

@ -1,8 +1,6 @@
local S = homedecor_i18n.gettext local S = homedecor_i18n.gettext
local function N_(x) return x end
local BOOK_FORMNAME = "homedecor:book_form" local BOOK_FORMNAME = "homedecor:book_form"
local player_current_book = { } local player_current_book = { }

View File

@ -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( { minetest.register_craft( {
output = "homedecor:bed_regular", output = "homedecor:bed_regular",
recipe = { recipe = {

View File

@ -16,8 +16,6 @@ end
local S = homedecor_i18n.gettext local S = homedecor_i18n.gettext
local function N_(x) return x end
local materials = { local materials = {
{ S("brass"), "brass" }, { S("brass"), "brass" },
{ S("wrought iron"), "wrought_iron" }, { S("wrought iron"), "wrought_iron" },

View File

@ -32,16 +32,6 @@ for _, t in ipairs(table_colors) do
}) })
end 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 = { local kc_cbox = {
type = "fixed", type = "fixed",
fixed = { -0.3125, -0.5, -0.3125, 0.3125, 0.5, 0.3125 }, 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_place_node = homedecor.fix_rotation_nsew,
after_dig_node = unifieddyes.after_dig_node, after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) 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 ? pos.y = pos.y+0 -- where do I put my ass ?
homedecor.sit(pos, node, clicker) homedecor.sit(pos, node, clicker)
return itemstack return itemstack
@ -200,7 +189,7 @@ minetest.register_lbm({
color = "dark_grey" color = "dark_grey"
end end
paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "wallmounted") paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color, "wallmounted")
end end
local old_fdir = math.floor(node.param2 % 32) local old_fdir = math.floor(node.param2 % 32)

View File

@ -230,18 +230,9 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks
end end
local toppos = {x=pos.x, y=pos.y+1.0, z=pos.z} 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 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 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") local newname = string.gsub(thisnode.name, "_regular", "_extended")
minetest.set_node(toppos, { name = thisnode.name, param2 = fdir}) minetest.set_node(toppos, { name = thisnode.name, param2 = fdir})
minetest.set_node(pos, { name = newname, param2 = fdir}) minetest.set_node(pos, { name = newname, param2 = fdir})

View File

@ -1,13 +1,7 @@
-- This file supplies glowlights -- This file supplies glowlights
local dirs2 = { 9, 18, 7, 12 }
local S = homedecor_i18n.gettext local S = homedecor_i18n.gettext
local function N_(x) return x end
local colors = { N_("yellow"), N_("white") }
local glowlight_nodebox = { local glowlight_nodebox = {
half = homedecor.nodebox.slab_y(1/2), half = homedecor.nodebox.slab_y(1/2),
quarter = homedecor.nodebox.slab_y(1/4), quarter = homedecor.nodebox.slab_y(1/4),
@ -617,7 +611,6 @@ minetest.register_lbm({
local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, false) local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, false)
local old_node = node.name
local old_fdir local old_fdir
local new_node = newname local new_node = newname
local new_fdir = 1 local new_fdir = 1
@ -668,7 +661,6 @@ minetest.register_lbm({
nodenames = homedecor.old_static_desk_lamps, nodenames = homedecor.old_static_desk_lamps,
action = function(pos, node) action = function(pos, node)
local name = node.name local name = node.name
local newname
local color = string.sub(name, string.find(name, "_", -8) + 1) local color = string.sub(name, string.find(name, "_", -8) + 1)
if color == "green" then if color == "green" then

View File

@ -1,8 +1,6 @@
local S = homedecor_i18n.gettext local S = homedecor_i18n.gettext
local function N_(x) return x end
homedecor.register("window_quartered", { homedecor.register("window_quartered", {
description = S("Window (quartered)"), description = S("Window (quartered)"),
tiles = { tiles = {
@ -117,7 +115,6 @@ minetest.register_node("homedecor:curtain_closed", {
after_dig_node = unifieddyes.after_dig_node, after_dig_node = unifieddyes.after_dig_node,
after_place_node = homedecor.fix_rotation, after_place_node = homedecor.fix_rotation,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) 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}) local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then if string.find(topnode.name, "homedecor:curtainrod") then
-- Open the curtains -- Open the curtains
@ -144,7 +141,6 @@ minetest.register_node("homedecor:curtain_open", {
after_dig_node = unifieddyes.after_dig_node, after_dig_node = unifieddyes.after_dig_node,
after_place_node = homedecor.fix_rotation, after_place_node = homedecor.fix_rotation,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) 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}) local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then if string.find(topnode.name, "homedecor:curtainrod") then
-- Close the curtains -- Close the curtains
@ -216,18 +212,17 @@ homedecor.register("stained_glass", {
-- Convert old curtain nodes to param2-colorization -- Convert old curtain nodes to param2-colorization
local curtaincolors = { local curtaincolors = {
{ N_("red"), "ad2323" }, "red",
{ N_("green"), "27a927" }, "green",
{ N_("blue"), "2626c6" }, "blue",
{ N_("white"), "ffffff" }, "white",
{ N_("pink"), "ff8fb7" }, "pink",
{ N_("violet"), "7f29d7" }, "violet",
} }
homedecor.old_static_curtain_nodes = {} homedecor.old_static_curtain_nodes = {}
for _, i in ipairs(curtaincolors) do for _, color in ipairs(curtaincolors) do
local color,hue = unpack(i)
table.insert(homedecor.old_static_curtain_nodes, "homedecor:curtain_"..color) table.insert(homedecor.old_static_curtain_nodes, "homedecor:curtain_"..color)
table.insert(homedecor.old_static_curtain_nodes, "homedecor:curtain_open_"..color) table.insert(homedecor.old_static_curtain_nodes, "homedecor:curtain_open_"..color)
end end

View File

@ -34,7 +34,6 @@ minetest.register_node("lavalamp:lavalamp", {
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
after_dig_node = unifieddyes.after_dig_node, after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local itemname = itemstack:get_name()
node.name = "lavalamp:lavalamp_off" node.name = "lavalamp:lavalamp_off"
minetest.swap_node(pos, node) minetest.swap_node(pos, node)
return itemstack return itemstack
@ -102,7 +101,6 @@ minetest.register_lbm({
nodenames = lavalamp.old_static_nodes, nodenames = lavalamp.old_static_nodes,
action = function(pos, node) action = function(pos, node)
local name = node.name local name = node.name
local newname
local color local color
if string.find(name, "red") then if string.find(name, "red") then

View File

@ -26,7 +26,6 @@ minetest.register_node("lrfurn:armchair", {
after_place_node = lrfurn.fix_rotation, after_place_node = lrfurn.fix_rotation,
after_dig_node = unifieddyes.after_dig_node, after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local itemname = itemstack:get_name()
if not clicker:is_player() then if not clicker:is_player() then
return itemstack return itemstack
end end

View File

@ -1,6 +1,4 @@
local S = homedecor_i18n.gettext
lrfurn = {} lrfurn = {}
screwdriver = screwdriver or {} screwdriver = screwdriver or {}

View File

@ -39,7 +39,6 @@ minetest.register_node("lrfurn:longsofa", {
end, end,
after_dig_node = unifieddyes.after_dig_node, after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local itemname = itemstack:get_name()
if not clicker:is_player() then if not clicker:is_player() then
return itemstack return itemstack
end end

View File

@ -39,7 +39,6 @@ minetest.register_node("lrfurn:sofa", {
end, end,
after_dig_node = unifieddyes.after_dig_node, after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local itemname = itemstack:get_name()
if not clicker:is_player() then if not clicker:is_player() then
return itemstack return itemstack
end end