RealBadAngel
2013-02-01 061e6bbadc89a4e4be2818a691436f8144327cf1
commit | author | age
82cba9 1 minetest.register_craft({
R 2     output = 'technic:iron_chest 1',
3     recipe = {
4         {'default:steel_ingot','default:steel_ingot','default:steel_ingot'},
5         {'default:steel_ingot','default:chest','default:steel_ingot'},
6         {'default:steel_ingot','default:steel_ingot','default:steel_ingot'},
7     }
8 })
9
10 minetest.register_craft({
11     output = 'technic:iron_locked_chest 1',
12     recipe = {
13         {'default:steel_ingot','default:steel_ingot','default:steel_ingot'},
14         {'default:steel_ingot','default:chest_locked','default:steel_ingot'},
15         {'default:steel_ingot','default:steel_ingot','default:steel_ingot'},
16     }
17 })
18
19 minetest.register_craft({
20     output = 'technic:iron_locked_chest 1',
21     recipe = {
22         {'default:steel_ingot'},
23         {'technic:iron_chest'},
24     }
25 })
26
27
28 minetest.register_craftitem("technic:iron_chest", {
29     description = "Iron Chest",
30     stack_max = 99,
31 })
32 minetest.register_craftitem("technic:iron_locked_chest", {
33     description = "Iron Locked Chest",
34     stack_max = 99,
35 })
36
37 minetest.register_alias("blabla", "technic:iron_chest")
38
39 minetest.register_node("technic:iron_chest", {
40     description = "Iron Chest",
41     tiles = {"technic_iron_chest_top.png", "technic_iron_chest_top.png", "technic_iron_chest_side.png",
42         "technic_iron_chest_side.png", "technic_iron_chest_side.png", "technic_iron_chest_front.png"},
43     paramtype2 = "facedir",
44     groups = chest_groups1,
45     tube = tubes_properties,
46     legacy_facedir_simple = true,
47     sounds = default.node_sound_wood_defaults(),
48     on_construct = function(pos)
49         local meta = minetest.env:get_meta(pos)
50         meta:set_string("formspec",
51                 "invsize[9,9;]"..
52                 "list[current_name;main;0,0;9,4;]"..
53                 "list[current_player;main;0,5;8,4;]")
54         meta:set_string("infotext", "Iron Chest")
55         local inv = meta:get_inventory()
56         inv:set_size("main", 9*4)
57     end,
58     can_dig = chest_can_dig,
59     on_metadata_inventory_move = def_on_metadata_inventory_move,
60     on_metadata_inventory_put = def_on_metadata_inventory_put,
61     on_metadata_inventory_take = def_on_metadata_inventory_take 
62 })
63
64 minetest.register_node("technic:iron_locked_chest", {
65     description = "Iron Locked Chest",
66     tiles = {"technic_iron_chest_top.png", "technic_iron_chest_top.png", "technic_iron_chest_side.png",
67         "technic_iron_chest_side.png", "technic_iron_chest_side.png", "technic_iron_chest_locked.png"},
68     paramtype2 = "facedir",
69     groups = chest_groups1,
70     tube = tubes_properties,
71     legacy_facedir_simple = true,
72     sounds = default.node_sound_wood_defaults(),
73     after_place_node = function(pos, placer)
74         local meta = minetest.env:get_meta(pos)
75         meta:set_string("owner", placer:get_player_name() or "")
76         meta:set_string("infotext", "Locked Iron Chest (owned by "..
77                 meta:get_string("owner")..")")
78     end,
79     on_construct = function(pos)
80         local meta = minetest.env:get_meta(pos)
81         meta:set_string("formspec",
82                 "invsize[9,9;]"..
83                 "list[current_name;main;0,0;9,4;]"..
84                 "list[current_player;main;0,5;8,4;]")
85         meta:set_string("infotext", "Iron Locked Chest")
86         meta:set_string("owner", "")
87         local inv = meta:get_inventory()
88         inv:set_size("main", 9*4)
89     end,
90     can_dig = chest_can_dig,
91     allow_metadata_inventory_move = def_allow_metadata_inventory_move,
92     allow_metadata_inventory_put = def_allow_metadata_inventory_put,
93     allow_metadata_inventory_take = def_allow_metadata_inventory_take,
94     on_metadata_inventory_move = def_on_metadata_inventory_move,
95     on_metadata_inventory_put = def_on_metadata_inventory_put,
96     on_metadata_inventory_take = def_on_metadata_inventory_take 
97 })