init.lua 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. generator = generator or {}
  2. generator.modpath = minetest.get_modpath("generator")
  3. dofile(generator.modpath .. "/functions.lua")
  4. dofile(generator.modpath .. "/generator.lua")
  5. for k, v in ipairs({
  6. {name="inactive", tile="generator_mv_front.png", light=0},
  7. {name="active", tile="generator_mv_front_active.png", light=8},
  8. }) do
  9. minetest.register_node("generator:" .. v.name, {
  10. description = "LV/MV Power Generator",
  11. tiles = {
  12. "generator_mv_top.png", "generator_mv_bottom.png",
  13. "generator_mv_side.png", "generator_mv_side.png",
  14. "generator_mv_side.png", v.tile,
  15. },
  16. groups = utility.dig_groups("machine", {
  17. immovable = 1,
  18. tier_lv = 1, tier_mv = 1,
  19. }),
  20. paramtype2 = "facedir",
  21. on_rotate = function(...) return screwdriver.rotate_simple(...) end,
  22. is_ground_content = false,
  23. sounds = default.node_sound_metal_defaults(),
  24. drop = "gen2:mv_inactive",
  25. light_source = v.light,
  26. on_punch = function(...)
  27. return generator.on_punch(...) end,
  28. can_dig = function(...)
  29. return generator.can_dig(...) end,
  30. on_timer = function(...)
  31. return generator.on_timer(...) end,
  32. on_construct = function(...)
  33. return generator.on_construct(...) end,
  34. after_place_node = function(...)
  35. return generator.after_place_node(...) end,
  36. on_metadata_inventory_move = function(...)
  37. return generator.on_metadata_inventory_move(...) end,
  38. on_metadata_inventory_put = function(...)
  39. return generator.on_metadata_inventory_put(...) end,
  40. on_metadata_inventory_take = function(...)
  41. return generator.on_metadata_inventory_take(...) end,
  42. on_blast = function(...)
  43. return generator.on_blast(...) end,
  44. allow_metadata_inventory_put = function(...)
  45. return generator.allow_metadata_inventory_put(...) end,
  46. allow_metadata_inventory_move = function(...)
  47. return generator.allow_metadata_inventory_move(...) end,
  48. allow_metadata_inventory_take = function(...)
  49. return generator.allow_metadata_inventory_take(...) end,
  50. on_machine_execute = function(...)
  51. return machines.on_machine_execute(...) end,
  52. })
  53. end
  54. minetest.register_craft({
  55. output = 'gen2:lv_inactive',
  56. recipe = {
  57. {'default:steel_ingot', 'cobble_furnace:inactive', 'default:steel_ingot'},
  58. {'techcrafts:copper_coil', 'techcrafts:machine_casing', 'techcrafts:copper_coil'},
  59. {'default:steel_ingot', 'techcrafts:electric_motor', 'default:steel_ingot'},
  60. },
  61. })
  62. minetest.register_craft({
  63. output = 'gen2:mv_inactive',
  64. recipe = {
  65. {'stainless_steel:ingot', 'gen2:lv_inactive', 'stainless_steel:ingot'},
  66. {'default:stonebrick', 'transformer:mv', 'default:stonebrick'},
  67. {'stainless_steel:ingot', 'cb2:mv', 'stainless_steel:ingot'},
  68. }
  69. })
  70. minetest.register_craft({
  71. output = 'gen2:hv_inactive',
  72. recipe = {
  73. {'techcrafts:carbon_plate', 'gen2:mv_inactive', 'techcrafts:composite_plate'},
  74. {'default:stonebrick', 'transformer:hv', 'default:stonebrick'},
  75. {'stainless_steel:ingot', 'cb2:hv', 'stainless_steel:ingot'},
  76. }
  77. })