1
0
mirror of https://github.com/D00Med/scifi_nodes.git synced 2024-11-13 05:40:28 +01:00

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",
-- optional deps
"default", "stairsplus", "xpanes"
"default", "stairsplus", "xpanes", "screwdriver"
}

View File

@ -2,7 +2,7 @@
--the builder node
local builder_formspec =
local builder_formspec =
"size[8,9]" ..
default.gui_bg ..
default.gui_bg_img ..
@ -17,7 +17,21 @@ local builder_formspec =
default.get_hotbar_bg(0,4.85)
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", {
@ -33,7 +47,7 @@ minetest.register_node("scifi_nodes:builder", {
on_construct = function(pos)
--local meta = minetest.get_meta(pos)
--meta:set_string("infotext", "Node Builder (currently does nothing)")
local meta = minetest.get_meta(pos)
meta:set_string("formspec", builder_formspec)
meta:set_string("infotext", "Node Builder")
@ -66,16 +80,16 @@ minetest.register_node("scifi_nodes:builder", {
inv:set_stack("output", 11, row[12])
inv:set_stack("output", 12, row[13])
end
end
end
end
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local stack = inv:get_stack("input", 1)
local stack_name = stack:get_name()
local istack = inv:get_stack("input", 1)
local stack_name = istack:get_name()
inv:remove_item("input", stack_name.." 1")
inv:set_stack("output", 1, "")
inv:set_stack("output", 2, "")
inv:set_stack("output", 3, "")

View File

@ -13,21 +13,6 @@ local chest_formspec =
"listring[current_player;main]" ..
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

View File

@ -97,7 +97,7 @@ minetest.register_craft({
})
-- 8 ceiling light from 2 plastic and 1 meselamp
-- Old recipe used "moreblocks:trap_super_glow_glass"
-- Old recipe used "moreblocks:trap_super_glow_glass"
-- but moreblocks is an optional dependance
minetest.register_craft({
output = "scifi_nodes:lightbar 8",
@ -191,7 +191,7 @@ minetest.register_craft({
{"scifi_nodes:black", "scifi_nodes:black", "scifi_nodes:black"}
}
})
-- 8 metal block from 8 black wall and 1 iron ingot
minetest.register_craft({
output = "scifi_nodes:lighttop 8",
@ -343,7 +343,11 @@ minetest.register_craft({
output = "scifi_nodes:keysmonitor",
recipe = {
{"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"
}
}
})
@ -513,7 +517,7 @@ minetest.register_craft({
}
})
-- 6 capsule from 1 plastic, 1 glass, 1 orange dye, 1 green dye and
-- 6 capsule from 1 plastic, 1 glass, 1 orange dye, 1 green dye and
-- 1 cyan dye
minetest.register_craft({
output = "scifi_nodes:capsule 6",
@ -608,7 +612,11 @@ minetest.register_craft({
output = "scifi_nodes:black_lights",
recipe = {
{"dye:red", "dye:green", "dye:yellow"},
{"mesecons_microcontroller:microcontroller0000", "scifi_nodes:black", "mesecons_microcontroller:microcontroller0000"}
{
"mesecons_microcontroller:microcontroller0000",
"scifi_nodes:black",
"mesecons_microcontroller:microcontroller0000"
}
}
})
@ -1100,7 +1108,7 @@ minetest.register_craft({
{"scifi_nodes:white2", ""},
{"scifi_nodes:white2","scifi_nodes:white2"}
}
})
})
-- 6 white slope from 3 plastic wall
minetest.register_craft({

View File

@ -10,7 +10,7 @@
-- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-- 1. You are allowed to do whatever you want to with what content is using this license.
-- 2. This content is provided 'as-is', without any express or implied warranty. In no event
-- 2. This content is provided 'as-is', without any express or implied warranty. In no event
-- will the authors be held liable for any damages arising from the use of this content.
@ -57,7 +57,6 @@ for _, current_door in ipairs(doors) do
local base_name = current_door.base_name
local base_ingredient = current_door.base_ingredient
local sound = current_door.sound
local doors_rightclick
minetest.register_craft({
output = closed .. " 2",
@ -143,8 +142,8 @@ for _, current_door in ipairs(doors) do
local f = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z-1})
local g = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z+1})
local h = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1})
minetest.set_node(pos, {name=opened, param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=opened_top, param2=node.param2})
@ -184,7 +183,8 @@ for _, current_door in ipairs(doors) do
end
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
function ontimer(pos, elapsed)
@ -383,7 +383,7 @@ for _, current_door in ipairs(doors) do
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
}
},
})

View File

@ -1,4 +1,4 @@
--scifi_nodes by D00Med
--scifi_nodes by D00Med
local MP = minetest.get_modpath("scifi_nodes")
if minetest.get_modpath("xpanes") then

View File

@ -158,7 +158,7 @@ node.types = {
}
if minetest.global_exists("stairsplus") then
for _, row in ipairs(node.types) do
local name = row[1]
local desc = row[2]

View File

@ -154,13 +154,13 @@ minetest.register_node("scifi_nodes:pad", {
on_construct = function(pos, node, placer)
local meta = minetest.get_meta(pos)
if position1 == nil then
position1 = pos
meta:set_int("type", 1)
position1 = pos
meta:set_int("type", 1)
elseif position2 == nil then
position2 = pos
meta:set_int("type", 2)
else
minetest.chat_send_all("There can only be two teleportation pads at a time!")
position2 = pos
meta:set_int("type", 2)
else
minetest.chat_send_all("There can only be two teleportation pads at a time!")
end
end,
on_rightclick = function(pos, node, clicker)
@ -185,11 +185,9 @@ minetest.register_node("scifi_nodes:pad", {
minetest.after(1, function()
local ppos = clicker:getpos()
if minetest.get_node({x=ppos.x, y=ppos.y, z=ppos.z}).name == "scifi_nodes:pad" then
clicker:setpos(position2)
else
--minetest.chat_send_all("Nothing to teleport!")
clicker:setpos(position2)
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
if obj:get_luaentity() and not obj:is_player() then
if obj:get_luaentity().name == "__builtin:item" then
@ -221,11 +219,9 @@ minetest.register_node("scifi_nodes:pad", {
minetest.after(1, function()
local ppos = clicker:getpos()
if minetest.get_node({x=ppos.x, y=ppos.y, z=ppos.z}).name == "scifi_nodes:pad" then
clicker:setpos(position1)
else
--minetest.chat_send_all("No-one to teleport!")
clicker:setpos(position1)
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
if obj:get_luaentity() and not obj:is_player() then
if obj:get_luaentity().name == "__builtin:item" then
@ -390,12 +386,12 @@ minetest.register_node("scifi_nodes:pot", {
}
},
on_rightclick = function(pos, node, clicker, item, _)
local node = minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z})
if 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})
elseif 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})
end
local lid_node = minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z})
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=lid_node.param2})
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=lid_node.param2})
end
end,
on_destruct = function(pos, node, _)
minetest.remove_node({x=pos.x, y=pos.y+2, z=pos.z})
@ -426,12 +422,12 @@ minetest.register_node("scifi_nodes:pot2", {
}
},
on_rightclick = function(pos, node, clicker, item, _)
local node = minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z})
if 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})
elseif 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})
end
local lid_node = minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z})
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=lid_node.param2})
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=lid_node.param2})
end
end,
on_destruct = function(pos, node, _)
minetest.remove_node({x=pos.x, y=pos.y+2, z=pos.z})
@ -1092,9 +1088,8 @@ minetest.register_node("scifi_nodes:itemholder", {
end,
on_destruct = function(pos)
local meta = minetest.get_meta(pos)
local node = minetest.get_node(pos)
if meta:get_string("item") ~= "" then
drop_item(pos, node)
minetest.add_item(pos, meta:get_string("item"))
end
end,
})
@ -1396,7 +1391,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
-- play sound at context position
minetest.sound_play(sounds[sound_index], {
pos = context.pos,
pos = context.pos,
max_hear_distance = 10
})
context[player:get_player_name()] = nil -- we don't need it anymore
@ -1463,7 +1458,10 @@ end
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 :
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
local meta = minetest.get_meta(pos)
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,
groups = {cracky=2},
sounds = default.node_sound_glass_defaults(),
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("scifi_nodes:octgrn", {
@ -364,7 +363,6 @@ minetest.register_node("scifi_nodes:octbl", {
light_source = 10,
groups = {cracky=2},
sounds = default.node_sound_glass_defaults(),
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("scifi_nodes:octppl", {