station_stone_carving.lua 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. local stone_carving_table_functions = simplecrafting_lib.generate_table_functions('stone_carving', {
  2. show_guides = true,
  3. alphabetize_items = true,}
  4. )
  5. local stone_carving_table_def = {
  6. description = 'Stone Carving',
  7. drawtype = 'mesh',
  8. mesh = 'stations_stone_carving.obj',
  9. tiles = {'stations_stone_carving.png'},
  10. use_texture_alpha = 'opaque',
  11. sounds = default.node_sound_wood_defaults(),
  12. paramtype2 = 'facedir',
  13. paramtype = 'light',
  14. selection_box = {
  15. type = 'fixed',
  16. fixed = {-.4, -.5, -.4, .4, 1.25, .4},
  17. },
  18. collision_box = {
  19. type = 'fixed',
  20. fixed = {-.4, -.5, -.4, .4, 1.25, .4},
  21. },
  22. groups = {oddly_breakable_by_hand = 1, cracky=3},
  23. after_place_node = function(pos, placer, itemstack)
  24. if not epic.space_on_top(pos) then
  25. minetest.remove_node(pos)
  26. return itemstack
  27. end
  28. local meta = minetest.get_meta(pos)
  29. meta:set_string('infotext', 'Stone Carving')
  30. end,
  31. after_dig_node = function(pos, oldnode, oldmetadata, digger)
  32. epic.remove_top_node(pos, oldnode)
  33. end,
  34. }
  35. for k, v in pairs(stone_carving_table_functions) do
  36. stone_carving_table_def[k] = v
  37. end
  38. minetest.register_node('stations:stone_carving', stone_carving_table_def)
  39. local stone_carving_locked_functions = simplecrafting_lib.generate_table_functions('stone_carving', {
  40. show_guides = true,
  41. alphabetize_items = true,
  42. protect_inventory = true,}
  43. )
  44. local stone_carving_locked_def = {
  45. description = 'Stone Carving (locked)',
  46. drawtype = 'mesh',
  47. mesh = 'stations_stone_carving.obj',
  48. tiles = {'stations_stone_carving.png'},
  49. use_texture_alpha = 'opaque',
  50. sounds = default.node_sound_wood_defaults(),
  51. paramtype2 = 'facedir',
  52. paramtype = 'light',
  53. selection_box = {
  54. type = 'fixed',
  55. fixed = {-.4, -.5, -.4, .4, 1.25, .4},
  56. },
  57. collision_box = {
  58. type = 'fixed',
  59. fixed = {-.4, -.5, -.4, .4, 1.25, .4},
  60. },
  61. groups = {oddly_breakable_by_hand = 1, cracky=3},
  62. after_place_node = function(pos, placer, itemstack)
  63. if not epic.space_on_top(pos) then
  64. minetest.remove_node(pos)
  65. return itemstack
  66. end
  67. local meta = minetest.get_meta(pos)
  68. meta:set_string('infotext', 'Stone Carving (Locked)')
  69. end,
  70. after_dig_node = function(pos, oldnode, oldmetadata, digger)
  71. epic.remove_top_node(pos, oldnode)
  72. end,
  73. }
  74. for k, v in pairs(stone_carving_locked_functions) do
  75. stone_carving_locked_def[k] = v
  76. end
  77. minetest.register_node('stations:stone_carving_locked', stone_carving_locked_def)
  78. local is_uninv = minetest.global_exists("unified_inventory") or false
  79. if is_uninv then
  80. unified_inventory.register_craft_type("stone_carving", {
  81. description = "Stone Carving",
  82. icon = 'stations_stone_carving_icon.png',
  83. width = 4,
  84. height = 2,
  85. uses_crafting_grid = false
  86. })
  87. end