aboutsummaryrefslogtreecommitdiff
path: root/clientmods/worldhacks/init.lua
blob: e9b79bfd7e00baf9dce0913b3e6cc6b9deeb3b09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
minetest.register_globalstep(function()
	if not minetest.localplayer then return end
	if minetest.settings:get_bool("scaffold") then
		minetest.place_node(vector.add(minetest.localplayer:get_pos(), {x = 0, y = -0.6, z = 0}))
	end
	if minetest.settings:get_bool("highway") and minetest.localplayer:get_wielded_item() then
		local z = minetest.localplayer:get_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
end)