From d489c954f5759dc466bb719b86855175c79062f2 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Tue, 30 May 2023 15:13:37 -0600 Subject: [PATCH] Campfires make big smoke Smells like carcenogens, yum --- mods/ITEMS/mcl_campfires/api.lua | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/mods/ITEMS/mcl_campfires/api.lua b/mods/ITEMS/mcl_campfires/api.lua index 6ed77b4a1..91db99fe5 100644 --- a/mods/ITEMS/mcl_campfires/api.lua +++ b/mods/ITEMS/mcl_campfires/api.lua @@ -190,3 +190,38 @@ minetest.register_globalstep(function(dtime) end end end) + +function mcl_campfires.generate_smoke(pos, haybale) + local smoke_timer + + if haybale then + smoke_timer = 8 + else + smoke_timer = 4.75 + end + + minetest.add_particle({ + pos = pos, + velocity = vector.new(0, 1, 0), + texture = "mcl_particles_smoke.png", + size = 10, + acceleration = vector.new(0, 0.5, 0), + collisiondetection = true, + expirationtime = smoke_timer, + }) +end + +minetest.register_abm({ + label = "Campfire Smoke", + nodenames = {"group:lit_campfire"}, + interval = 2, + chance = 2, + action = function(pos, node) + local node_below = vector.offset(pos, 0, -1, 0) + local haybale = false + if minetest.get_node(node_below).name == "mcl_farming:hay_block" then + haybale = true + end + mcl_campfires.generate_smoke(pos, haybale) + end, +})