From 222c8cd84cdd7dadecabf7974306215bf9d19d55 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Sat, 14 Sep 2019 19:49:33 +0200 Subject: [PATCH] bug with unloaded blocks fixed --- iron_age/coalburner.lua | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/iron_age/coalburner.lua b/iron_age/coalburner.lua index 295cfa1..badb70c 100644 --- a/iron_age/coalburner.lua +++ b/iron_age/coalburner.lua @@ -17,6 +17,23 @@ local S = techage.S local COAL_BURN_TIME = 1200 local CYCLE_TIME = 5 +local function get_node_lvm(pos) + local node = minetest.get_node_or_nil(pos) + if node then + return node + end + local vm = minetest.get_voxel_manip() + local MinEdge, MaxEdge = vm:read_from_map(pos, pos) + local data = vm:get_data() + local param2_data = vm:get_param2_data() + local area = VoxelArea:new({MinEdge = MinEdge, MaxEdge = MaxEdge}) + local idx = area:indexp(pos) + node = { + name = minetest.get_name_from_content_id(data[idx]), + param2 = param2_data[idx] + } + return node +end local function num_coal(pos) local pos1 = {x=pos.x, y=pos.y+1, z=pos.z} @@ -60,7 +77,7 @@ local function remove_flame(pos, height) pos = {x=pos.x, y=pos.y+height, z=pos.z} for idx=height,1,-1 do pos = {x=pos.x, y=pos.y+1, z=pos.z} - local node = minetest.get_node(pos) + local node = get_node_lvm(pos) if string.find(node.name, "techage:flame") then minetest.remove_node(pos) elseif node.name == "techage:meltingpot" then @@ -84,7 +101,7 @@ local function flame(pos, height, heat, first_time) for idx=heat,1,-1 do pos = {x=pos.x, y=pos.y+1, z=pos.z} idx = math.min(idx, 12) - local node = minetest.get_node(pos) + local node = get_node_lvm(pos) if node.name == "techage:meltingpot_active" or node.name == "ignore" then return end @@ -123,7 +140,7 @@ for idx,ratio in ipairs(lRatio) do after_destruct = function(pos, oldnode) pos.y = pos.y + 1 - local node = minetest.get_node(pos) + local node = get_node_lvm(pos) if minetest.get_item_group(node.name, "techage_flame") > 0 then minetest.remove_node(pos) end