Skip to content

Commit 3f2e35e

Browse files
kilbithBlockMen
authored andcommittedMar 29, 2015
Add vessels shelf
1 parent ccb4b92 commit 3f2e35e

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
 

Diff for: ‎mods/vessels/init.lua

+81
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,87 @@
11
-- Minetest 0.4 mod: vessels
22
-- See README.txt for licensing and other information.
33

4+
local vessels_shelf_formspec =
5+
"size[8,7;]"..
6+
default.gui_bg..
7+
default.gui_bg_img..
8+
default.gui_slots..
9+
"list[context;vessels;0,0.3;8,2;]"..
10+
"list[current_player;main;0,2.85;8,1;]"..
11+
"list[current_player;main;0,4.08;8,3;8]"..
12+
default.get_hotbar_bg(0,2.85)
13+
14+
minetest.register_node("vessels:shelf", {
15+
description = "Vessels shelf",
16+
tiles = {"default_wood.png", "default_wood.png", "default_wood.png^vessels_shelf.png"},
17+
is_ground_content = false,
18+
groups = {choppy=3,oddly_breakable_by_hand=2,flammable=3},
19+
sounds = default.node_sound_wood_defaults(),
20+
21+
on_construct = function(pos)
22+
local meta = minetest.get_meta(pos)
23+
meta:set_string("formspec", vessels_shelf_formspec)
24+
local inv = meta:get_inventory()
25+
inv:set_size("vessels", 8*2)
26+
end,
27+
can_dig = function(pos,player)
28+
local meta = minetest.get_meta(pos);
29+
local inv = meta:get_inventory()
30+
return inv:is_empty("vessels")
31+
end,
32+
33+
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
34+
local meta = minetest.get_meta(pos)
35+
local inv = meta:get_inventory()
36+
local to_stack = inv:get_stack(listname, index)
37+
if listname == "vessels" then
38+
if minetest.get_item_group(stack:get_name(), "vessel") ~= 0
39+
and to_stack:is_empty() then
40+
return 1
41+
else
42+
return 0
43+
end
44+
end
45+
end,
46+
47+
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
48+
local meta = minetest.get_meta(pos)
49+
local inv = meta:get_inventory()
50+
local stack = inv:get_stack(from_list, from_index)
51+
local to_stack = inv:get_stack(to_list, to_index)
52+
if to_list == "vessels" then
53+
if minetest.get_item_group(stack:get_name(), "vessel") ~= 0
54+
and to_stack:is_empty() then
55+
return 1
56+
else
57+
return 0
58+
end
59+
end
60+
end,
61+
62+
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
63+
minetest.log("action", player:get_player_name()..
64+
" moves stuff in vessels shelf at "..minetest.pos_to_string(pos))
65+
end,
66+
on_metadata_inventory_put = function(pos, listname, index, stack, player)
67+
minetest.log("action", player:get_player_name()..
68+
" moves stuff to vessels shelf at "..minetest.pos_to_string(pos))
69+
end,
70+
on_metadata_inventory_take = function(pos, listname, index, stack, player)
71+
minetest.log("action", player:get_player_name()..
72+
" takes stuff from vessels shelf at "..minetest.pos_to_string(pos))
73+
end,
74+
})
75+
76+
minetest.register_craft({
77+
output = 'vessels:shelf',
78+
recipe = {
79+
{'group:wood', 'group:wood', 'group:wood'},
80+
{'group:vessel', 'group:vessel', 'group:vessel'},
81+
{'group:wood', 'group:wood', 'group:wood'},
82+
}
83+
})
84+
485
minetest.register_node("vessels:glass_bottle", {
586
description = "Glass Bottle (empty)",
687
drawtype = "plantlike",

Diff for: ‎mods/vessels/textures/vessels_shelf.png

354 Bytes
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.