1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2024-11-17 15:58:29 +01:00
pipeworks/trashcan.lua
wsor4035 5aa0501872
make pipeworks Game agnostic (#16)
* make it boot in non mtg

* make water flow

* fix water texture warnings

* fix missing steel texture issues

* remove depreciated/unnessary default function calls

* make sounds work

* fix default formspec crashes

* fix wierd tab spacing

* additionally game dig group support

* move crafts to crafts.lua

* make crafts support various games
2022-03-14 21:39:58 -04:00

40 lines
1.4 KiB
Lua

local S = minetest.get_translator("pipeworks")
minetest.register_node("pipeworks:trashcan", {
description = S("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, dig_generic = 4},
tube = {
insert_object = function(pos, node, stack, direction)
return ItemStack("")
end,
connect_sides = {left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1},
priority = 1, -- Lower than anything else
},
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;"..S("Trash Can").."]"..
"list[context;trash;3.5,1;1,1;]"..
"list[current_player;main;0,3;8,4;]" ..
"listring[]")
meta:set_string("infotext", S("Trash Can"))
meta:get_inventory():set_size("trash", 1)
end,
after_place_node = pipeworks.after_place,
after_dig_node = pipeworks.after_dig,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.get_meta(pos):get_inventory():set_stack(listname, index, ItemStack(""))
end,
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:trashcan"