Improved World hacks, added fill

This commit is contained in:
Elias Fleckenstein 2020-08-16 16:39:29 +02:00
parent 248dedaba3
commit 73b89703f9

View File

@ -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")