Standardize node placement sounds.
Add node placement sounds to processes missing them, like tree growth.
This commit is contained in:
parent
ab754e6d6e
commit
7bc1a4ddad
@ -74,3 +74,10 @@ function nodecore.node_sound(pos, kind, opts)
|
||||
t.pos = pos
|
||||
return nodecore.sound_play_except(t.name, t, opts and opts.except)
|
||||
end
|
||||
|
||||
function nodecore.set_loud(pos, node, opts)
|
||||
minetest.set_node(pos, node)
|
||||
opts = opts or {}
|
||||
opts.node = node
|
||||
return nodecore.node_sound(pos, "place", opts)
|
||||
end
|
||||
|
@ -102,8 +102,7 @@ local function craftcheck(recipe, pos, node, data, xx, xz, zx, zz)
|
||||
if r then
|
||||
local n = minetest.get_node(p)
|
||||
r.param2 = n.param2
|
||||
minetest.set_node(p, r)
|
||||
nodecore.node_sound(p, "place")
|
||||
nodecore.set_loud(p, r)
|
||||
nodecore.fallcheck(p)
|
||||
end
|
||||
end
|
||||
|
@ -25,7 +25,7 @@ local function displace_check(pos)
|
||||
for rel in nodecore.settlescan() do
|
||||
local p = vector.add(pos, rel)
|
||||
if nodecore.buildable_to(p) then
|
||||
minetest.set_node(p, node)
|
||||
nodecore.set_loud(p, node)
|
||||
minetest.get_meta(p):from_table(
|
||||
minetest.get_meta(pos):to_table()
|
||||
)
|
||||
@ -94,8 +94,7 @@ minetest.register_entity(":__builtin:falling_node", {
|
||||
|
||||
displace_check(pos)
|
||||
|
||||
minetest.set_node(pos, self.node)
|
||||
nodecore.node_sound(pos, "place")
|
||||
nodecore.set_loud(pos, self.node)
|
||||
if self.meta then
|
||||
minetest.get_meta(pos):from_table(self.meta)
|
||||
end
|
||||
|
@ -109,6 +109,6 @@ nodecore.register_soaking_abm({
|
||||
soakcheck = function(data, pos, node)
|
||||
if data.total < 100 then return end
|
||||
local def = minetest.registered_items[node.name] or {}
|
||||
return minetest.set_node(pos, {name = def.repack_to})
|
||||
return nodecore.set_loud(pos, {name = def.repack_to})
|
||||
end
|
||||
})
|
||||
|
@ -63,8 +63,7 @@ nodecore.register_limited_abm({
|
||||
nodenames = {modname .. ":aggregate"},
|
||||
neighbors = {"group:water"},
|
||||
action = function(pos)
|
||||
minetest.set_node(pos, {name = src})
|
||||
nodecore.node_sound(pos, "place")
|
||||
nodecore.set_loud(pos, {name = src})
|
||||
end
|
||||
})
|
||||
|
||||
@ -82,8 +81,7 @@ nodecore.register_aism({
|
||||
found = data.pos
|
||||
end
|
||||
end
|
||||
minetest.set_node(found, {name = src})
|
||||
nodecore.node_sound(found, "place")
|
||||
nodecore.set_loud(found, {name = src})
|
||||
stack:take_item(1)
|
||||
return stack
|
||||
end
|
||||
@ -102,8 +100,7 @@ nodecore.register_limited_abm({
|
||||
if gen >= 8 and math_random(1, 2) == 1 then
|
||||
nodecore.witness({x = pos.x, y = pos.y + 0.5, z = pos.z},
|
||||
"aggregate to cobble")
|
||||
minetest.set_node(pos, {name = "nc_terrain:cobble"})
|
||||
return nodecore.node_sound(pos, "place")
|
||||
return nodecore.set_loud(pos, {name = "nc_terrain:cobble"})
|
||||
end
|
||||
local miny = pos.y
|
||||
local found = {}
|
||||
@ -121,8 +118,7 @@ nodecore.register_limited_abm({
|
||||
end)
|
||||
if #found < 1 then return end
|
||||
local np = nodecore.pickrand(found)
|
||||
nodecore.node_sound(pos, "dig")
|
||||
minetest.set_node(np, node)
|
||||
nodecore.set_loud(np, node)
|
||||
minetest.get_meta(np):set_int("agggen", gen + 1)
|
||||
minetest.set_node(pos, {name = flow, param2 = 7})
|
||||
end
|
||||
@ -139,7 +135,7 @@ nodecore.register_limited_abm({
|
||||
local waters = #nodecore.find_nodes_around(pos, "group:water")
|
||||
local rnd = math_random() * 20
|
||||
if rnd * rnd < waters then
|
||||
minetest.set_node(pos, {name = "nc_terrain:gravel"})
|
||||
nodecore.set_loud(pos, {name = "nc_terrain:gravel"})
|
||||
return nodecore.fallcheck(pos)
|
||||
end
|
||||
|
||||
@ -148,9 +144,8 @@ nodecore.register_limited_abm({
|
||||
if bnode.name == "ignore" then return end
|
||||
local bdef = minetest.registered_nodes[bnode.name] or {}
|
||||
if bdef.groups and bdef.groups.water then
|
||||
nodecore.node_sound(pos, "dig")
|
||||
minetest.set_node(below, node)
|
||||
minetest.set_node(pos, bnode)
|
||||
nodecore.set_loud(below, node)
|
||||
nodecore.set_loud(pos, bnode)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
@ -54,8 +54,7 @@ function nodecore.register_door(basemod, basenode, desc, pin, lv)
|
||||
node.name = doorname
|
||||
nodecore.player_stat_add(1, clicker, "craft",
|
||||
"door pin " .. basenode:lower())
|
||||
minetest.set_node(pos, node)
|
||||
nodecore.node_sound(pos, "place")
|
||||
nodecore.set_loud(pos, node)
|
||||
stack:take_item(1)
|
||||
return stack
|
||||
end
|
||||
|
@ -76,7 +76,7 @@ function nodecore.place_stack(pos, stack, placer, pointed_thing)
|
||||
if stack:get_count() == 1 then
|
||||
local def = minetest.registered_nodes[stack:get_name()]
|
||||
if def and def.groups and def.groups.stack_as_node then
|
||||
minetest.set_node(pos, {name = stack:get_name()})
|
||||
nodecore.set_loud(pos, {name = stack:get_name()})
|
||||
if def.after_place_node then
|
||||
def.after_place_node(pos, nil, stack)
|
||||
end
|
||||
|
@ -27,8 +27,7 @@ nodecore.register_limited_abm({
|
||||
action = function(pos)
|
||||
local below = {x = pos.x, y = pos.y - 1, z = pos.z}
|
||||
if nodecore.match(below, {walkable = true}) then return end
|
||||
minetest.set_node(pos, {name = "nc_terrain:cobble"})
|
||||
nodecore.node_sound(pos, "place")
|
||||
nodecore.set_loud(pos, {name = "nc_terrain:cobble"})
|
||||
return nodecore.item_eject(below, modname
|
||||
.. ":prill_hot " .. (nodecore.exporand(1) + 1))
|
||||
end
|
||||
|
@ -28,8 +28,7 @@ nodecore.register_limited_abm({
|
||||
neighbors = {"group:water"},
|
||||
action = function(pos)
|
||||
if soakup(pos) then
|
||||
minetest.set_node(pos, {name = modname .. ":sponge_wet"})
|
||||
nodecore.node_sound(pos, "place")
|
||||
nodecore.set_loud(pos, {name = modname .. ":sponge_wet"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -69,8 +69,7 @@ nodecore.register_limited_abm({
|
||||
nodenames = {living},
|
||||
action = function(pos, node)
|
||||
if not spongesurvive({pos = pos, node = node}) then
|
||||
minetest.set_node(pos, {name = wet})
|
||||
nodecore.node_sound(pos, "place")
|
||||
nodecore.set_loud(pos, {name = wet})
|
||||
return nodecore.fallcheck(pos)
|
||||
end
|
||||
|
||||
@ -100,7 +99,7 @@ nodecore.register_limited_abm({
|
||||
grp = def and def.groups and def.groups.sand
|
||||
if (not grp) or (grp < 1) then return end
|
||||
end
|
||||
minetest.set_node(pos, {name = living})
|
||||
nodecore.set_loud(pos, {name = living})
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -16,10 +16,7 @@ local watersrc = "nc_terrain:water_gray_source"
|
||||
local spongewet = modname .. ":sponge_wet"
|
||||
|
||||
local function mkwater(pos, srcpos, new)
|
||||
if new then
|
||||
minetest.set_node(pos, {name = watersrc})
|
||||
nodecore.node_sound(pos, "place")
|
||||
end
|
||||
if new then nodecore.set_loud(pos, {name = watersrc}) end
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("spongepos", minetest.pos_to_string(srcpos))
|
||||
meta:set_float("expire", nodecore.gametime + 10)
|
||||
|
@ -48,8 +48,7 @@ function nodecore.register_dirt_leeching(fromnode, tonode, rate)
|
||||
end,
|
||||
soakcheck = function(data, pos)
|
||||
if data.total < 5000 then return end
|
||||
minetest.set_node(pos, {name = tonode})
|
||||
nodecore.node_sound(pos, "place")
|
||||
nodecore.set_loud(pos, {name = tonode})
|
||||
return nodecore.fallcheck(pos)
|
||||
end
|
||||
})
|
||||
|
@ -63,8 +63,7 @@ nodecore.register_soaking_abm({
|
||||
soakcheck = function(data, pos)
|
||||
if data.total < 2500 then return end
|
||||
minetest.get_meta(pos):from_table({})
|
||||
minetest.set_node(pos, {name = modname .. ":humus"})
|
||||
nodecore.node_sound(pos, "place")
|
||||
nodecore.set_loud(pos, {name = modname .. ":humus"})
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -33,8 +33,7 @@ minetest.register_node(modname .. ":eggcorn", {
|
||||
local def = minetest.registered_items[stack:get_name()]
|
||||
if (not def) or (not def.groups) or (not def.groups.dirt_loose) then return end
|
||||
|
||||
minetest.set_node(pos, {name = epname})
|
||||
nodecore.node_sound(pos, "place")
|
||||
nodecore.set_loud(pos, {name = epname})
|
||||
|
||||
if nodecore.player_stat_add then
|
||||
nodecore.player_stat_add(1, whom, "craft", "eggcorn planting")
|
||||
@ -83,8 +82,9 @@ nodecore.register_soaking_abm({
|
||||
soakrate = nodecore.tree_growth_rate,
|
||||
soakcheck = function(data, pos)
|
||||
if data.total >= sproutcost then
|
||||
minetest.set_node(pos, {name = modname .. ":root"})
|
||||
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},
|
||||
nodecore.node_sound(pos, "dig")
|
||||
nodecore.set_loud(pos, {name = modname .. ":root"})
|
||||
nodecore.set_loud({x = pos.x, y = pos.y + 1, z = pos.z},
|
||||
{name = modname .. ":tree_bud", param2 = 1})
|
||||
local sub = minetest.get_meta(pos)
|
||||
sub:set_float("treegrowqty", data.total - sproutcost)
|
||||
@ -121,12 +121,12 @@ local function leafbud(pos, dx, dy, dz, param2)
|
||||
if 240 < math_random(0, 255) then return end
|
||||
local npos = {x = pos.x + dx, y = pos.y + dy, z = pos.z + dz}
|
||||
if nodecore.buildable_to(npos) then
|
||||
return minetest.set_node(npos, nodecore.calc_leaves(npos))
|
||||
return nodecore.set_loud(npos, nodecore.calc_leaves(npos))
|
||||
end
|
||||
end
|
||||
local npos = {x = pos.x + dx, y = pos.y + dy, z = pos.z + dz}
|
||||
if nodecore.buildable_to(npos) then
|
||||
return minetest.set_node(npos, {name = modname .. ":leaves_bud", param2 = param2})
|
||||
return nodecore.set_loud(npos, {name = modname .. ":leaves_bud", param2 = param2})
|
||||
end
|
||||
end
|
||||
|
||||
@ -183,12 +183,12 @@ nodecore.register_soaking_abm({
|
||||
end
|
||||
|
||||
if tp.notrunk then
|
||||
minetest.set_node(apos, {
|
||||
nodecore.set_loud(apos, {
|
||||
name = modname .. ":leaves_bud",
|
||||
param2 = tp.leaves
|
||||
})
|
||||
else
|
||||
minetest.set_node(apos, {
|
||||
nodecore.set_loud(apos, {
|
||||
name = modname .. ":tree_bud",
|
||||
param2 = param2
|
||||
})
|
||||
@ -208,7 +208,7 @@ nodecore.register_limited_abm({
|
||||
limited_max = 100,
|
||||
limited_alert = 1000,
|
||||
action = function(pos, node)
|
||||
minetest.set_node(pos, nodecore.calc_leaves(pos))
|
||||
nodecore.set_loud(pos, nodecore.calc_leaves(pos))
|
||||
if node.param2 <= 1 then
|
||||
return
|
||||
elseif node.param2 == 2 then
|
||||
|
Loading…
x
Reference in New Issue
Block a user