From d61845dd92493c18e578524ac1efc471e300df5b Mon Sep 17 00:00:00 2001 From: Thomas--S Date: Sun, 18 Oct 2020 20:21:56 +0200 Subject: [PATCH] Charcoal Pile: Ignore "ignore" nodes This ensures that the charcoal pile doesn't collapse on semi-loaded areas. --- iron_age/charcoalpile.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/iron_age/charcoalpile.lua b/iron_age/charcoalpile.lua index 0ebae12..dac6a71 100644 --- a/iron_age/charcoalpile.lua +++ b/iron_age/charcoalpile.lua @@ -25,7 +25,7 @@ local function num_wood(pos) return #nodes end --- determine the number of nodes nodes (around wood) +-- determine the number of dirt nodes (around wood) local function num_dirt(pos) local pos1 = {x=pos.x-2, y=pos.y-1, z=pos.z-2} local pos2 = {x=pos.x+2, y=pos.y+3, z=pos.z+2} @@ -33,6 +33,14 @@ local function num_dirt(pos) return #nodes end +-- determine the number of ignore nodes +local function num_ignore(pos) + local pos1 = {x=pos.x-2, y=pos.y-1, z=pos.z-2} + local pos2 = {x=pos.x+2, y=pos.y+3, z=pos.z+2} + local nodes = minetest.find_nodes_in_area(pos1, pos2, "ignore") + return #nodes +end + -- replace pile top nodes local function make_dirt_with_dry_grass(pos) local pos1 = {x=pos.x-2, y=pos.y+3, z=pos.z-2} @@ -137,7 +145,7 @@ function techage.keep_running_pile(pos) return false end else - if num_wood(pos) ~= 26 or num_dirt(pos) ~= 98 then + if num_ignore(pos) == 0 and (num_wood(pos) ~= 26 or num_dirt(pos) ~= 98) then collapse_pile(pos) minetest.remove_node(pos) return false