2017-02-05 07:08:38 +01:00
-- internationalization boilerplate
local MP = minetest.get_modpath ( minetest.get_current_modname ( ) )
local S , NS = dofile ( MP .. " /intllib.lua " )
2016-12-31 07:38:18 +01:00
local controller_nodebox = {
{ - 0.3125 , - 0.3125 , - 0.3125 , 0.3125 , 0.3125 , 0.3125 } , -- Core
{ - 0.1875 , 0.3125 , - 0.1875 , 0.1875 , 0.5 , 0.1875 } , -- +y_connector
{ - 0.1875 , - 0.5 , - 0.1875 , 0.1875 , - 0.3125 , 0.1875 } , -- -y_Connector
{ 0.3125 , - 0.1875 , - 0.1875 , 0.5 , 0.1875 , 0.1875 } , -- +x_connector
{ - 0.5 , - 0.1875 , - 0.1875 , - 0.3125 , 0.1875 , 0.1875 } , -- -x_connector
{ - 0.1875 , - 0.1875 , 0.3125 , 0.1875 , 0.1875 , 0.5 } , -- +z_connector
{ - 0.5 , 0.125 , - 0.5 , - 0.125 , 0.5 , - 0.3125 } , -- back_connector_3
{ 0.125 , 0.125 , - 0.5 , 0.5 , 0.5 , - 0.3125 } , -- back_connector_1
{ 0.125 , - 0.5 , - 0.5 , 0.5 , - 0.125 , - 0.3125 } , -- back_connector_2
{ - 0.5 , - 0.5 , - 0.5 , - 0.125 , - 0.125 , - 0.3125 } , -- back_connector_4
}
2019-01-05 06:06:12 +01:00
local node_inventory_table = { type = " node " } -- a reusable parameter for get_inventory calls, set the pos parameter before using.
2021-08-21 09:42:00 +02:00
local use_texture_alpha = minetest.features . use_texture_alpha_string_modes and " opaque " or nil
2016-12-31 07:38:18 +01:00
-- Master controller. Most complicated part of the whole system. Determines which direction a digtron moves and triggers all of its component parts.
minetest.register_node ( " digtron:controller " , {
2017-02-05 07:08:38 +01:00
description = S ( " Digtron Control Module " ) ,
2017-01-18 03:57:20 +01:00
_doc_items_longdesc = digtron.doc . controller_longdesc ,
_doc_items_usagehelp = digtron.doc . controller_usagehelp ,
2017-01-03 04:07:15 +01:00
groups = { cracky = 3 , oddly_breakable_by_hand = 3 , digtron = 1 } ,
2017-01-04 03:43:32 +01:00
drop = " digtron:controller " ,
2017-01-04 07:56:34 +01:00
sounds = digtron.metal_sounds ,
2017-01-06 07:52:09 +01:00
paramtype = " light " ,
2017-01-04 03:43:32 +01:00
paramtype2 = " facedir " ,
2017-01-06 07:52:09 +01:00
is_ground_content = false ,
2016-12-31 07:38:18 +01:00
-- Aims in the +Z direction by default
tiles = {
" digtron_plate.png^[transformR90 " ,
" digtron_plate.png^[transformR270 " ,
" digtron_plate.png " ,
" digtron_plate.png^[transformR180 " ,
" digtron_plate.png " ,
2017-01-11 06:59:11 +01:00
" digtron_plate.png^digtron_control.png " ,
2016-12-31 07:38:18 +01:00
} ,
2023-06-05 12:34:40 +02:00
2016-12-31 07:38:18 +01:00
drawtype = " nodebox " ,
node_box = {
type = " fixed " ,
fixed = controller_nodebox ,
} ,
2023-06-05 12:34:40 +02:00
2017-01-02 01:12:32 +01:00
on_construct = function ( pos )
2017-01-04 03:43:32 +01:00
local meta = minetest.get_meta ( pos )
2017-01-02 01:12:32 +01:00
meta : set_float ( " fuel_burning " , 0.0 )
2017-09-20 07:44:59 +02:00
meta : set_string ( " infotext " , S ( " Heat remaining in controller furnace: @1 " , 0 ) )
2017-01-02 01:12:32 +01:00
end ,
2023-06-05 12:34:40 +02:00
2016-12-31 07:38:18 +01:00
on_rightclick = function ( pos , node , clicker , itemstack , pointed_thing )
2017-01-04 07:03:41 +01:00
local meta = minetest.get_meta ( pos )
2020-04-02 21:48:28 +02:00
-- new delay code without nodetimer (lost on crating)
local now = minetest.get_gametime ( )
local last_time = ( tonumber ( meta : get_string ( " last_time " ) ) or 0 )
-- if meta:get_string("waiting") == "true" then
if last_time + digtron.config . cycle_time > now then
-- Been too soon since last time the digtron did a cycle.
2023-06-05 12:39:36 +02:00
2020-04-02 21:48:28 +02:00
-- added for clarity
meta : set_string ( " infotext " , S ( " repetition delay " ) )
2023-06-05 12:39:36 +02:00
2020-04-02 21:48:28 +02:00
return
2017-01-04 07:03:41 +01:00
end
2023-06-05 12:34:40 +02:00
2017-01-09 05:34:27 +01:00
local newpos , status , return_code = digtron.execute_dig_cycle ( pos , clicker )
2023-06-05 12:34:40 +02:00
2017-01-04 07:03:41 +01:00
meta = minetest.get_meta ( newpos )
2017-01-03 04:07:15 +01:00
if status ~= nil then
meta : set_string ( " infotext " , status )
2016-12-31 07:38:18 +01:00
end
2023-06-05 12:34:40 +02:00
2017-01-07 17:52:39 +01:00
-- Start the delay before digtron can run again.
2017-01-04 07:03:41 +01:00
minetest.get_meta ( newpos ) : set_string ( " waiting " , " true " )
2020-04-02 21:48:28 +02:00
-- minetest.get_node_timer(newpos):start(digtron.config.cycle_time)
-- new delay code
meta : set_string ( " last_time " , tostring ( minetest.get_gametime ( ) ) )
2017-01-08 09:23:10 +01:00
end ,
2023-06-05 12:34:40 +02:00
2017-01-08 09:23:10 +01:00
on_timer = function ( pos , elapsed )
minetest.get_meta ( pos ) : set_string ( " waiting " , nil )
2016-12-31 07:38:18 +01:00
end ,
} )
2017-01-07 17:52:39 +01:00
-- Auto-controller
2017-01-04 07:03:41 +01:00
---------------------------------------------------------------------------------------------------------------
2017-01-28 03:40:10 +01:00
local auto_formspec = " size[8,6.2] " ..
2017-01-04 07:03:41 +01:00
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
2017-02-02 04:32:58 +01:00
" container[2.0,0] " ..
2017-02-05 07:08:38 +01:00
" field[0.0,0.8;1,0.1;cycles; " .. S ( " Cycles " ) .. " ;${cycles}] " ..
" tooltip[cycles; " .. S ( " When triggered, this controller will try to run for the given number of cycles. \n The cycle count will decrement as it runs, so if it gets halted by a problem \n you can fix the problem and restart. " ) .. " ] " ..
" button_exit[0.7,0.5;1,0.1;set; " .. S ( " Set " ) .. " ] " ..
" tooltip[set; " .. S ( " Saves the cycle setting without starting the controller running " ) .. " ] " ..
" button_exit[1.7,0.5;1,0.1;execute; " .. S ( " Set & \n Execute " ) .. " ] " ..
" tooltip[execute; " .. S ( " Begins executing the given number of cycles " ) .. " ] " ..
" field[0.0,2.0;1,0.1;slope; " .. S ( " Slope " ) .. " ;${slope}] " ..
2017-02-15 00:34:46 +01:00
" tooltip[slope; " .. S ( " For diagonal digging. After moving forward this number of nodes the auto controller \n will add an additional cycle moving the digtron laterally in the \n direction of the arrows on the side of this controller. \n Set to 0 for no lateral digging. " ) .. " ] " ..
2017-02-05 07:08:38 +01:00
" field[1.0,2.0;1,0.1;offset; " .. S ( " Offset " ) .. " ;${offset}] " ..
2017-02-15 00:34:46 +01:00
" tooltip[offset; " .. S ( " Sets the offset of the lateral motion defined in the Slope field. \n Note: this offset is relative to the controller's location. \n The controller will move laterally when it reaches the indicated point. " ) .. " ] " ..
2017-02-05 07:08:38 +01:00
" field[2.0,2.0;1,0.1;period; " .. S ( " Delay " ) .. " ;${period}] " ..
" tooltip[period; " .. S ( " Number of seconds to wait between each cycle " ) .. " ] " ..
2017-01-28 03:40:10 +01:00
" list[current_name;stop;3.0,0.7;1,1;] " ..
2017-02-05 07:08:38 +01:00
" label[3.0,1.5; " .. S ( " Stop block " ) .. " ] " ..
2017-01-28 03:40:10 +01:00
" container_end[] " ..
" list[current_player;main;0,2.3;8,1;] " ..
default.get_hotbar_bg ( 0 , 2.3 ) ..
" list[current_player;main;0,3.5;8,3;8] " ..
" listring[current_player;main] " ..
" listring[current_name;stop] "
2017-02-02 04:32:58 +01:00
if minetest.get_modpath ( " doc " ) then
auto_formspec = auto_formspec ..
2017-02-05 07:08:38 +01:00
" button_exit[7.0,0.5;1,0.1;help; " .. S ( " Help " ) .. " ] " ..
" tooltip[help; " .. S ( " Show documentation about this block " ) .. " ] "
2017-02-02 04:32:58 +01:00
end
2018-01-26 21:26:14 +01:00
local function auto_cycle ( pos )
2017-01-15 00:58:37 +01:00
local node = minetest.get_node ( pos )
local controlling_coordinate = digtron.get_controlling_coordinate ( pos , node.param2 )
2017-01-04 07:03:41 +01:00
local meta = minetest.get_meta ( pos )
local player = minetest.get_player_by_name ( meta : get_string ( " triggering_player " ) )
if player == nil or meta : get_string ( " waiting " ) == " true " then
return
end
2017-01-15 00:58:37 +01:00
local cycle = meta : get_int ( " cycles " )
local slope = meta : get_int ( " slope " )
2023-06-05 12:34:40 +02:00
2017-01-15 00:58:37 +01:00
if meta : get_string ( " lateral_done " ) ~= " true " and slope ~= 0 and ( pos [ controlling_coordinate ] + meta : get_int ( " offset " ) ) % slope == 0 then
--Do a downward dig cycle. Don't update the "cycles" count, these don't count towards that.
local newpos , status , return_code = digtron.execute_downward_dig_cycle ( pos , player )
2023-06-05 12:34:40 +02:00
2017-01-15 00:58:37 +01:00
if vector.equals ( pos , newpos ) then
2017-09-20 07:44:59 +02:00
status = status .. " \n " .. S ( " Cycles remaining: @1 " , cycle ) .. " \n " .. S ( " Halted! " )
2017-01-15 00:58:37 +01:00
meta : set_string ( " infotext " , status )
if return_code == 1 then --return code 1 happens when there's unloaded nodes adjacent, just keep trying.
2018-06-11 07:00:54 +02:00
if digtron.config . emerge_unloaded_mapblocks then
2019-01-05 06:06:12 +01:00
minetest.emerge_area ( vector.add ( pos , - 80 ) , vector.add ( pos , 80 ) )
2018-06-11 07:00:54 +02:00
end
2018-01-26 21:26:14 +01:00
minetest.after ( meta : get_int ( " period " ) , auto_cycle , newpos )
2017-01-15 00:58:37 +01:00
else
meta : set_string ( " formspec " , auto_formspec )
end
else
meta = minetest.get_meta ( newpos )
2018-01-26 21:26:14 +01:00
minetest.after ( meta : get_int ( " period " ) , auto_cycle , newpos )
2017-01-15 00:58:37 +01:00
meta : set_string ( " infotext " , status )
meta : set_string ( " lateral_done " , " true " )
end
return
end
2018-06-11 07:00:54 +02:00
2017-01-09 05:34:27 +01:00
local newpos , status , return_code = digtron.execute_dig_cycle ( pos , player )
2018-06-11 07:00:54 +02:00
2017-01-04 07:03:41 +01:00
if vector.equals ( pos , newpos ) then
2017-09-20 07:44:59 +02:00
status = status .. " \n " .. S ( " Cycles remaining: @1 " , cycle ) .. " \n " .. S ( " Halted! " )
2017-01-04 07:03:41 +01:00
meta : set_string ( " infotext " , status )
2018-06-11 07:00:54 +02:00
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
2019-01-05 06:06:12 +01:00
minetest.emerge_area ( vector.add ( pos , - 80 ) , vector.add ( pos , 80 ) )
2018-06-11 07:00:54 +02:00
end
2018-01-26 21:26:14 +01:00
minetest.after ( meta : get_int ( " period " ) , auto_cycle , newpos )
2017-01-08 01:00:15 +01:00
else
meta : set_string ( " formspec " , auto_formspec )
end
2017-01-04 07:03:41 +01:00
return
end
2023-06-05 12:34:40 +02:00
2017-01-04 07:03:41 +01:00
meta = minetest.get_meta ( newpos )
2017-01-15 00:58:37 +01:00
cycle = meta : get_int ( " cycles " ) - 1
meta : set_int ( " cycles " , cycle )
2017-09-20 07:44:59 +02:00
status = status .. " \n " .. S ( " Cycles remaining: @1 " , cycle )
2017-01-04 07:03:41 +01:00
meta : set_string ( " infotext " , status )
2017-01-15 00:58:37 +01:00
meta : set_string ( " lateral_done " , nil )
2023-06-05 12:34:40 +02:00
2017-01-04 07:03:41 +01:00
if cycle > 0 then
2018-01-26 21:26:14 +01:00
minetest.after ( meta : get_int ( " period " ) , auto_cycle , newpos )
2017-01-04 07:03:41 +01:00
else
meta : set_string ( " formspec " , auto_formspec )
end
end
minetest.register_node ( " digtron:auto_controller " , {
2017-02-05 07:08:38 +01:00
description = S ( " Digtron Automatic Control Module " ) ,
2017-01-18 03:57:20 +01:00
_doc_items_longdesc = digtron.doc . auto_controller_longdesc ,
_doc_items_usagehelp = digtron.doc . auto_controller_usagehelp ,
2017-10-15 08:44:12 +02:00
--Don't set a _digtron_formspec for this node_def.
--Auto-controller has special formspec handling, while active it has no formspec and right-clicking interrupts it.
2017-01-04 07:03:41 +01:00
groups = { cracky = 3 , oddly_breakable_by_hand = 3 , digtron = 1 } ,
drop = " digtron:auto_controller " ,
2017-01-04 07:56:34 +01:00
sounds = digtron.metal_sounds ,
2021-08-21 09:42:00 +02:00
use_texture_alpha = use_texture_alpha ,
2017-01-06 07:52:09 +01:00
paramtype = " light " ,
2017-01-04 07:03:41 +01:00
paramtype2 = " facedir " ,
2017-01-06 07:52:09 +01:00
is_ground_content = false ,
2017-01-04 07:03:41 +01:00
-- Aims in the +Z direction by default
tiles = {
2017-01-22 04:38:19 +01:00
" digtron_plate.png^[transformR90^[colorize: " .. digtron.auto_controller_colorize ,
" digtron_plate.png^[transformR270^[colorize: " .. digtron.auto_controller_colorize ,
" digtron_plate.png^digtron_axel_side.png^[transformR270^[colorize: " .. digtron.auto_controller_colorize ,
" digtron_plate.png^digtron_axel_side.png^[transformR270^[colorize: " .. digtron.auto_controller_colorize ,
" digtron_plate.png^[colorize: " .. digtron.auto_controller_colorize ,
" digtron_plate.png^digtron_control.png^[colorize: " .. digtron.auto_controller_colorize ,
2017-01-04 07:03:41 +01:00
} ,
2023-06-05 12:34:40 +02:00
2017-01-04 07:03:41 +01:00
drawtype = " nodebox " ,
node_box = {
type = " fixed " ,
fixed = controller_nodebox ,
} ,
2023-06-05 12:34:40 +02:00
2017-01-04 07:03:41 +01:00
on_construct = function ( pos )
local meta = minetest.get_meta ( pos )
meta : set_float ( " fuel_burning " , 0.0 )
2017-09-20 07:44:59 +02:00
meta : set_string ( " infotext " , S ( " Heat remaining in controller furnace: @1 " , 0 ) )
2017-01-04 07:03:41 +01:00
meta : set_string ( " formspec " , auto_formspec )
-- Reusing offset and period to keep the digtron node-moving code simple, and the names still fit well
2017-09-12 08:20:52 +02:00
meta : set_int ( " period " , digtron.config . cycle_time )
2017-01-04 07:03:41 +01:00
meta : set_int ( " offset " , 0 )
2017-01-15 00:58:37 +01:00
meta : set_int ( " cycles " , 0 )
meta : set_int ( " slope " , 0 )
2023-06-05 12:34:40 +02:00
2017-01-28 03:40:10 +01:00
local inv = meta : get_inventory ( )
inv : set_size ( " stop " , 1 )
2017-01-04 07:03:41 +01:00
end ,
2017-01-28 03:40:10 +01:00
allow_metadata_inventory_put = function ( pos , listname , index , stack , player )
if minetest.get_item_group ( stack : get_name ( ) , " digtron " ) ~= 0 then
return 0 -- pointless setting a Digtron node as a stop block
end
2019-01-05 06:06:12 +01:00
node_inventory_table.pos = pos
local inv = minetest.get_inventory ( node_inventory_table )
2017-01-28 03:40:10 +01:00
inv : set_stack ( listname , index , stack : take_item ( 1 ) )
return 0
end ,
2023-06-05 12:34:40 +02:00
2017-01-28 03:40:10 +01:00
allow_metadata_inventory_take = function ( pos , listname , index , stack , player )
2019-01-05 06:06:12 +01:00
node_inventory_table.pos = pos
local inv = minetest.get_inventory ( node_inventory_table )
2017-01-28 03:40:10 +01:00
inv : set_stack ( listname , index , ItemStack ( " " ) )
return 0
end ,
2023-06-05 12:34:40 +02:00
2017-01-04 07:03:41 +01:00
on_receive_fields = function ( pos , formname , fields , sender )
local meta = minetest.get_meta ( pos )
local offset = tonumber ( fields.offset )
local period = tonumber ( fields.period )
2017-01-15 00:58:37 +01:00
local slope = tonumber ( fields.slope )
local cycles = tonumber ( fields.cycles )
2023-06-05 12:34:40 +02:00
2017-01-04 07:03:41 +01:00
if period and period > 0 then
2017-09-12 08:20:52 +02:00
meta : set_int ( " period " , math.max ( digtron.config . cycle_time , math.floor ( period ) ) )
2017-01-04 07:03:41 +01:00
end
2017-01-15 00:58:37 +01:00
if offset then
meta : set_int ( " offset " , offset )
end
2023-06-05 12:34:40 +02:00
2017-01-15 00:58:37 +01:00
if slope and slope >= 0 then
meta : set_int ( " slope " , slope )
end
2023-06-05 12:34:40 +02:00
2017-01-15 00:58:37 +01:00
if cycles and cycles >= 0 then
meta : set_int ( " cycles " , math.floor ( cycles ) )
if sender : is_player ( ) and cycles > 0 then
2017-01-04 07:03:41 +01:00
meta : set_string ( " triggering_player " , sender : get_player_name ( ) )
if fields.execute then
meta : set_string ( " waiting " , nil )
meta : set_string ( " formspec " , nil )
2018-01-26 21:26:14 +01:00
auto_cycle ( pos )
2017-01-04 07:03:41 +01:00
end
end
end
2017-01-15 00:58:37 +01:00
if fields.set and slope and slope > 0 then
local node = minetest.get_node ( pos )
local controlling_coordinate = digtron.get_controlling_coordinate ( pos , node.param2 )
2023-06-05 12:34:40 +02:00
2020-08-11 18:57:09 +02:00
offset = offset or 0
2017-01-22 04:38:19 +01:00
local newpos = pos
2017-01-15 00:58:37 +01:00
local markerpos = { x = newpos.x , y = newpos.y , z = newpos.z }
local x_pos = math.floor ( ( newpos [ controlling_coordinate ] + offset ) / slope ) * slope - offset
markerpos [ controlling_coordinate ] = x_pos
minetest.add_entity ( markerpos , " digtron:marker_vertical " )
if x_pos >= newpos [ controlling_coordinate ] then
markerpos [ controlling_coordinate ] = x_pos - slope
minetest.add_entity ( markerpos , " digtron:marker_vertical " )
end
if x_pos <= newpos [ controlling_coordinate ] then
markerpos [ controlling_coordinate ] = x_pos + slope
minetest.add_entity ( markerpos , " digtron:marker_vertical " )
end
2017-02-02 04:32:58 +01:00
end
2023-06-05 12:34:40 +02:00
2017-02-02 04:32:58 +01:00
if fields.help and minetest.get_modpath ( " doc " ) then --check for mod in case someone disabled it after this digger was built
2017-09-11 07:24:09 +02:00
minetest.after ( 0.5 , doc.show_entry , sender : get_player_name ( ) , " nodes " , " digtron:auto_controller " , true )
2017-02-02 04:32:58 +01:00
end
2017-01-04 07:03:41 +01:00
end ,
2023-06-05 12:34:40 +02:00
2017-01-04 07:03:41 +01:00
on_rightclick = function ( pos , node , clicker , itemstack , pointed_thing )
local meta = minetest.get_meta ( pos )
2017-02-05 07:08:38 +01:00
meta : set_string ( " infotext " , meta : get_string ( " infotext " ) .. " \n " .. S ( " Interrupted! " ) )
2017-01-04 07:03:41 +01:00
meta : set_string ( " waiting " , " true " )
meta : set_string ( " formspec " , auto_formspec )
end ,
} )
---------------------------------------------------------------------------------------------------------------
2016-12-31 07:38:18 +01:00
-- A much simplified control unit that only moves the digtron, and doesn't trigger the diggers or builders.
-- Handy for shoving a digtron to the side if it's been built a bit off.
minetest.register_node ( " digtron:pusher " , {
2017-02-05 07:08:38 +01:00
description = S ( " Digtron Pusher Module " ) ,
2017-01-18 03:57:20 +01:00
_doc_items_longdesc = digtron.doc . pusher_longdesc ,
_doc_items_usagehelp = digtron.doc . pusher_usagehelp ,
2017-01-03 04:07:15 +01:00
groups = { cracky = 3 , oddly_breakable_by_hand = 3 , digtron = 1 } ,
2017-01-04 03:43:32 +01:00
drop = " digtron:pusher " ,
2017-01-04 07:56:34 +01:00
sounds = digtron.metal_sounds ,
2021-08-21 09:42:00 +02:00
use_texture_alpha = use_texture_alpha ,
2017-01-06 07:52:09 +01:00
paramtype = " light " ,
2017-01-04 03:43:32 +01:00
paramtype2 = " facedir " ,
2017-01-06 07:52:09 +01:00
is_ground_content = false ,
2016-12-31 07:38:18 +01:00
-- Aims in the +Z direction by default
tiles = {
2017-01-22 04:38:19 +01:00
" digtron_plate.png^[transformR90^[colorize: " .. digtron.pusher_controller_colorize ,
" digtron_plate.png^[transformR270^[colorize: " .. digtron.pusher_controller_colorize ,
" digtron_plate.png^[colorize: " .. digtron.pusher_controller_colorize ,
" digtron_plate.png^[transformR180^[colorize: " .. digtron.pusher_controller_colorize ,
" digtron_plate.png^[colorize: " .. digtron.pusher_controller_colorize ,
" digtron_plate.png^digtron_control.png^[colorize: " .. digtron.pusher_controller_colorize ,
2016-12-31 07:38:18 +01:00
} ,
2023-06-05 12:34:40 +02:00
2016-12-31 07:38:18 +01:00
drawtype = " nodebox " ,
node_box = {
type = " fixed " ,
fixed = controller_nodebox ,
} ,
2023-06-05 12:34:40 +02:00
2016-12-31 07:38:18 +01:00
on_rightclick = function ( pos , node , clicker , itemstack , pointed_thing )
local meta = minetest.get_meta ( pos )
if meta : get_string ( " waiting " ) == " true " then
-- Been too soon since last time the digtron did a cycle.
return
end
2017-01-09 05:34:27 +01:00
local newpos , status_text , return_code = digtron.execute_move_cycle ( pos , clicker )
2017-01-10 08:29:09 +01:00
meta = minetest.get_meta ( newpos )
2017-01-09 05:34:27 +01:00
meta : set_string ( " infotext " , status_text )
2023-06-05 12:34:40 +02:00
2017-01-09 05:34:27 +01:00
-- Start the delay before digtron can run again.
minetest.get_meta ( newpos ) : set_string ( " waiting " , " true " )
2017-09-12 08:20:52 +02:00
minetest.get_node_timer ( newpos ) : start ( digtron.config . cycle_time )
2017-01-08 09:23:10 +01:00
end ,
2023-06-05 12:34:40 +02:00
2017-01-08 09:23:10 +01:00
on_timer = function ( pos , elapsed )
minetest.get_meta ( pos ) : set_string ( " waiting " , nil )
2016-12-31 07:38:18 +01:00
end ,
2018-01-26 21:26:14 +01:00
} )