Add a Luacheck configuration file and tweak code style

This commit is contained in:
Hugo Locurcio 2019-02-20 23:47:35 +01:00
parent fe7d656235
commit 876630c70d
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
2 changed files with 49 additions and 8 deletions

30
.luacheckrc Normal file
View File

@ -0,0 +1,30 @@
std = "lua51+minetest"
unused_args = false
allow_defined_top = true
max_line_length = 90
stds.minetest = {
read_globals = {
"DIR_DELIM",
"minetest",
"core",
"dump",
"vector",
"nodeupdate",
"VoxelManip",
"VoxelArea",
"PseudoRandom",
"ItemStack",
"default",
table = {
fields = {
"copy",
},
},
}
}
read_globals = {
"intllib",
"mg",
}

View File

@ -88,7 +88,11 @@ local function get_recipe(c, name)
return {{c, c, c}, {c, c, c}, {c, c, c}} return {{c, c, c}, {c, c, c}, {c, c, c}}
end end
if name == "lockedchest" then if name == "lockedchest" then
return {{"group:wood", "group:wood", "group:wood"}, {"group:wood", c, "group:wood"}, {"group:wood", "group:wood", "group:wood"}} return {
{"group:wood", "group:wood", "group:wood"},
{"group:wood", c, "group:wood"},
{"group:wood", "group:wood", "group:wood"},
}
end end
end end
@ -100,7 +104,6 @@ local function add_ore(modname, description, mineral_name, oredef)
local item_base = tool_base .. mineral_name local item_base = tool_base .. mineral_name
local ingot = item_base .. "_ingot" local ingot = item_base .. "_ingot"
local lump_item = item_base .. "_lump" local lump_item = item_base .. "_lump"
local ingotcraft = ingot
if oredef.makes.ore then if oredef.makes.ore then
minetest.register_node(modname .. ":mineral_" .. mineral_name, { minetest.register_node(modname .. ":mineral_" .. mineral_name, {
@ -242,12 +245,13 @@ local oredefs = {
silver = { silver = {
description = "Silver", description = "Silver",
makes = {ore = true, block = true, lump = true, ingot = true, chest = true}, makes = {ore = true, block = true, lump = true, ingot = true, chest = true},
oredef = {clust_scarcity = moreores.silver_chunk_size * moreores.silver_chunk_size * moreores.silver_chunk_size, oredef = {
clust_scarcity = moreores.silver_chunk_size ^ 3,
clust_num_ores = moreores.silver_ore_per_chunk, clust_num_ores = moreores.silver_ore_per_chunk,
clust_size = moreores.silver_chunk_size, clust_size = moreores.silver_chunk_size,
y_min = moreores.silver_min_depth, y_min = moreores.silver_min_depth,
y_max = moreores.silver_max_depth y_max = moreores.silver_max_depth
}, },
tools = { tools = {
pick = { pick = {
cracky = {times = {[1] = 2.60, [2] = 1.00, [3] = 0.60}, uses = 100, maxlevel= 1} cracky = {times = {[1] = 2.60, [2] = 1.00, [3] = 0.60}, uses = 100, maxlevel= 1}
@ -274,12 +278,13 @@ local oredefs = {
mithril = { mithril = {
description = "Mithril", description = "Mithril",
makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, makes = {ore = true, block = true, lump = true, ingot = true, chest = false},
oredef = {clust_scarcity = moreores.mithril_chunk_size * moreores.mithril_chunk_size * moreores.mithril_chunk_size, oredef = {
clust_scarcity = moreores.mithril_chunk_size ^ 3,
clust_num_ores = moreores.mithril_ore_per_chunk, clust_num_ores = moreores.mithril_ore_per_chunk,
clust_size = moreores.mithril_chunk_size, clust_size = moreores.mithril_chunk_size,
y_min = moreores.mithril_min_depth, y_min = moreores.mithril_min_depth,
y_max = moreores.mithril_max_depth y_max = moreores.mithril_max_depth
}, },
tools = { tools = {
pick = { pick = {
cracky = {times = {[1] = 2.25, [2] = 0.55, [3] = 0.35}, uses = 200, maxlevel= 2} cracky = {times = {[1] = 2.25, [2] = 0.55, [3] = 0.35}, uses = 200, maxlevel= 2}
@ -309,7 +314,8 @@ if not default_tin then
oredefs.tin = { oredefs.tin = {
description = "Tin", description = "Tin",
makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, makes = {ore = true, block = true, lump = true, ingot = true, chest = false},
oredef = {clust_scarcity = moreores.tin_chunk_size * moreores.tin_chunk_size * moreores.tin_chunk_size, oredef = {
clust_scarcity = moreores.tin_chunk_size ^ 3,
clust_num_ores = moreores.tin_ore_per_chunk, clust_num_ores = moreores.tin_ore_per_chunk,
clust_size = moreores.tin_chunk_size, clust_size = moreores.tin_chunk_size,
y_min = moreores.tin_min_depth, y_min = moreores.tin_min_depth,
@ -355,7 +361,12 @@ end
minetest.register_node("moreores:copper_rail", { minetest.register_node("moreores:copper_rail", {
description = S("Copper Rail"), description = S("Copper Rail"),
drawtype = "raillike", drawtype = "raillike",
tiles = {"moreores_copper_rail.png", "moreores_copper_rail_curved.png", "moreores_copper_rail_t_junction.png", "moreores_copper_rail_crossing.png"}, tiles = {
"moreores_copper_rail.png",
"moreores_copper_rail_curved.png",
"moreores_copper_rail_t_junction.png",
"moreores_copper_rail_crossing.png",
},
inventory_image = "moreores_copper_rail.png", inventory_image = "moreores_copper_rail.png",
wield_image = "moreores_copper_rail.png", wield_image = "moreores_copper_rail.png",
paramtype = "light", paramtype = "light",