forked from SmallJoker/exchange_shop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipes.lua
38 lines (36 loc) · 1.14 KB
/
pipes.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
if minetest.get_modpath("pipeworks") then
minetest.override_item(exchange_shop.shopname, {
groups = {choppy=2, oddly_breakable_by_hand=2,
tubedevice=1, tubedevice_receiver=1},
tube = {
insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:add_item("stock", stack)
end,
can_insert = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:room_for_item("stock", stack)
end,
input_inventory = "custm",
connect_sides = {left=1, right=1, back=1, top=1, bottom=1}
}
})
end
if minetest.get_modpath("tubelib") then
tubelib.register_node(exchange_shop.shopname, {}, {
on_pull_item = function(pos, side)
local meta = minetest.get_meta(pos)
return tubelib.get_item(meta, "custm")
end,
on_push_item = function(pos, side, item)
local meta = minetest.get_meta(pos)
return tubelib.put_item(meta, "stock", item)
end,
on_unpull_item = function(pos, side, item)
local meta = minetest.get_meta(pos)
return tubelib.put_item(meta, "stock", item)
end,
})
end