-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
93 lines (83 loc) · 2.25 KB
/
init.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
--Crate
minetest.register_craft({
output = 'crates_and_barrels:crate',
recipe = {
{'','group:wood','group:wood'},
{'','group:wood','group:wood'},
}
})
minetest.register_node("crates_and_barrels:crate", {
description = "Wood Crate",
paramtype2 = "facedir",
place_param2 = 0,
tiles = {"crates_and_barrels_crate.png"},
is_ground_content = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[8,9]" ..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[context;contents;2,0.5;4,4;]" ..
"list[current_player;main;0,5;8,4;]")
local inv = meta:get_inventory()
inv:set_size('contents', 16)
end,
on_blast = function(pos)
local drops = {}
default.get_inventory_drops(pos, "contents", drops)
drops[#drops+1] = "crates_and_barrels:crate"
minetest.remove_node(pos)
return drops
end,
})
--Barrel
minetest.register_craft({
output = 'crates_and_barrels:barrel',
recipe = {
{'','group:wood',''},
{'','group:wood',''},
}
})
minetest.register_node("crates_and_barrels:barrel", {
description = "Barrel",
drawtype = "mesh",
mesh = "crates_and_barrels_barrel.b3d",
visual_scale = 0.05,
wield_scale = {x = 0.06, y = 0.06, z = 0.06},
paramtype2 = "facedir",
tiles = {"crates_and_barrels_barrel.png"},
is_ground_content = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
sounds = default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = {-0.4, -0.5, -0.4, 0.4, 0.5, 0.4},
},
selection_box = {
type = "fixed",
fixed = {-0.4, -0.5, -0.4, 0.4, 0.5, 0.4},
},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[8,9]" ..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[context;contents;2.5,0.8;3,3;]" ..
"list[current_player;main;0,5;8,4;]")
local inv = meta:get_inventory()
inv:set_size('contents', 9)
end,
on_blast = function(pos)
local drops = {}
default.get_inventory_drops(pos, "contents", drops)
drops[#drops+1] = "crates_and_barrels:crate"
minetest.remove_node(pos)
return drops
end,
})