Add a Luacheck configuration file and tweak code style

This commit is contained in:
Hugo Locurcio 2019-02-20 23:56:20 +01:00
parent aa1b2f1b08
commit 74da77fb8c
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
4 changed files with 100 additions and 17 deletions

29
.luacheckrc Normal file
View File

@ -0,0 +1,29 @@
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",
}

View File

@ -47,7 +47,11 @@ minetest.register_node("maptools:jungletree", {
description = S("Unbreakable Jungle Tree"),
range = 12,
stack_max = 10000,
tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
tiles = {
"default_jungletree_top.png",
"default_jungletree_top.png",
"default_jungletree.png",
},
drop = "",
groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative},
sounds = default.node_sound_wood_defaults(),
@ -254,7 +258,11 @@ minetest.register_node("maptools:grass", {
description = S("Unbreakable Dirt with Grass"),
range = 12,
stack_max = 10000,
tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
tiles = {
"default_grass.png",
"default_dirt.png",
"default_dirt.png^default_grass_side.png",
},
paramtype2 = "facedir",
drop = "",
groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative},
@ -282,7 +290,11 @@ for slab_num = 1,3,1 do
description = S("Grass Slab"),
range = 12,
stack_max = 10000,
tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^maptools_grass_side_" .. slab_num * 4 .. ".png"},
tiles = {
"default_grass.png",
"default_dirt.png",
"default_dirt.png^maptools_grass_side_" .. slab_num * 4 .. ".png",
},
drawtype = "nodebox",
node_box = {
type = "fixed",
@ -293,7 +305,9 @@ for slab_num = 1,3,1 do
paramtype2 = "facedir",
drop = "",
groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative},
sounds = default.node_sound_dirt_defaults({footstep = {name="default_grass_footstep", gain = 0.4}}),
sounds = default.node_sound_dirt_defaults(
{footstep = {name="default_grass_footstep", gain = 0.4}}
),
on_drop = maptools.drop_msg
})
end
@ -404,9 +418,18 @@ minetest.register_node("maptools:soil_wet", {
description = "Wet Soil",
range = 12,
stack_max = 10000,
tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_wet_side.png"},
tiles = {
"default_dirt.png^farming_soil_wet.png",
"default_dirt.png^farming_soil_wet_side.png",
},
drop = "",
groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, soil = 3, wet = 1, grassland = 1},
groups = {
unbreakable = 1,
not_in_creative_inventory = maptools.creative,
soil = 3,
wet = 1,
grassland = 1,
},
sounds = default.node_sound_dirt_defaults(),
on_drop = maptools.drop_msg
})
@ -417,7 +440,13 @@ minetest.register_node("maptools:desert_sand_soil_wet", {
stack_max = 10000,
drop = "",
tiles = {"farming_desert_sand_soil_wet.png", "farming_desert_sand_soil_wet_side.png"},
groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, soil = 3, wet = 1, desert = 1},
groups = {
unbreakable = 1,
not_in_creative_inventory = maptools.creative,
soil = 3,
wet = 1,
desert = 1,
},
sounds = default.node_sound_sand_defaults(),
on_drop = maptools.drop_msg
})

View File

@ -62,7 +62,6 @@ minetest.register_node("maptools:playerclip", {
minetest.register_node("maptools:fake_walkable", {
description = S("Player Clip"),
drawtype = "nodebox",
range = 12,
stack_max = 10000,
inventory_image = "default_steel_block.png^dye_green.png",
@ -96,7 +95,6 @@ minetest.register_node("maptools:fullclip", {
minetest.register_node("maptools:fake_walkable_pointable", {
description = S("Player Clip"),
drawtype = "nodebox",
range = 12,
stack_max = 10000,
inventory_image = "default_steel_block.png^dye_green.png",
@ -186,7 +184,11 @@ minetest.register_node("maptools:fullclip_face", {
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5},
},
drop = "",
groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, fall_damage_add_percent=-100},
groups = {
unbreakable = 1,
not_in_creative_inventory = maptools.creative,
fall_damage_add_percent = -100,
},
on_drop = maptools.drop_msg
})
@ -205,7 +207,11 @@ minetest.register_node("maptools:playerclip_bottom", {
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5},
},
drop = "",
groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, fall_damage_add_percent=-100},
groups = {
unbreakable = 1,
not_in_creative_inventory = maptools.creative,
fall_damage_add_percent = -100,
},
on_drop = maptools.drop_msg
})
@ -224,7 +230,11 @@ minetest.register_node("maptools:playerclip_top", {
fixed = {-0.5, 0.4999, -0.5, 0.5, 0.5, 0.5},
},
drop = "",
groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, fall_damage_add_percent=-100},
groups = {
unbreakable = 1,
not_in_creative_inventory = maptools.creative,
fall_damage_add_percent = -100,
},
on_drop = maptools.drop_msg
})
@ -244,7 +254,12 @@ minetest.register_node("maptools:pusher_" .. pusher_num, {
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5},
},
drop = "",
groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, fall_damage_add_percent=-100, bouncy=pusher_num*100},
groups = {
unbreakable = 1,
not_in_creative_inventory = maptools.creative,
fall_damage_add_percent = -100,
bouncy = pusher_num * 100,
},
on_drop = maptools.drop_msg
})
end
@ -422,7 +437,6 @@ minetest.register_node("maptools:igniter", {
drawtype = "airlike",
range = 12,
stack_max = 10000,
inventory_image = "default_steel_block.png^crosshair.png",
description = S("Igniter"),
paramtype = "light",
inventory_image = "fire_basic_flame.png",

View File

@ -56,8 +56,19 @@ minetest.register_tool("maptools:pick_admin_with_drops", {
minetest.register_on_punchnode(function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "maptools:pick_admin"
and minetest.get_node(pos).name ~= "air" then
minetest.log("action", puncher:get_player_name() .. " digs " .. minetest.get_node(pos).name .. " at " .. minetest.pos_to_string(pos) .. " using an Admin Pickaxe.")
minetest.remove_node(pos) -- The node is removed directly, which means it even works on non-empty containers and group-less nodes.
minetest.check_for_falling(pos) -- Run node update actions like falling nodes.
minetest.log(
"action",
puncher:get_player_name() ..
" digs " ..
minetest.get_node(pos).name ..
" at " ..
minetest.pos_to_string(pos) ..
" using an Admin Pickaxe."
)
-- The node is removed directly, which means it even works
-- on non-empty containers and group-less nodes.
minetest.remove_node(pos)
-- Run node update actions like falling nodes.
minetest.check_for_falling(pos)
end
end)