1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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")
|