From 33710f710bb89fe198d8359713a88ca1a8af5a68 Mon Sep 17 00:00:00 2001 From: superfloh247 Date: Sat, 19 Nov 2022 14:34:36 +0100 Subject: [PATCH] restart smoke particle effects on reload (#48) * restart smoke particle effects on reload * restore table in fake_fire:reload_particles * Update fake_fire/init.lua Co-authored-by: OgelGames Co-authored-by: OgelGames --- fake_fire/init.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/fake_fire/init.lua b/fake_fire/init.lua index 21f47531..94f706a6 100644 --- a/fake_fire/init.lua +++ b/fake_fire/init.lua @@ -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,24 @@ 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) + if minetest.get_meta(pos):get_int("smoky") ~= 0 then + stop_smoke(pos) + start_fire_effects(pos, node, nil, 1) + end + end +}) +