init.lua 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. minetest.register_node("spectrumchest:spectrumchest", {
  2. description = "Spectrum Chest",
  3. tiles = {"spectrum_top.png", "spectrum_top.png", "spectrum_side.png",
  4. "spectrum_side.png", "spectrum_side.png", "spectrum_front.png"},
  5. paramtype2 = "facedir",
  6. groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,},
  7. legacy_facedir_simple = true,
  8. sounds = default.node_sound_wood_defaults(),
  9. on_construct = function(pos)
  10. local meta = minetest.get_meta(pos)
  11. meta:set_string("formspec",
  12. "size[8,9]"..
  13. default.gui_bg ..
  14. default.gui_bg_img ..
  15. default.gui_slots ..
  16. "list[current_player;spectrumchest:spectrumchest;0,0.3;8,4;]"..
  17. "list[current_player;main;0,4.85;8,1;]" ..
  18. "list[current_player;main;0,6.08;8,3;8]" ..
  19. "listring[current_player;spectrumchest:spectrumchest]" ..
  20. "listring[current_player;main]" ..
  21. default.get_hotbar_bg(0,4.85))
  22. meta:set_string("infotext", "Spectrum Chest")
  23. end,
  24. on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
  25. minetest.log("action", player:get_player_name()..
  26. " moves stuff in Spectrum chest at "..minetest.pos_to_string(pos))
  27. end,
  28. on_metadata_inventory_put = function(pos, listname, index, stack, player)
  29. minetest.log("action", player:get_player_name()..
  30. " moves stuff to Spectrum chest at "..minetest.pos_to_string(pos))
  31. end,
  32. on_metadata_inventory_take = function(pos, listname, index, stack, player)
  33. minetest.log("action", player:get_player_name()..
  34. " takes stuff from Spectrum chest at "..minetest.pos_to_string(pos))
  35. end,
  36. })
  37. minetest.register_craft({
  38. output = 'spectrumchest:spectrumchest',
  39. recipe = {
  40. {'default:gold_ingot','spectrum:spectrum_orb','default:gold_ingot'},
  41. {'spectrum:spectrum_orb','default:chest','spectrum:spectrum_orb'},
  42. {'default:gold_ingot','spectrum:spectrum_orb','default:gold_ingot'}
  43. }
  44. })
  45. minetest.register_on_joinplayer(function(player)
  46. local inv = player:get_inventory()
  47. inv:set_size("spectrumchest:spectrumchest", 8*4)
  48. end)