From 253ff1281571b888cfbfeb1a719eb98a1b5b98de Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Thu, 5 Jan 2017 20:38:08 -0700 Subject: add lava and water alerts, and an option for setting lava impassible (true by default) --- util.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'util.lua') diff --git a/util.lua b/util.lua index 2c1c967..a74f21f 100644 --- a/util.lua +++ b/util.lua @@ -138,6 +138,8 @@ digtron.get_all_digtron_neighbours = function(pos, player) layout.diggers = {} layout.builders = {} layout.extents = {} + layout.water_touching = false + layout.lava_touching = false layout.protected = Pointset.create() -- if any nodes we look at are protected, make note of that. That way we don't need to keep re-testing protection state later. layout.controller = {x=pos.x, y=pos.y, z=pos.z} --Make a deep copy of the pos parameter just in case the calling code wants to play silly buggers with it @@ -182,6 +184,15 @@ digtron.get_all_digtron_neighbours = function(pos, player) layout.protected:set(testpos.x, testpos.y, testpos.z, true) end + if minetest.get_item_group(node.name, "water") ~= 0 then + layout.water_touching = true + elseif minetest.get_item_group(node.name, "lava") ~= 0 then + layout.lava_touching = true + if digtron.lava_impassible == true then + layout.protected:set(testpos.x, testpos.y, testpos.z, true) + end + end + local group_number = minetest.get_item_group(node.name, "digtron") if group_number > 0 then --found one. Add it to the digtrons output -- cgit v1.2.3