summaryrefslogtreecommitdiff
path: root/nodes
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2018-06-10 23:00:54 -0600
committerFaceDeer <derksenmobile@gmail.com>2018-06-10 23:00:54 -0600
commit0cb8d2dc3333e6e885c0470c3dcfe3d349dadac6 (patch)
tree4eacf14162c1b298f4a3d2ad852fb7e2fd4a27dd /nodes
parent1c41a2cdcd43764e02487a9ec82aa1ec46084250 (diff)
add ability for Digtron to emerge unloaded map blocks
Diffstat (limited to 'nodes')
-rw-r--r--nodes/node_controllers.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/nodes/node_controllers.lua b/nodes/node_controllers.lua
index e00cb35..39b5318 100644
--- a/nodes/node_controllers.lua
+++ b/nodes/node_controllers.lua
@@ -127,6 +127,9 @@ local function auto_cycle(pos)
status = status .. "\n" .. S("Cycles remaining: @1", cycle) .. "\n" .. S("Halted!")
meta:set_string("infotext", status)
if return_code == 1 then --return code 1 happens when there's unloaded nodes adjacent, just keep trying.
+ if digtron.config.emerge_unloaded_mapblocks then
+ minetest.emerge_area(vector.add(pos, -128), vector.add(pos, 128))
+ end
minetest.after(meta:get_int("period"), auto_cycle, newpos)
else
meta:set_string("formspec", auto_formspec)
@@ -139,13 +142,16 @@ local function auto_cycle(pos)
end
return
end
-
+
local newpos, status, return_code = digtron.execute_dig_cycle(pos, player)
-
+
if vector.equals(pos, newpos) then
status = status .. "\n" .. S("Cycles remaining: @1", cycle) .. "\n" .. S("Halted!")
meta:set_string("infotext", status)
- if return_code == 1 then --return code 1 happens when there's unloaded nodes adjacent, just keep trying.
+ if return_code == 1 then --return code 1 happens when there's unloaded nodes adjacent, call emerge and keep trying.
+ if digtron.config.emerge_unloaded_mapblocks then
+ minetest.emerge_area(vector.add(pos, -128), vector.add(pos, 128))
+ end
minetest.after(meta:get_int("period"), auto_cycle, newpos)
else
meta:set_string("formspec", auto_formspec)
@@ -286,10 +292,6 @@ minetest.register_node("digtron:auto_controller", {
meta:set_string("waiting", "true")
meta:set_string("formspec", auto_formspec)
end,
-
- on_timer = function(pos, elapsed)
- minetest.get_meta(pos):set_string("waiting", nil)
- end,
})
---------------------------------------------------------------------------------------------------------------
@@ -341,5 +343,4 @@ minetest.register_node("digtron:pusher", {
on_timer = function(pos, elapsed)
minetest.get_meta(pos):set_string("waiting", nil)
end,
-
})