Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2012
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. -- This file supplies a refrigerator
  2.  
  3. minetest.register_node('homedecor:refrigerator', {
  4. drawtype = "nodebox",
  5. description = "Refrigerator",
  6. tiles = {
  7. 'homedecor_refrigerator_top.png',
  8. 'homedecor_refrigerator_bottom.png',
  9. 'homedecor_refrigerator_right.png',
  10. 'homedecor_refrigerator_left.png',
  11. 'homedecor_refrigerator_back.png',
  12. 'homedecor_refrigerator_front.png'
  13. },
  14. inventory_image = "homedecor_refrigerator_inv.png",
  15. sunlight_propagates = false,
  16. paramtype = "light",
  17. paramtype2 = "facedir",
  18. walkable = true,
  19. groups = { snappy = 3 },
  20.  
  21. selection_box = {
  22. type = "fixed",
  23. fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 }
  24. },
  25. node_box = {
  26. type = "fixed",
  27. fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 }
  28. },
  29.  
  30. sounds = default.node_sound_leaves_defaults(),
  31. on_construct = function(pos)
  32. local meta = minetest.env:get_meta(pos)
  33. meta:set_string("formspec",
  34. "size[10,10]"..
  35. "list[current_name;main;0,0;10,5;]"..
  36. "list[current_player;main;1,6;8,4;]")
  37. meta:set_string("infotext", "Refrigerator")
  38. local inv = meta:get_inventory()
  39. inv:set_size("main",50)
  40. end,
  41.  
  42. after_place_node = function(pos, placer)
  43. whoplacedit = placer:get_player_name()
  44. print(whoplacedit)
  45. node = minetest.env:get_node(pos)
  46. ntop = minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z})
  47. if ntop.name ~= "air" then
  48. minetest.node_dig(pos, node, whoplacedit)
  49. end
  50. end,
  51.  
  52. can_dig = function(pos,player)
  53. local meta = minetest.env:get_meta(pos);
  54. local inv = meta:get_inventory()
  55. return inv:is_empty("main")
  56. end,
  57. on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
  58. minetest.log("action", player:get_player_name()..
  59. " moves stuff in refrigerator at "..minetest.pos_to_string(pos))
  60. end,
  61. on_metadata_inventory_put = function(pos, listname, index, stack, player)
  62. minetest.log("action", player:get_player_name()..
  63. " moves stuff to refrigerator at "..minetest.pos_to_string(pos))
  64. end,
  65. on_metadata_inventory_take = function(pos, listname, index, stack, player)
  66. minetest.log("action", player:get_player_name()..
  67. " takes stuff from refrigerator at "..minetest.pos_to_string(pos))
  68. end,
  69. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement