diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-08-15 15:45:28 +0200 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-08-15 15:45:28 +0200 |
commit | 3bed0981d058b512bfb8aeeeeed235c9ee9385af (patch) | |
tree | 8f3b06e1ac849fecf684af1ba7bb2e72eaed4b5d /clientmods/world/init.lua | |
parent | 622d547262ee6800810b228d9641edff63848e0c (diff) | |
download | dragonfireclient-3bed0981d058b512bfb8aeeeeed235c9ee9385af.tar.xz |
UI Update; Added AutoTool
Diffstat (limited to 'clientmods/world/init.lua')
-rw-r--r-- | clientmods/world/init.lua | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/clientmods/world/init.lua b/clientmods/world/init.lua new file mode 100644 index 000000000..303900f8a --- /dev/null +++ b/clientmods/world/init.lua @@ -0,0 +1,85 @@ +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 = minetest.localplayer:get_pos() + local fpos = minetest.find_node_near(pos, radius, nodes, true) + if fpos then + return true, "Found " .. table.concat(nodes, " or ") .. " at " .. minetest.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, +}) + +minetest.register_globalstep(function() + local player = minetest.localplayer + if not player then return end + local pos = minetest.localplayer:get_pos() + local wielditem = minetest.localplayer:get_wielded_item() + if minetest.settings:get_bool("scaffold") then + minetest.place_node(vector.add(pos, {x = 0, y = -0.6, z = 0})) + end + if minetest.settings:get_bool("highway_z") and wielditem then + local z = pos.z + local positions = { + {x = 0, y = 0, z = z}, + {x = 1, y = 0, z = z}, + {x = 2, y = 1, z = z}, + {x = -2, y = 1, z = z}, + {x = -2, y = 0, z = z}, + {x = -1, y = 0, z = z}, + {x = 2, y = 0, z = z} + } + for _, p in pairs(positions) do + local node = minetest.get_node_or_nil(p) + if node and not minetest.get_node_def(node.name).walkable then + minetest.place_node(p) + end + end + end + if minetest.settings:get_bool("fucker") then + local p = minetest.find_node_near(pos, 5, "group:bed", true) + if p then + minetest.dig_node(p) + end + end + if minetest.settings:get_bool("destroy_liquids") then + local p = minetest.find_node_near(pos, 5, "mcl_core:water_source", true) + if p then + minetest.place_node(p) + end + end +end) + +minetest.register_cheat("Scaffold", "World", "scaffold") +minetest.register_cheat("HighwayZ", "World", "highway_z") +minetest.register_cheat("Fucker", "World", "fucker") +minetest.register_cheat("BlockWater", "World", "destroy_liquids") |