diff options
author | FaceDeer <derksenmobile@gmail.com> | 2017-01-05 20:38:08 -0700 |
---|---|---|
committer | FaceDeer <derksenmobile@gmail.com> | 2017-01-05 20:38:08 -0700 |
commit | 253ff1281571b888cfbfeb1a719eb98a1b5b98de (patch) | |
tree | d0995c9782df97af058b9b3757acba805d80676d /util.lua | |
parent | 1307710a60589555f7f08da90b28b78ae111f565 (diff) |
add lava and water alerts, and an option for setting lava impassible (true by default)
Diffstat (limited to 'util.lua')
-rw-r--r-- | util.lua | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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 |