commit | author | age
|
78cacd
|
1 |
technic.chests.groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, |
d4609f
|
2 |
tubedevice=1, tubedevice_receiver=1, technic_chest=1} |
78cacd
|
3 |
technic.chests.groups_noinv = {snappy=2, choppy=2, oddly_breakable_by_hand=2, |
d4609f
|
4 |
tubedevice=1, tubedevice_receiver=1, not_in_creative_inventory=1, technic_chest=1} |
78cacd
|
5 |
|
S |
6 |
technic.chests.tube = { |
|
7 |
insert_object = function(pos, node, stack, direction) |
|
8 |
local meta = minetest.get_meta(pos) |
|
9 |
local inv = meta:get_inventory() |
|
10 |
return inv:add_item("main",stack) |
|
11 |
end, |
|
12 |
can_insert = function(pos, node, stack, direction) |
|
13 |
local meta = minetest.get_meta(pos) |
|
14 |
local inv = meta:get_inventory() |
11f20d
|
15 |
if meta:get_int("splitstacks") == 1 then |
VE |
16 |
stack = stack:peek_item(1) |
|
17 |
end |
|
18 |
return inv:room_for_item("main",stack) |
78cacd
|
19 |
end, |
S |
20 |
input_inventory = "main", |
|
21 |
connect_sides = {left=1, right=1, front=1, back=1, top=1, bottom=1}, |
|
22 |
} |
|
23 |
|
|
24 |
technic.chests.can_dig = function(pos, player) |
|
25 |
local meta = minetest.get_meta(pos) |
|
26 |
local inv = meta:get_inventory() |
|
27 |
return inv:is_empty("main") |
|
28 |
end |
|
29 |
|
|
30 |
local function inv_change(pos, count, player) |
666471
|
31 |
-- Skip check for pipeworks (fake player) |
S |
32 |
if minetest.is_player(player) and |
|
33 |
not default.can_interact_with_node(player, pos) then |
78cacd
|
34 |
return 0 |
S |
35 |
end |
|
36 |
return count |
|
37 |
end |
|
38 |
|
|
39 |
function technic.chests.inv_move(pos, from_list, from_index, to_list, to_index, count, player) |
|
40 |
return inv_change(pos, count, player) |
|
41 |
end |
|
42 |
function technic.chests.inv_put(pos, listname, index, stack, player) |
0d32e0
|
43 |
return inv_change(pos, stack:get_count(), player) |
78cacd
|
44 |
end |
S |
45 |
function technic.chests.inv_take(pos, listname, index, stack, player) |
0d32e0
|
46 |
return inv_change(pos, stack:get_count(), player) |
78cacd
|
47 |
end |
S |
48 |
|
|
49 |
function technic.chests.on_inv_move(pos, from_list, from_index, to_list, to_index, count, player) |
|
50 |
minetest.log("action", player:get_player_name().. |
e10335
|
51 |
" moves stuff in chest at " |
78cacd
|
52 |
..minetest.pos_to_string(pos)) |
S |
53 |
end |
|
54 |
|
|
55 |
function technic.chests.on_inv_put(pos, listname, index, stack, player) |
ec6354
|
56 |
minetest.log("action", player:get_player_name() .. |
T |
57 |
" moves " .. stack:get_name() .. |
|
58 |
" to chest at " .. minetest.pos_to_string(pos)) |
78cacd
|
59 |
end |
S |
60 |
|
|
61 |
function technic.chests.on_inv_take(pos, listname, index, stack, player) |
ec6354
|
62 |
minetest.log("action", player:get_player_name() .. |
T |
63 |
" takes " .. stack:get_name() .. |
|
64 |
" from chest at " .. minetest.pos_to_string(pos)) |
78cacd
|
65 |
end |
S |
66 |
|