aboutsummaryrefslogtreecommitdiff
path: root/clientmods/maputil/commands.lua
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-07-18 13:20:08 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-07-18 13:20:08 +0200
commit45aa2516b2fc675df7049bc9ed713600c95b6423 (patch)
treecd7d1f377789e56cfe624d8db542f32c7dd0bca4 /clientmods/maputil/commands.lua
parentf22339ed891afddca53f7442c63aedd7aecc566d (diff)
downloaddragonfireclient-45aa2516b2fc675df7049bc9ed713600c95b6423.tar.xz
Added settings
Diffstat (limited to 'clientmods/maputil/commands.lua')
-rw-r--r--clientmods/maputil/commands.lua42
1 files changed, 42 insertions, 0 deletions
diff --git a/clientmods/maputil/commands.lua b/clientmods/maputil/commands.lua
new file mode 100644
index 000000000..4f88cd145
--- /dev/null
+++ b/clientmods/maputil/commands.lua
@@ -0,0 +1,42 @@
+minetest.register_chatcommand("findnodes", {
+ description = "Scan for one or multible nodes in a radius around you",
+ param = "<radius> <node1>[,<node2>...]",
+ func = function(param)
+ local radius = tonumber(param:split(" ")[1])
+ local nodes = param:split(" ")[2]:split(",")
+ local pos = core.localplayer:get_pos()
+ local fpos = core.find_node_near(pos, radius, nodes, true)
+ if fpos then
+ return true, "Found " .. table.concat(nodes, " or ") .. " at " .. core.pos_to_string(fpos)
+ end
+ return false, "None of " .. table.concat(nodes, " or ") .. " found in a radius of " .. tostring(radius)
+ end,
+})
+
+minetest.register_chatcommand("place", {
+ params = "<X>,<Y>,<Z>",
+ description = "Place wielded item",
+ func = function(param)
+ local success, pos = minetest.parse_relative_pos(param)
+ if success then
+ minetest.place_node(pos)
+ return true, "Node placed at " .. minetest.pos_to_string(pos)
+ end
+ return false, pos
+ end,
+})
+
+minetest.register_chatcommand("dig", {
+ params = "<X>,<Y>,<Z>",
+ description = "Dig node",
+ func = function(param)
+ local success, pos = minetest.parse_relative_pos(param)
+ if success then
+ minetest.dig_node(pos)
+ return true, "Node at " .. minetest.pos_to_string(pos) .. " dug"
+ end
+ return false, pos
+ end,
+})
+
+