2020-02-18 18:34:52 +01:00
|
|
|
local S = minetest.get_translator("pipeworks")
|
2014-07-15 01:52:33 +02:00
|
|
|
minetest.register_node("pipeworks:trashcan", {
|
2021-02-05 17:17:50 +01:00
|
|
|
description = S("Trash Can"),
|
|
|
|
drawtype = "normal",
|
2014-07-15 01:52:33 +02:00
|
|
|
tiles = {
|
|
|
|
"pipeworks_trashcan_bottom.png",
|
|
|
|
"pipeworks_trashcan_bottom.png",
|
|
|
|
"pipeworks_trashcan_side.png",
|
|
|
|
"pipeworks_trashcan_side.png",
|
|
|
|
"pipeworks_trashcan_side.png",
|
|
|
|
"pipeworks_trashcan_side.png",
|
2021-02-05 17:17:50 +01:00
|
|
|
},
|
2022-03-15 02:39:58 +01:00
|
|
|
groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1, dig_generic = 4},
|
2014-07-15 01:52:33 +02:00
|
|
|
tube = {
|
|
|
|
insert_object = function(pos, node, stack, direction)
|
|
|
|
return ItemStack("")
|
2014-08-14 16:22:03 +02:00
|
|
|
end,
|
|
|
|
connect_sides = {left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1},
|
|
|
|
priority = 1, -- Lower than anything else
|
2021-02-05 17:17:50 +01:00
|
|
|
},
|
2014-07-15 01:52:33 +02:00
|
|
|
on_construct = function(pos)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_string("formspec",
|
|
|
|
"size[8,7]"..
|
|
|
|
"item_image[0,0;1,1;pipeworks:trashcan]"..
|
2020-02-18 18:34:52 +01:00
|
|
|
"label[1,0;"..S("Trash Can").."]"..
|
2015-01-29 20:08:34 +01:00
|
|
|
"list[context;trash;3.5,1;1,1;]"..
|
2016-08-29 18:28:43 +02:00
|
|
|
"list[current_player;main;0,3;8,4;]" ..
|
|
|
|
"listring[]")
|
2020-02-18 18:34:52 +01:00
|
|
|
meta:set_string("infotext", S("Trash Can"))
|
2014-07-15 01:52:33 +02:00
|
|
|
meta:get_inventory():set_size("trash", 1)
|
2021-02-05 17:17:50 +01:00
|
|
|
end,
|
2015-02-07 08:45:17 +01:00
|
|
|
after_place_node = pipeworks.after_place,
|
|
|
|
after_dig_node = pipeworks.after_dig,
|
2014-07-15 01:52:33 +02:00
|
|
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
|
|
|
minetest.get_meta(pos):get_inventory():set_stack(listname, index, ItemStack(""))
|
|
|
|
end,
|
|
|
|
})
|
2021-04-02 21:48:28 +02:00
|
|
|
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:trashcan"
|