aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-08-16 16:39:29 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-08-16 16:39:29 +0200
commit73b89703f9b49ed5c0e7463f1a7be2bbe64ec344 (patch)
tree6a0351bd8f898d1880f33d6e552d4f6c46aa66a3
parent248dedaba3e3acb6e631f321ddd5bb1408174e4d (diff)
downloaddragonfireclient-73b89703f9b49ed5c0e7463f1a7be2bbe64ec344.tar.xz
Improved World hacks, added fill
-rw-r--r--clientmods/world/init.lua55
1 files changed, 30 insertions, 25 deletions
diff --git a/clientmods/world/init.lua b/clientmods/world/init.lua
index 2e7409b73..198bc597f 100644
--- a/clientmods/world/init.lua
+++ b/clientmods/world/init.lua
@@ -42,25 +42,35 @@ minetest.register_chatcommand("dig", {
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
+ local pos = player:get_pos()
+ local count = player:get_wielded_item():get_count()
+ if count > 0 then
+ if minetest.settings:get_bool("scaffold") then
+ minetest.place_node(vector.add(pos, {x = 0, y = -0.6, z = 0}))
+ elseif minetest.settings:get_bool("highway_z") 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 i, p in pairs(positions) do
+ if i > count then break end
+ minetest.place_node(p)
+ end
+ elseif minetest.settings:get_bool("destroy_liquids") then
+ local p = minetest.find_node_near(pos, 5, "mcl_core:water_source", true) or minetest.find_node_near(pos, 5, "mcl_core:water_floating", true)
+ if p then
+ minetest.place_node(p)
+ end
+ elseif minetest.settings:get_bool("fill") then
+ local positions = minetest.find_nodes_in_area(vector.add(pos, {x = 5, y = -0.6, z = 5}), vector.add(pos, {x = -5, y = -5.6, z = -5}), "air")
+ for i, p in pairs(positions) do
+ if i > count then break end
minetest.place_node(p)
end
end
@@ -71,15 +81,10 @@ minetest.register_globalstep(function()
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) or minetest.find_node_near(pos, 5, "mcl_core:water_floating", 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")
+minetest.register_cheat("Fill", "World", "fill")