station_woodworking.lua 2.9 KB

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