restart smoke particle effects on reload

This commit is contained in:
Flo 2022-11-17 19:57:32 +01:00
parent 8893d66dc6
commit fb1ad97767
1 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator("fake_fire")
local fake_fire_reload_particles_nodes = {}
local function fire_particles_on(pos) -- 3 layers of fire
local meta = minetest.get_meta(pos)
local id1 = minetest.add_particlespawner({ -- 1 layer big particles fire
@ -253,6 +255,7 @@ local materials = {
for _, mat in ipairs(materials) do
local name, desc, tex = unpack(mat)
table.insert(fake_fire_reload_particles_nodes, "fake_fire:chimney_top_"..name)
minetest.register_node("fake_fire:chimney_top_"..name, {
description = desc,
tiles = {tex.."^chimney_top.png", tex},
@ -326,10 +329,22 @@ minetest.register_alias("fake_fire:flint", "fake_fire:flint_and_steel")
minetest.register_lbm({
name = "fake_fire:reload_particles",
label = "restart fire particles on reload",
nodenames = {"fake_fire:fancy_fire"},
nodenames = "fake_fire:fancy_fire",
run_at_every_load = true,
action = function(pos, node)
fire_particles_off(pos)
fire_particles_on(pos)
end
})
minetest.register_lbm({
name = "fake_fire:reload_particles_chimney",
label = "restart chimney smoke on reload",
nodenames = fake_fire_reload_particles_nodes,
run_at_every_load = true,
action = function(pos, node)
stop_smoke(pos)
start_fire_effects(pos, node, nil, 1)
end
})