station_crystals.lua 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. local crystal_w_table_functions = simplecrafting_lib.generate_table_functions('crystal_w', {
  2. show_guides = true,
  3. alphabetize_items = true})
  4. local crystal_w_table_def = {
  5. description = 'Crystal Workshop',
  6. drawtype = 'mesh',
  7. mesh = 'stations_crystal_w.obj',
  8. tiles = {'stations_crystal_w.png'},
  9. use_texture_alpha = 'opaque',
  10. sounds = default.node_sound_wood_defaults(),
  11. paramtype2 = 'facedir',
  12. paramtype = 'light',
  13. selection_box = {
  14. type = 'fixed',
  15. fixed = {-.5, -.5, -.5, .5, .2, .5},
  16. },
  17. collision_box = {
  18. type = 'fixed',
  19. fixed = {-.5, -.5, -.5, .5, .2, .5},
  20. },
  21. groups = {oddly_breakable_by_hand = 1, choppy=3},
  22. after_place_node = function(pos)
  23. local meta = minetest.get_meta(pos)
  24. meta:set_string('infotext', 'Crystal Workshop')
  25. end,
  26. }
  27. for k, v in pairs(crystal_w_table_functions) do
  28. crystal_w_table_def[k] = v
  29. end
  30. minetest.register_node('stations:crystal_workshop', crystal_w_table_def)
  31. local crystal_w_table_locked_functions = simplecrafting_lib.generate_table_functions('crystal_w', {
  32. show_guides = true,
  33. alphabetize_items = true,
  34. protect_inventory = true})
  35. local crystal_w_table_locked_def = {
  36. description = 'Crystal Workshop (locked)',
  37. drawtype = 'mesh',
  38. mesh = 'stations_crystal_w.obj',
  39. tiles = {'stations_crystal_w.png'},
  40. use_texture_alpha = 'opaque',
  41. sounds = default.node_sound_wood_defaults(),
  42. paramtype2 = 'facedir',
  43. paramtype = 'light',
  44. selection_box = {
  45. type = 'fixed',
  46. fixed = {-.5, -.5, -.5, .5, .2, .5},
  47. },
  48. collision_box = {
  49. type = 'fixed',
  50. fixed = {-.5, -.5, -.5, .5, .2, .5},
  51. },
  52. groups = {oddly_breakable_by_hand = 1, choppy=3},
  53. after_place_node = function(pos)
  54. local meta = minetest.get_meta(pos)
  55. meta:set_string('infotext', 'Crystal Workshop (locked)')
  56. end,
  57. }
  58. for k, v in pairs(crystal_w_table_locked_functions) do
  59. crystal_w_table_locked_def[k] = v
  60. end
  61. minetest.register_node('stations:crystal_workshop_locked', crystal_w_table_locked_def)
  62. local is_uninv = minetest.global_exists("unified_inventory") or false
  63. if is_uninv then
  64. unified_inventory.register_craft_type("crystal_w", {
  65. description = "Crystal Workshop",
  66. icon = 'stations_crystal_icon.png',
  67. width = 4,
  68. height = 2,
  69. uses_crafting_grid = false
  70. })
  71. end