local crystal_w_table_functions = simplecrafting_lib.generate_table_functions('crystal_w', {
   show_guides = true,
   alphabetize_items = true})

local crystal_w_table_def = {
   description = 'Crystal Workshop',
   drawtype = 'mesh',
   mesh = 'stations_crystal_w.obj',
   tiles = {'stations_crystal_w.png'},
   use_texture_alpha = 'opaque',
   sounds = default.node_sound_wood_defaults(),
   paramtype2 = 'facedir',
   paramtype = 'light',
   selection_box = {
      type = 'fixed',
      fixed = {-.5, -.5, -.5, .5, .2, .5},
      },
   collision_box = {
      type = 'fixed',
      fixed = {-.5, -.5, -.5, .5, .2, .5},
      },
   groups = {oddly_breakable_by_hand = 1, choppy=3},
   after_place_node = function(pos)
      local meta = minetest.get_meta(pos)
      meta:set_string('infotext', 'Crystal Workshop')
   end,
}
for k, v in pairs(crystal_w_table_functions) do
   crystal_w_table_def[k] = v
end

minetest.register_node('stations:crystal_workshop', crystal_w_table_def)


local crystal_w_table_locked_functions = simplecrafting_lib.generate_table_functions('crystal_w', {
   show_guides = true,
   alphabetize_items = true,
   protect_inventory = true})

local crystal_w_table_locked_def = {
   description = 'Crystal Workshop (locked)',
   drawtype = 'mesh',
   mesh = 'stations_crystal_w.obj',
   tiles = {'stations_crystal_w.png'},
   use_texture_alpha = 'opaque',
   sounds = default.node_sound_wood_defaults(),
   paramtype2 = 'facedir',
   paramtype = 'light',
   selection_box = {
      type = 'fixed',
      fixed = {-.5, -.5, -.5, .5, .2, .5},
      },
   collision_box = {
      type = 'fixed',
      fixed = {-.5, -.5, -.5, .5, .2, .5},
      },
   groups = {oddly_breakable_by_hand = 1, choppy=3},
   after_place_node = function(pos)
      local meta = minetest.get_meta(pos)
      meta:set_string('infotext', 'Crystal Workshop (locked)')
   end,
}
for k, v in pairs(crystal_w_table_locked_functions) do
   crystal_w_table_locked_def[k] = v
end

minetest.register_node('stations:crystal_workshop_locked', crystal_w_table_locked_def)

local is_uninv = minetest.global_exists("unified_inventory") or false
if is_uninv then
   unified_inventory.register_craft_type("crystal_w", {
      description = "Crystal Workshop",
      icon = 'stations_crystal_icon.png',
      width = 4,
      height = 2,
      uses_crafting_grid = false
   })
end
