diff options
-rw-r--r-- | config.lua | 2 | ||||
-rw-r--r-- | nodes/node_controllers.lua | 17 | ||||
-rw-r--r-- | settingtypes.txt | 4 |
3 files changed, 15 insertions, 8 deletions
@@ -61,3 +61,5 @@ setting("int", "power_ratio", 100, "The electrical charge to 1 coal heat unit co setting("float", "marker_crate_good_duration", 3.0, "Duration that 'good' crate markers last") setting("float", "marker_crate_bad_duration", 9.0, "Duration that 'bad' crate markers last") + +setting("bool", "emerge_unloaded_mapblocks", true, "When Digtron encounters unloaded map blocks, emerge them.")
\ No newline at end of file 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, - }) diff --git a/settingtypes.txt b/settingtypes.txt index 6deee8b..0a77a7e 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -23,6 +23,10 @@ digtron_maximum_extrusion (Digtron maximum extrusion) int 25 1 100 digtron_marker_crate_good_duration (Duration that 'good' crate markers last) float 3.0 0.0 100.0 digtron_marker_crate_bad_duration (Duration that 'bad' crate markers last) float 9.0 0.0 100.0 +#When a Digtron encounters unloaded map blocks, cause them to load +#so that the Digtron can continue moving. +digtron_emerge_unloaded_mapblocks (Emerge unloaded map blocks) bool true + [Fuel costs] #eg, stone. |