luacheck fixes

This commit is contained in:
NatureFreshMilk 2019-09-05 09:00:39 +02:00
parent 2ab7e3e6b5
commit 707c21250e
9 changed files with 72 additions and 69 deletions

View File

@ -16,6 +16,6 @@ read_globals = {
"dump", "dump",
-- optional deps -- optional deps
"default", "stairsplus", "xpanes" "default", "stairsplus", "xpanes", "screwdriver"
} }

View File

@ -17,7 +17,21 @@ local builder_formspec =
default.get_hotbar_bg(0,4.85) default.get_hotbar_bg(0,4.85)
local input_items = { local input_items = {
{"default:steel_ingot 1", "scifi_nodes:black", "scifi_nodes:blue", "scifi_nodes:rough", "scifi_nodes:rust", "scifi_nodes:white", "scifi_nodes:grey", "scifi_nodes:pplwll", "scifi_nodes:greenmetal", "scifi_nodes:wall", "scifi_nodes:blue_square", "scifi_nodes:mesh", "scifi_nodes:greytile"} {
"default:steel_ingot 1",
"scifi_nodes:black",
"scifi_nodes:blue",
"scifi_nodes:rough",
"scifi_nodes:rust",
"scifi_nodes:white",
"scifi_nodes:grey",
"scifi_nodes:pplwll",
"scifi_nodes:greenmetal",
"scifi_nodes:wall",
"scifi_nodes:blue_square",
"scifi_nodes:mesh",
"scifi_nodes:greytile"
}
} }
minetest.register_node("scifi_nodes:builder", { minetest.register_node("scifi_nodes:builder", {
@ -72,8 +86,8 @@ minetest.register_node("scifi_nodes:builder", {
on_metadata_inventory_take = function(pos, listname, index, stack, player) on_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local stack = inv:get_stack("input", 1) local istack = inv:get_stack("input", 1)
local stack_name = stack:get_name() local stack_name = istack:get_name()
inv:remove_item("input", stack_name.." 1") inv:remove_item("input", stack_name.." 1")
inv:set_stack("output", 1, "") inv:set_stack("output", 1, "")

View File

@ -13,21 +13,6 @@ local chest_formspec =
"listring[current_player;main]" .. "listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85) default.get_hotbar_bg(0,4.85)
local function get_locked_chest_formspec(pos)
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
local formspec =
"size[8,9]" ..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85)
return formspec
end
-- Helper functions -- Helper functions

View File

@ -343,7 +343,11 @@ minetest.register_craft({
output = "scifi_nodes:keysmonitor", output = "scifi_nodes:keysmonitor",
recipe = { recipe = {
{"scifi_nodes:black", "scifi_nodes:widescreen", "scifi_nodes:black"}, {"scifi_nodes:black", "scifi_nodes:widescreen", "scifi_nodes:black"},
{"mesecons_microcontroller:microcontroller0000", "scifi_nodes:black_detail", "mesecons_microcontroller:microcontroller0000"} {
"mesecons_microcontroller:microcontroller0000",
"scifi_nodes:black_detail",
"mesecons_microcontroller:microcontroller0000"
}
} }
}) })
@ -608,7 +612,11 @@ minetest.register_craft({
output = "scifi_nodes:black_lights", output = "scifi_nodes:black_lights",
recipe = { recipe = {
{"dye:red", "dye:green", "dye:yellow"}, {"dye:red", "dye:green", "dye:yellow"},
{"mesecons_microcontroller:microcontroller0000", "scifi_nodes:black", "mesecons_microcontroller:microcontroller0000"} {
"mesecons_microcontroller:microcontroller0000",
"scifi_nodes:black",
"mesecons_microcontroller:microcontroller0000"
}
} }
}) })

View File

@ -57,7 +57,6 @@ for _, current_door in ipairs(doors) do
local base_name = current_door.base_name local base_name = current_door.base_name
local base_ingredient = current_door.base_ingredient local base_ingredient = current_door.base_ingredient
local sound = current_door.sound local sound = current_door.sound
local doors_rightclick
minetest.register_craft({ minetest.register_craft({
output = closed .. " 2", output = closed .. " 2",
@ -184,7 +183,8 @@ for _, current_door in ipairs(doors) do
end end
function afterplace(pos, placer, itemstack, pointed_thing) function afterplace(pos, placer, itemstack, pointed_thing)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=opened_top,param2=nodeu.param2}) local node = minetest.get_node(pos)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=opened_top,param2=node.param2})
end end
function ontimer(pos, elapsed) function ontimer(pos, elapsed)

View File

@ -186,8 +186,6 @@ minetest.register_node("scifi_nodes:pad", {
local ppos = clicker:getpos() local ppos = clicker:getpos()
if minetest.get_node({x=ppos.x, y=ppos.y, z=ppos.z}).name == "scifi_nodes:pad" then if minetest.get_node({x=ppos.x, y=ppos.y, z=ppos.z}).name == "scifi_nodes:pad" then
clicker:setpos(position2) clicker:setpos(position2)
else
--minetest.chat_send_all("Nothing to teleport!")
end end
local objs = minetest.env:get_objects_inside_radius(pos, 3) local objs = minetest.env:get_objects_inside_radius(pos, 3)
for _, obj in pairs(objs) do for _, obj in pairs(objs) do
@ -222,8 +220,6 @@ minetest.register_node("scifi_nodes:pad", {
local ppos = clicker:getpos() local ppos = clicker:getpos()
if minetest.get_node({x=ppos.x, y=ppos.y, z=ppos.z}).name == "scifi_nodes:pad" then if minetest.get_node({x=ppos.x, y=ppos.y, z=ppos.z}).name == "scifi_nodes:pad" then
clicker:setpos(position1) clicker:setpos(position1)
else
--minetest.chat_send_all("No-one to teleport!")
end end
local objs = minetest.env:get_objects_inside_radius(pos, 3) local objs = minetest.env:get_objects_inside_radius(pos, 3)
for _, obj in pairs(objs) do for _, obj in pairs(objs) do
@ -390,11 +386,11 @@ minetest.register_node("scifi_nodes:pot", {
} }
}, },
on_rightclick = function(pos, node, clicker, item, _) on_rightclick = function(pos, node, clicker, item, _)
local node = minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z}) local lid_node = minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z})
if node.name == "scifi_nodes:pot_lid" then if lid_node.name == "scifi_nodes:pot_lid" then
minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="air", param2=node.param2}) minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="air", param2=lid_node.param2})
elseif node.name ~= "scifi_nodes:pot_lid" and node.name == "air" then elseif lid_node.name ~= "scifi_nodes:pot_lid" and node.name == "air" then
minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="scifi_nodes:pot_lid", param2=node.param2}) minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="scifi_nodes:pot_lid", param2=lid_node.param2})
end end
end, end,
on_destruct = function(pos, node, _) on_destruct = function(pos, node, _)
@ -426,11 +422,11 @@ minetest.register_node("scifi_nodes:pot2", {
} }
}, },
on_rightclick = function(pos, node, clicker, item, _) on_rightclick = function(pos, node, clicker, item, _)
local node = minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z}) local lid_node = minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z})
if node.name == "scifi_nodes:pot_lid" then if lid_node.name == "scifi_nodes:pot_lid" then
minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="air", param2=node.param2}) minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="air", param2=lid_node.param2})
elseif node.name ~= "scifi_nodes:pot_lid" and node.name == "air" then elseif lid_node.name ~= "scifi_nodes:pot_lid" and node.name == "air" then
minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="scifi_nodes:pot_lid", param2=node.param2}) minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="scifi_nodes:pot_lid", param2=lid_node.param2})
end end
end, end,
on_destruct = function(pos, node, _) on_destruct = function(pos, node, _)
@ -1092,9 +1088,8 @@ minetest.register_node("scifi_nodes:itemholder", {
end, end,
on_destruct = function(pos) on_destruct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local node = minetest.get_node(pos)
if meta:get_string("item") ~= "" then if meta:get_string("item") ~= "" then
drop_item(pos, node) minetest.add_item(pos, meta:get_string("item"))
end end
end, end,
}) })
@ -1463,7 +1458,10 @@ end
local function toggle_palm_scanner(pos, node, player, itemstack, pointed_thing) local function toggle_palm_scanner(pos, node, player, itemstack, pointed_thing)
-- Some calling function don't send node param, but everybody sends a pos, so : -- Some calling function don't send node param, but everybody sends a pos, so :
local node = minetest.get_node(pos) if not node then
node = minetest.get_node(pos)
end
if node.name == "scifi_nodes:palm_scanner_off" then if node.name == "scifi_nodes:palm_scanner_off" then
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("clicker", player:get_player_name()) -- need to keep it somewhere meta:set_string("clicker", player:get_player_name()) -- need to keep it somewhere

View File

@ -333,7 +333,6 @@ minetest.register_node("scifi_nodes:octrng", {
light_source = 10, light_source = 10,
groups = {cracky=2}, groups = {cracky=2},
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
sounds = default.node_sound_glass_defaults(),
}) })
minetest.register_node("scifi_nodes:octgrn", { minetest.register_node("scifi_nodes:octgrn", {
@ -364,7 +363,6 @@ minetest.register_node("scifi_nodes:octbl", {
light_source = 10, light_source = 10,
groups = {cracky=2}, groups = {cracky=2},
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
sounds = default.node_sound_glass_defaults(),
}) })
minetest.register_node("scifi_nodes:octppl", { minetest.register_node("scifi_nodes:octppl", {