From cbc2d2c1a74126034cec20ca59ff965f425e47e4 Mon Sep 17 00:00:00 2001 From: capitalthree Date: Mon, 27 Nov 2023 07:11:42 -0600 Subject: [PATCH] enable smoke effects only if nodecore.smokeclear is present, to prevent bad behavior on current nodecore stable --- rules.lua | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/rules.lua b/rules.lua index 2b4cd10..2e7c385 100644 --- a/rules.lua +++ b/rules.lua @@ -27,6 +27,19 @@ local solid_drawtypes = { glasslike_framed = true, } +local smokecontrol +if nodecore.smokeclear then + smokecontrol = function(pos, smoke) + if smoke then + nodecore.smokefx(pos, 300, 2) + else + nodecore.smokeclear(pos) + end + end +else + smokecontrol = function(pos, smoke) end +end + --[[ E: air E_: other empty @@ -324,12 +337,12 @@ function lc_liberties.handle_placement(pos) for x=pos.x-18, pos.x+18 do for z=pos.z-18, pos.z+18 do if (x ~= pos.x) or (z ~= pos.z) then - nodecore.smokeclear({x = x, y = pos.y, z = z}) + smokecontrol({x = x, y = pos.y, z = z}) end end end - nodecore.smokefx(pos, 300, 2) + smokecontrol(pos, 1) end function lc_liberties.handle_territory_fill(itemstack, placer, pointed_thing) @@ -371,7 +384,7 @@ function lc_liberties.handle_dig(pos, node, digger) local count = 0 for i, v in pairs(connected_group(pos)) do count = count + 1 - nodecore.smokeclear(v) + smokecontrol(v) nodecore.set_loud(v, {name = "air"}) end @@ -379,7 +392,7 @@ function lc_liberties.handle_dig(pos, node, digger) return true else - nodecore.smokeclear(pos) + smokecontrol(pos) return minetest.node_dig(pos, node, digger) end end