nodes.lua 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. if not minetest.global_exists("grinder") then grinder = {} end
  2. if not grinder.nodes_registered then
  3. for k, v in ipairs({
  4. {name="inactive", light=0, tile="grinder_front.png"},
  5. {name="active", light=8, tile="grinder_front_active.png"},
  6. }) do
  7. minetest.register_node("grinder:" .. v.name, {
  8. description = "Electric Grinder",
  9. tiles = {
  10. "grinder_top.png", "grinder_bottom.png",
  11. "grinder_side.png", "grinder_side.png",
  12. "grinder_side.png", v.tile,
  13. },
  14. paramtype2 = "facedir",
  15. groups = utility.dig_groups("machine", {
  16. tubedevice = 1, tubedevice_receiver = 1,
  17. immovable = 1,
  18. tier_mv = 1,
  19. }),
  20. light_source = v.light,
  21. on_rotate = function(...) return screwdriver.rotate_simple(...) end,
  22. is_ground_content = false,
  23. sounds = default.node_sound_metal_defaults(),
  24. drop = "grind2:mv_inactive",
  25. can_dig = function(...)
  26. return grinder.can_dig(...) end,
  27. on_timer = function(...)
  28. return grinder.on_timer(...) end,
  29. on_construct = function(...)
  30. return grinder.on_construct(...) end,
  31. on_blast = function(...)
  32. return grinder.on_blast(...) end,
  33. on_punch = function(...)
  34. return grinder.on_punch(...) end,
  35. after_place_node = function(...)
  36. return grinder.after_place_node(...) end,
  37. on_metadata_inventory_move = function(...)
  38. return grinder.on_metadata_inventory_move(...) end,
  39. on_metadata_inventory_put = function(...)
  40. return grinder.on_metadata_inventory_put(...) end,
  41. on_metadata_inventory_take = function(...)
  42. return grinder.on_metadata_inventory_take(...) end,
  43. allow_metadata_inventory_put = function(...)
  44. return grinder.allow_metadata_inventory_put(...) end,
  45. allow_metadata_inventory_move = function(...)
  46. return grinder.allow_metadata_inventory_move(...) end,
  47. allow_metadata_inventory_take = function(...)
  48. return grinder.allow_metadata_inventory_take(...) end,
  49. on_machine_execute = function(...)
  50. return machines.on_machine_execute(...) end,
  51. })
  52. end
  53. minetest.register_alias("grinder:grinder", "grinder:inactive")
  54. minetest.register_alias("grinder:grinder_active", "grinder:active")
  55. grinder.nodes_registered = true
  56. end