diff options
Diffstat (limited to 'maptools')
| -rw-r--r-- | maptools/.editorconfig | 13 | ||||
| -rw-r--r-- | maptools/.luacheckrc | 29 | ||||
| -rw-r--r-- | maptools/.pre-commit-config.yaml | 9 | ||||
| -rw-r--r-- | maptools/LICENSE.md | 2 | ||||
| -rw-r--r-- | maptools/aliases.lua | 2 | ||||
| -rw-r--r-- | maptools/config.lua | 2 | ||||
| -rw-r--r-- | maptools/craftitems.lua | 2 | ||||
| -rw-r--r-- | maptools/default_nodes.lua | 45 | ||||
| -rw-r--r-- | maptools/init.lua | 74 | ||||
| -rw-r--r-- | maptools/nodes.lua | 30 | ||||
| -rw-r--r-- | maptools/textures/fire_basic_flame_animated.png | bin | 1233 -> 1191 bytes | |||
| -rw-r--r-- | maptools/textures/maptools_adminpick.png | bin | 285 -> 283 bytes | |||
| -rw-r--r-- | maptools/textures/maptools_copper_coin.png | bin | 214 -> 213 bytes | |||
| -rw-r--r-- | maptools/textures/maptools_gold_coin.png | bin | 215 -> 213 bytes | |||
| -rw-r--r-- | maptools/textures/maptools_infinitefuel.png | bin | 388 -> 381 bytes | |||
| -rw-r--r-- | maptools/textures/maptools_silver_coin.png | bin | 215 -> 213 bytes | |||
| -rw-r--r-- | maptools/textures/maptools_smoke.png | bin | 303 -> 296 bytes | |||
| -rw-r--r-- | maptools/textures/maptools_superapple.png | bin | 231 -> 230 bytes | |||
| -rw-r--r-- | maptools/tools.lua | 19 | 
19 files changed, 166 insertions, 61 deletions
| diff --git a/maptools/.editorconfig b/maptools/.editorconfig new file mode 100644 index 0000000..a41c697 --- /dev/null +++ b/maptools/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{lua,luacheckrc}] +indent_style = tab +indent_size = 4 diff --git a/maptools/.luacheckrc b/maptools/.luacheckrc new file mode 100644 index 0000000..4bfca2a --- /dev/null +++ b/maptools/.luacheckrc @@ -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", +} diff --git a/maptools/.pre-commit-config.yaml b/maptools/.pre-commit-config.yaml new file mode 100644 index 0000000..9c72498 --- /dev/null +++ b/maptools/.pre-commit-config.yaml @@ -0,0 +1,9 @@ +repos: +  - repo: https://github.com/pre-commit/pre-commit-hooks +    rev: v2.1.0 +    hooks: +      - id: end-of-file-fixer +      - id: trailing-whitespace + +      - id: mixed-line-ending +        args: [--fix=lf] diff --git a/maptools/LICENSE.md b/maptools/LICENSE.md index 2188fe4..a5a3df9 100644 --- a/maptools/LICENSE.md +++ b/maptools/LICENSE.md @@ -1,6 +1,6 @@  # zlib license -Copyright (c) 2012-2017 Hugo Locurcio and contributors +Copyright © 2012-2019 Hugo Locurcio and contributors  **This software 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 software.** diff --git a/maptools/aliases.lua b/maptools/aliases.lua index 5a0e0bb..13ec59f 100644 --- a/maptools/aliases.lua +++ b/maptools/aliases.lua @@ -1,7 +1,7 @@  --[[  Map Tools: alias definitions -Copyright (c) 2012-2017 Hugo Locurcio and contributors. +Copyright © 2012-2019 Hugo Locurcio and contributors.  Licensed under the zlib license. See LICENSE.md for more information.  --]] diff --git a/maptools/config.lua b/maptools/config.lua index f59be03..56d0e2d 100644 --- a/maptools/config.lua +++ b/maptools/config.lua @@ -1,7 +1,7 @@  --[[  Map Tools: configuration handling -Copyright (c) 2012-2017 Hugo Locurcio and contributors. +Copyright © 2012-2019 Hugo Locurcio and contributors.  Licensed under the zlib license. See LICENSE.md for more information.  --]] diff --git a/maptools/craftitems.lua b/maptools/craftitems.lua index fca7e13..aa2330b 100644 --- a/maptools/craftitems.lua +++ b/maptools/craftitems.lua @@ -1,7 +1,7 @@  --[[  Map Tools: item definitions -Copyright (c) 2012-2017 Hugo Locurcio and contributors. +Copyright © 2012-2019 Hugo Locurcio and contributors.  Licensed under the zlib license. See LICENSE.md for more information.  --]] diff --git a/maptools/default_nodes.lua b/maptools/default_nodes.lua index eb74b4c..89409f0 100644 --- a/maptools/default_nodes.lua +++ b/maptools/default_nodes.lua @@ -1,7 +1,7 @@  --[[  Map Tools: unbreakable default nodes -Copyright (c) 2012-2017 Hugo Locurcio and contributors. +Copyright © 2012-2019 Hugo Locurcio and contributors.  Licensed under the zlib license. See LICENSE.md for more information.  --]] @@ -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  }) diff --git a/maptools/init.lua b/maptools/init.lua index 17d5e37..a329f62 100644 --- a/maptools/init.lua +++ b/maptools/init.lua @@ -1,37 +1,37 @@ ---[[
 -=====================================================================
 -** Map Tools **
 -By Calinou.
 -
 -Copyright (c) 2012-2017 Hugo Locurcio and contributors.
 -Licensed under the zlib license. See LICENSE.md for more information.
 -=====================================================================
 ---]]
 -
 -maptools = {}
 -
 -local S
 -if minetest.get_modpath("intllib") then
 -	S = intllib.Getter()
 -else
 -	S = function(s) return s end
 -end
 -maptools.intllib = S
 -
 -local modpath = minetest.get_modpath("maptools")
 -
 -maptools.drop_msg = function(itemstack, player)
 -	local name = player:get_player_name()
 -	minetest.chat_send_player(name, S("[maptools] tools/nodes do not drop!"))
 -end
 -
 -dofile(modpath .. "/config.lua")
 -dofile(modpath .. "/aliases.lua")
 -dofile(modpath .. "/craftitems.lua")
 -dofile(modpath .. "/default_nodes.lua")
 -dofile(modpath .. "/nodes.lua")
 -dofile(modpath .. "/tools.lua")
 -
 -if minetest.setting_getbool("log_mods") then
 -	minetest.log("action", S("[maptools] loaded."))
 -end
 +--[[ +===================================================================== +** Map Tools ** +By Calinou. + +Copyright © 2012-2019 Hugo Locurcio and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +===================================================================== +--]] + +maptools = {} + +local S +if minetest.get_modpath("intllib") then +	S = intllib.Getter() +else +	S = function(s) return s end +end +maptools.intllib = S + +local modpath = minetest.get_modpath("maptools") + +maptools.drop_msg = function(itemstack, player) +	local name = player:get_player_name() +	minetest.chat_send_player(name, S("[maptools] tools/nodes do not drop!")) +end + +dofile(modpath .. "/config.lua") +dofile(modpath .. "/aliases.lua") +dofile(modpath .. "/craftitems.lua") +dofile(modpath .. "/default_nodes.lua") +dofile(modpath .. "/nodes.lua") +dofile(modpath .. "/tools.lua") + +if minetest.setting_getbool("log_mods") then +	minetest.log("action", S("[maptools] loaded.")) +end diff --git a/maptools/nodes.lua b/maptools/nodes.lua index d8e4212..3a2ebf5 100644 --- a/maptools/nodes.lua +++ b/maptools/nodes.lua @@ -1,7 +1,7 @@  --[[  Map Tools: node definitions -Copyright (c) 2012-2017 Hugo Locurcio and contributors. +Copyright © 2012-2019 Hugo Locurcio and contributors.  Licensed under the zlib license. See LICENSE.md for more information.  --]] @@ -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", diff --git a/maptools/textures/fire_basic_flame_animated.png b/maptools/textures/fire_basic_flame_animated.pngBinary files differ index 6f5f8ac..17b4ceb 100644 --- a/maptools/textures/fire_basic_flame_animated.png +++ b/maptools/textures/fire_basic_flame_animated.png diff --git a/maptools/textures/maptools_adminpick.png b/maptools/textures/maptools_adminpick.pngBinary files differ index 04824eb..1714378 100644 --- a/maptools/textures/maptools_adminpick.png +++ b/maptools/textures/maptools_adminpick.png diff --git a/maptools/textures/maptools_copper_coin.png b/maptools/textures/maptools_copper_coin.pngBinary files differ index 26d22a8..bac8870 100644 --- a/maptools/textures/maptools_copper_coin.png +++ b/maptools/textures/maptools_copper_coin.png diff --git a/maptools/textures/maptools_gold_coin.png b/maptools/textures/maptools_gold_coin.pngBinary files differ index 40f14a9..1866881 100644 --- a/maptools/textures/maptools_gold_coin.png +++ b/maptools/textures/maptools_gold_coin.png diff --git a/maptools/textures/maptools_infinitefuel.png b/maptools/textures/maptools_infinitefuel.pngBinary files differ index 163f171..de4b43e 100644 --- a/maptools/textures/maptools_infinitefuel.png +++ b/maptools/textures/maptools_infinitefuel.png diff --git a/maptools/textures/maptools_silver_coin.png b/maptools/textures/maptools_silver_coin.pngBinary files differ index 284c671..7e909d6 100644 --- a/maptools/textures/maptools_silver_coin.png +++ b/maptools/textures/maptools_silver_coin.png diff --git a/maptools/textures/maptools_smoke.png b/maptools/textures/maptools_smoke.pngBinary files differ index c50b7e3..192a7ce 100644 --- a/maptools/textures/maptools_smoke.png +++ b/maptools/textures/maptools_smoke.png diff --git a/maptools/textures/maptools_superapple.png b/maptools/textures/maptools_superapple.pngBinary files differ index 6833827..060ee80 100644 --- a/maptools/textures/maptools_superapple.png +++ b/maptools/textures/maptools_superapple.png diff --git a/maptools/tools.lua b/maptools/tools.lua index a5c5933..9e784ae 100644 --- a/maptools/tools.lua +++ b/maptools/tools.lua @@ -1,7 +1,7 @@  --[[  Map Tools: tool definitions -Copyright (c) 2012-2017 Hugo Locurcio and contributors. +Copyright © 2012-2019 Hugo Locurcio and contributors.  Licensed under the zlib license. See LICENSE.md for more information.  --]] @@ -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) | 
