From aee9f7e6d682e91a20958d16c192baa6dce6c2e4 Mon Sep 17 00:00:00 2001 From: Zefram Date: Tue, 15 Jul 2014 00:52:33 +0100 Subject: [PATCH] Add trash can The trash can can be used either manually (via form) or at the end of a pipe. It destroys whatever is placed in it. --- init.lua | 1 + textures/pipeworks_trashcan_bottom.png | Bin 0 -> 186 bytes textures/pipeworks_trashcan_side.png | Bin 0 -> 100 bytes trashcan.lua | 51 +++++++++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 textures/pipeworks_trashcan_bottom.png create mode 100644 textures/pipeworks_trashcan_side.png create mode 100644 trashcan.lua diff --git a/init.lua b/init.lua index acf867e..8a6da60 100644 --- a/init.lua +++ b/init.lua @@ -113,6 +113,7 @@ dofile(pipeworks.modpath.."/item_transport.lua") dofile(pipeworks.modpath.."/flowing_logic.lua") dofile(pipeworks.modpath.."/crafts.lua") dofile(pipeworks.modpath.."/tubes.lua") +dofile(pipeworks.modpath.."/trashcan.lua") if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end diff --git a/textures/pipeworks_trashcan_bottom.png b/textures/pipeworks_trashcan_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..a50c7892d6e61aeeb8c33a178fca308893483a33 GIT binary patch literal 186 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jh-%!Ar`&Kb4+VL)w5|_xN6>F zD5)23bH0J6;H05p07n3i!*)?=hw#HoR_AwIf4Rft@E1cxZUyEPJ3Gr`kB|5LNngOQ z;Q@DU4udieho*vx``wI`gahwcbBaXRmE4@1zNstPbuqpWdLdPKa-vA@u3v2hXANd? i#xg24tZRFe!NTyi%-j6pTSbs#7(8A5T-G@yGywoJ0zhd1 literal 0 HcmV?d00001 diff --git a/textures/pipeworks_trashcan_side.png b/textures/pipeworks_trashcan_side.png new file mode 100644 index 0000000000000000000000000000000000000000..7b081bfa2e05fa8408aa666cfae54fdf1ba21b59 GIT binary patch literal 100 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`+MX_sAr`&Kb4+VL)w5|_xN6>F xD5)23bH0J6;H05p0EZi|glWQ+hJ#5A3}1e7JbuOKG8d?g!PC{xWt~$(69B@B9IgNW literal 0 HcmV?d00001 diff --git a/trashcan.lua b/trashcan.lua new file mode 100644 index 0000000..880ab59 --- /dev/null +++ b/trashcan.lua @@ -0,0 +1,51 @@ +minetest.register_node("pipeworks:trashcan", { + description = "Trash Can", + drawtype = "normal", + 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", + }, + groups = { snappy = 3, tubedevice = 1, tubedevice_receiver = 1 }, + tube = { + insert_object = function(pos, node, stack, direction) + return ItemStack("") + end, + can_insert = function(pos, node, stack, direction) + return true + end, + connect_sides = { left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1 }, + }, + 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]".. + "label[1,0;Trash Can]".. + "list[current_name;trash;3.5,1;1,1;]".. + "list[current_player;main;0,3;8,4;]") + meta:set_string("infotext", "Trash Can") + meta:get_inventory():set_size("trash", 1) + end, + after_place_node = function(pos) + pipeworks.scan_for_tube_objects(pos) + end, + after_dig_node = function(pos) + pipeworks.scan_for_tube_objects(pos) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.get_meta(pos):get_inventory():set_stack(listname, index, ItemStack("")) + end, +}) + +minetest.register_craft({ + output = "pipeworks:trashcan", + recipe = { + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + { "default:steel_ingot", "", "default:steel_ingot" }, + { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }, + }, +}) -- 2.30.2