Pipeworks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

52 lines
1.7 KiB

  1. local S = minetest.get_translator("pipeworks")
  2. minetest.register_node("pipeworks:trashcan", {
  3. description = S("Trash Can"),
  4. drawtype = "normal",
  5. tiles = {
  6. "pipeworks_trashcan_bottom.png",
  7. "pipeworks_trashcan_bottom.png",
  8. "pipeworks_trashcan_side.png",
  9. "pipeworks_trashcan_side.png",
  10. "pipeworks_trashcan_side.png",
  11. "pipeworks_trashcan_side.png",
  12. },
  13. groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1},
  14. tube = {
  15. insert_object = function(pos, node, stack, direction)
  16. return ItemStack("")
  17. end,
  18. connect_sides = {left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1},
  19. priority = 1, -- Lower than anything else
  20. },
  21. on_construct = function(pos)
  22. local meta = minetest.get_meta(pos)
  23. meta:set_string("formspec",
  24. "size[8,7]"..
  25. "item_image[0,0;1,1;pipeworks:trashcan]"..
  26. "label[1,0;"..S("Trash Can").."]"..
  27. "list[context;trash;3.5,1;1,1;]"..
  28. default.gui_bg..
  29. default.gui_bg_img..
  30. default.gui_slots..
  31. default.get_hotbar_bg(0,3) ..
  32. "list[current_player;main;0,3;8,4;]" ..
  33. "listring[]")
  34. meta:set_string("infotext", S("Trash Can"))
  35. meta:get_inventory():set_size("trash", 1)
  36. end,
  37. after_place_node = pipeworks.after_place,
  38. after_dig_node = pipeworks.after_dig,
  39. on_metadata_inventory_put = function(pos, listname, index, stack, player)
  40. minetest.get_meta(pos):get_inventory():set_stack(listname, index, ItemStack(""))
  41. end,
  42. })
  43. minetest.register_craft({
  44. output = "pipeworks:trashcan",
  45. recipe = {
  46. { "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
  47. { "default:steel_ingot", "", "default:steel_ingot" },
  48. { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
  49. },
  50. })