Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local hpos = minetest.hash_node_position(pointed_thing.above)
local torch = torch_sounds[hpos]
if not torch then
torch = {}
torch_sounds[hpos] = torch
torch.handle = minetest.sound_play("torch_burning",
{pos=pointed_thing.above, max_hear_distance=3, gain=0.5, loop=true})
end
I also try to "ignite" the torches when the server starts, but this is even more worse. Most times minetest.sound_play() returns -1, but not always.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_lbm({
name = "torches:ignite_torches",
run_at_every_load = true,
nodenames = {"default:torch", "default:torch_wall"},
action = function(pos, node)
local hpos = minetest.hash_node_position(pos)
local torch = torch_sounds[hpos]
if not torch then
torch = {}
torch_sounds[hpos] = torch
torch.handle = minetest.sound_play("torch_burning",
{pos=pos, max_hear_distance=3, gain=0.5, loop=true})
end
print(dump(node), dump(pos), dump(torch_sounds))
end,
})
What's going on here? I have absolutly no clue