Properly create metadata inventories in minimal
authorPerttu Ahola <celeron55@gmail.com>
Fri, 1 Jun 2012 16:51:24 +0000 (19:51 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 3 Jun 2012 19:31:00 +0000 (22:31 +0300)
games/minimal/mods/default/init.lua

index ed16e6a3702c1b15881bc600e075fd424e2cbe7a..9573db11990eaa9d4b41de37da637f809425f84a 100644 (file)
@@ -1129,13 +1129,14 @@ minetest.register_node("default:chest", {
        legacy_facedir_simple = true,
        sounds = default.node_sound_wood_defaults(),
        on_construct = function(pos)
-               --local n = minetest.env:get_node(pos)
                local meta = minetest.env:get_meta(pos)
                meta:set_string("formspec",
                                "invsize[8,9;]"..
-                               "list[current_name;0;0,0;8,4;]"..
+                               "list[current_name;main;0,0;8,4;]"..
                                "list[current_player;main;0,5;8,4;]")
                meta:set_string("infotext", "Chest");
+               local inv = meta:get_inventory()
+               inv:set_size("main", 8*4)
        end,
 })
 
@@ -1148,13 +1149,14 @@ minetest.register_node("default:chest_locked", {
        legacy_facedir_simple = true,
        sounds = default.node_sound_wood_defaults(),
        on_construct = function(pos)
-               --local n = minetest.env:get_node(pos)
                local meta = minetest.env:get_meta(pos)
                meta:set_string("formspec",
                                "invsize[8,9;]"..
-                               "list[current_name;0;0,0;8,4;]"..
+                               "list[current_name;main;0,0;8,4;]"..
                                "list[current_player;main;0,5;8,4;]")
                meta:set_string("infotext", "Locked Chest");
+               local inv = meta:get_inventory()
+               inv:set_size("main", 8*4)
        end,
 })
 
@@ -1175,6 +1177,10 @@ minetest.register_node("default:furnace", {
                        "list[current_name;dst;5,1;2,2;]"..
                        "list[current_player;main;0,5;8,4;]")
                meta:set_string("infotext", "Furnace");
+               local inv = meta:get_inventory()
+               inv:set_size("fuel", 1)
+               inv:set_size("src", 1)
+               inv:set_size("dst", 4)
        end,
 })