2020-02-18 20:34:52 +03:00
|
|
|
local S = minetest.get_translator("pipeworks")
|
2014-07-15 03:52:33 +04:00
|
|
|
minetest.register_node("pipeworks:trashcan", {
|
2021-02-05 19:17:50 +03:00
|
|
|
description = S("Trash Can"),
|
|
|
|
drawtype = "normal",
|
2014-07-15 03:52:33 +04: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 19:17:50 +03:00
|
|
|
},
|
2022-03-15 04:39:58 +03:00
|
|
|
groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1, dig_generic = 4},
|
2014-07-15 03:52:33 +04:00
|
|
|
tube = {
|
|
|
|
insert_object = function(pos, node, stack, direction)
|
|
|
|
return ItemStack("")
|
2014-08-14 18:22:03 +04: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 19:17:50 +03:00
|
|
|
},
|
2014-07-15 03:52:33 +04:00
|
|
|
on_construct = function(pos)
|
|
|
|
local meta = minetest.get_meta(pos)
|
2022-04-16 21:51:59 +03:00
|
|
|
local size = "10.2,9"
|
|
|
|
local list_background = ""
|
|
|
|
if minetest.get_modpath("i3") then
|
|
|
|
list_background = "style_type[box;colors=#666]box[4.5,2;1,1;]"
|
|
|
|
end
|
2014-07-15 03:52:33 +04:00
|
|
|
meta:set_string("formspec",
|
2022-04-16 21:51:59 +03:00
|
|
|
"formspec_version[2]" ..
|
|
|
|
"size["..size.."]"..
|
|
|
|
pipeworks.fs_helpers.get_prepends(size) ..
|
|
|
|
"item_image[0.5,0.5;1,1;pipeworks:trashcan]"..
|
|
|
|
"label[1.5,1;"..S("Trash Can").."]"..
|
|
|
|
list_background..
|
|
|
|
"list[context;trash;4.5,2;1,1;]"..
|
|
|
|
--"list[current_player;main;0,3;8,4;]" ..
|
|
|
|
pipeworks.fs_helpers.get_inv(4)..
|
|
|
|
"listring[context;trash]"..
|
|
|
|
"listring[current_player;main]"
|
|
|
|
)
|
2020-02-18 20:34:52 +03:00
|
|
|
meta:set_string("infotext", S("Trash Can"))
|
2014-07-15 03:52:33 +04:00
|
|
|
meta:get_inventory():set_size("trash", 1)
|
2021-02-05 19:17:50 +03:00
|
|
|
end,
|
2015-02-07 10:45:17 +03:00
|
|
|
after_place_node = pipeworks.after_place,
|
|
|
|
after_dig_node = pipeworks.after_dig,
|
2014-07-15 03:52:33 +04: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 22:48:28 +03:00
|
|
|
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:trashcan"
|