init.lua 741 B

1234567891011121314151617181920
  1. --load settings
  2. local settings = dofile( minetest.get_modpath("tunneltest") .. "/tunneltest.conf" )
  3. --functions for tunnelers
  4. local tunneler_utils = dofile( minetest.get_modpath("tunneltest") .. "/tunneler.lua" )
  5. --generate tunnelers from settings
  6. for name, desc in pairs( settings.tunneler_types ) do
  7. local toolspec = desc.toolspec
  8. toolspec.stack_max = 1
  9. toolspec.on_secondary_use = tunneler_utils.config
  10. toolspec.on_place = tunneler_utils.config
  11. minetest.register_tool( "tunneltest:"..name, toolspec )
  12. minetest.register_craft( { output = "tunneltest:"..name, recipe = desc.recipe } )
  13. end
  14. minetest.register_on_player_receive_fields( tunneler_utils.field_handler )
  15. minetest.register_on_dignode( tunneler_utils.on_dig )