metalstache
2013-08-04 d5c55415014e53ba0eaeb48729ec7a2b27ff8a3b
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
fd3f25 28 minetest.register_craftitem(":technic:iron_chest", {
82cba9 29     description = "Iron Chest",
R 30     stack_max = 99,
31 })
fd3f25 32 minetest.register_craftitem(":technic:iron_locked_chest", {
82cba9 33     description = "Iron Locked Chest",
R 34     stack_max = 99,
35 })
36
fd3f25 37 minetest.register_node(":technic:iron_chest", {
82cba9 38     description = "Iron Chest",
R 39     tiles = {"technic_iron_chest_top.png", "technic_iron_chest_top.png", "technic_iron_chest_side.png",
40         "technic_iron_chest_side.png", "technic_iron_chest_side.png", "technic_iron_chest_front.png"},
41     paramtype2 = "facedir",
42     groups = chest_groups1,
43     tube = tubes_properties,
44     legacy_facedir_simple = true,
45     sounds = default.node_sound_wood_defaults(),
46     on_construct = function(pos)
47         local meta = minetest.env:get_meta(pos)
48         meta:set_string("formspec",
3a3700 49                 "invsize[9,10;]"..
R 50                 "label[0,0;Iron Chest]"..
51                 "list[current_name;main;0,1;9,4;]"..
52                 "list[current_player;main;0,6;8,4;]"..
53                 "background[-0.19,-0.25;9.4,10.75;ui_form_bg.png]"..
54                 "background[0,1;9,4;ui_iron_chest_inventory.png]"..
55                 "background[0,6;8,4;ui_main_inventory.png]")
82cba9 56         meta:set_string("infotext", "Iron Chest")
R 57         local inv = meta:get_inventory()
58         inv:set_size("main", 9*4)
59     end,
60     can_dig = chest_can_dig,
61     on_metadata_inventory_move = def_on_metadata_inventory_move,
62     on_metadata_inventory_put = def_on_metadata_inventory_put,
63     on_metadata_inventory_take = def_on_metadata_inventory_take 
64 })
65
fd3f25 66 minetest.register_node(":technic:iron_locked_chest", {
82cba9 67     description = "Iron Locked Chest",
R 68     tiles = {"technic_iron_chest_top.png", "technic_iron_chest_top.png", "technic_iron_chest_side.png",
69         "technic_iron_chest_side.png", "technic_iron_chest_side.png", "technic_iron_chest_locked.png"},
70     paramtype2 = "facedir",
71     groups = chest_groups1,
72     tube = tubes_properties,
73     legacy_facedir_simple = true,
74     sounds = default.node_sound_wood_defaults(),
75     after_place_node = function(pos, placer)
76         local meta = minetest.env:get_meta(pos)
77         meta:set_string("owner", placer:get_player_name() or "")
78         meta:set_string("infotext", "Locked Iron Chest (owned by "..
3a3700 79         meta:get_string("owner")..")")
82cba9 80     end,
R 81     on_construct = function(pos)
82         local meta = minetest.env:get_meta(pos)
83         meta:set_string("formspec",
3a3700 84                 "invsize[9,10;]"..
R 85                 "label[0,0;Iron Locked Chest]"..
86                 "list[current_name;main;0,1;9,4;]"..
87                 "list[current_player;main;0,6;8,4;]"..
88                 "background[-0.19,-0.25;9.4,10.75;ui_form_bg.png]"..
89                 "background[0,1;9,4;ui_iron_chest_inventory.png]"..
90                 "background[0,6;8,4;ui_main_inventory.png]")
82cba9 91         meta:set_string("infotext", "Iron Locked Chest")
R 92         meta:set_string("owner", "")
93         local inv = meta:get_inventory()
94         inv:set_size("main", 9*4)
95     end,
96     can_dig = chest_can_dig,
97     allow_metadata_inventory_move = def_allow_metadata_inventory_move,
98     allow_metadata_inventory_put = def_allow_metadata_inventory_put,
99     allow_metadata_inventory_take = def_allow_metadata_inventory_take,
100     on_metadata_inventory_move = def_on_metadata_inventory_move,
101     on_metadata_inventory_put = def_on_metadata_inventory_put,
102     on_metadata_inventory_take = def_on_metadata_inventory_take 
103 })