-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodes.lua
executable file
·41 lines (39 loc) · 1.6 KB
/
nodes.lua
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
local S = swapnodes.S
local register_node = swapnodes.register_node
function swapnodes.register_falling_node(material, material_sound)
--swap node falling
register_node("swapnodes:" .. material .. "_falling", {
description = S("swap" .. material .. " falling"),
tiles = {"default_" .. material .. ".png"},
groups = {falling_node = 1},
sounds = material_sound,
on_timer = function(pos, elapsed)
minetest.remove_node(pos)
end,
on_construct = function(pos)
minetest.get_node_timer(pos):start(4)
minetest.check_for_falling(pos)
end,
})
--swap node
register_node("swapnodes:" .. material, {
description = S("swap" .. material),
tiles = {"default_" .. material .. ".png^fachwerk_cross.png"},
sounds = material_sound,
on_punch = function(pos)
--if puncher:get_wielded_item():get_name() == "default:torch" then
minetest.sound_play({name = "default_wood_footstep", gain = 0.2}, { pos = pos }, true)
minetest.swap_node(pos,{name="swapnodes:" .. material .. "_falling"})
minetest.registered_nodes["swapnodes:" .. material .. "_falling"].on_construct(pos)
--end
end,
})
if minetest.get_modpath("mesecons_mvps") then
mesecon.register_mvps_stopper("swapnodes:" .. material)
mesecon.register_mvps_stopper("swapnodes:" .. material .. "_falling")
end
end
swapnodes.register_falling_node("sand", default.node_sound_sand_defaults())
swapnodes.register_falling_node("desert_sand", default.node_sound_sand_defaults())
swapnodes.register_falling_node("silver_sand", default.node_sound_sand_defaults())
swapnodes.register_falling_node("gravel", default.node_sound_gravel_defaults())