mirror of
https://github.com/minetest-mods/digtron.git
synced 2024-12-22 20:32:22 +01:00
add ability for Digtron to emerge unloaded map blocks
This commit is contained in:
parent
1c41a2cdcd
commit
0cb8d2dc33
@ -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_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("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.")
|
@ -127,6 +127,9 @@ local function auto_cycle(pos)
|
|||||||
status = status .. "\n" .. S("Cycles remaining: @1", cycle) .. "\n" .. S("Halted!")
|
status = status .. "\n" .. S("Cycles remaining: @1", cycle) .. "\n" .. S("Halted!")
|
||||||
meta:set_string("infotext", status)
|
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, 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)
|
minetest.after(meta:get_int("period"), auto_cycle, newpos)
|
||||||
else
|
else
|
||||||
meta:set_string("formspec", auto_formspec)
|
meta:set_string("formspec", auto_formspec)
|
||||||
@ -139,13 +142,16 @@ local function auto_cycle(pos)
|
|||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local newpos, status, return_code = digtron.execute_dig_cycle(pos, player)
|
local newpos, status, return_code = digtron.execute_dig_cycle(pos, player)
|
||||||
|
|
||||||
if vector.equals(pos, newpos) then
|
if vector.equals(pos, newpos) then
|
||||||
status = status .. "\n" .. S("Cycles remaining: @1", cycle) .. "\n" .. S("Halted!")
|
status = status .. "\n" .. S("Cycles remaining: @1", cycle) .. "\n" .. S("Halted!")
|
||||||
meta:set_string("infotext", status)
|
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)
|
minetest.after(meta:get_int("period"), auto_cycle, newpos)
|
||||||
else
|
else
|
||||||
meta:set_string("formspec", auto_formspec)
|
meta:set_string("formspec", auto_formspec)
|
||||||
@ -286,10 +292,6 @@ minetest.register_node("digtron:auto_controller", {
|
|||||||
meta:set_string("waiting", "true")
|
meta:set_string("waiting", "true")
|
||||||
meta:set_string("formspec", auto_formspec)
|
meta:set_string("formspec", auto_formspec)
|
||||||
end,
|
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)
|
on_timer = function(pos, elapsed)
|
||||||
minetest.get_meta(pos):set_string("waiting", nil)
|
minetest.get_meta(pos):set_string("waiting", nil)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -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_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
|
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]
|
[Fuel costs]
|
||||||
|
|
||||||
#eg, stone.
|
#eg, stone.
|
||||||
|
Loading…
Reference in New Issue
Block a user