init.lua 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. if not minetest.global_exists("distributer") then distributer = {} end
  2. distributer.modpath = minetest.get_modpath("distributer")
  3. dofile(distributer.modpath .. "/functions.lua")
  4. dofile(distributer.modpath .. "/v2.lua")
  5. -- Currently this just tells the network operator how much power is in the network.
  6. -- It also signals machine controlers when a change happens.
  7. minetest.register_node("distributer:distributer", {
  8. description = "Network EU Observer",
  9. tiles = {
  10. "technic_supply_converter_top.png", "technic_supply_converter_top.png",
  11. "technic_supply_converter_side.png", "technic_supply_converter_side.png",
  12. "technic_supply_converter_side.png", "technic_supply_converter_side.png"
  13. },
  14. groups = utility.dig_groups("machine", {
  15. immovable = 1,
  16. tier_lv = 1, tier_mv = 1, tier_hv = 1,
  17. }),
  18. paramtype2 = "facedir",
  19. on_rotate = function(...) return screwdriver.rotate_simple(...) end,
  20. is_ground_content = false,
  21. sounds = default.node_sound_metal_defaults(),
  22. on_punch = function(...)
  23. return distributer.on_punch(...) end,
  24. can_dig = function(...)
  25. return distributer.can_dig(...) end,
  26. on_timer = function(...)
  27. return distributer.on_timer(...) end,
  28. on_construct = function(...)
  29. return distributer.on_construct(...) end,
  30. after_place_node = function(...)
  31. return distributer.after_place_node(...) end,
  32. on_metadata_inventory_move = function(...)
  33. return distributer.on_metadata_inventory_move(...) end,
  34. on_metadata_inventory_put = function(...)
  35. return distributer.on_metadata_inventory_put(...) end,
  36. on_metadata_inventory_take = function(...)
  37. return distributer.on_metadata_inventory_take(...) end,
  38. on_blast = function(...)
  39. return distributer.on_blast(...) end,
  40. allow_metadata_inventory_put = function(...)
  41. return distributer.allow_metadata_inventory_put(...) end,
  42. allow_metadata_inventory_move = function(...)
  43. return distributer.allow_metadata_inventory_move(...) end,
  44. allow_metadata_inventory_take = function(...)
  45. return distributer.allow_metadata_inventory_take(...) end,
  46. on_machine_execute = function(...)
  47. return distributer.on_machine_execute(...) end,
  48. })
  49. -- Remove from craft-guide. Needs repurposing.
  50. --[[
  51. minetest.register_craft({
  52. output = 'distributer:distributer',
  53. recipe = {
  54. {'fine_wire:gold', 'rubber:rubber_fiber', 'silicon:doped_wafer'},
  55. {'cb2:lv', 'techcrafts:machine_casing', 'cb2:lv'},
  56. {'techcrafts:control_logic_unit', 'rubber:rubber_fiber', 'fine_wire:silver'},
  57. }
  58. })
  59. --]]