Add fancy inventory for bookshelves
authorSfan5 <sfan5@live.de>
Tue, 15 Apr 2014 19:04:34 +0000 (21:04 +0200)
committerBlockMen <nmuelll@web.de>
Sat, 5 Jul 2014 13:57:55 +0000 (15:57 +0200)
mods/default/nodes.lua

index 89fc74b179b6ac594a0481046d3ae3f52a9820a6..5423e08364024ddd579241a132ac6ff1a9dc0304 100644 (file)
@@ -376,6 +376,16 @@ minetest.register_node("default:papyrus", {
        end,
 })
 
+default.bookshelf_formspec =
+       "size[8,7;]"..
+       gui_bg..
+       gui_bg_img..
+       gui_slots..
+       "list[context;books;0,0.3;8,2;]"..
+       "list[current_player;main;0,2.85;8,1;]"..
+       "list[current_player;main;0,4.08;8,3;8]"..
+       default.get_hotbar_bg(0,2.85)
+
 minetest.register_node("default:bookshelf", {
        description = "Bookshelf",
        tiles = {"default_wood.png", "default_wood.png", "default_bookshelf.png"},
@@ -384,7 +394,7 @@ minetest.register_node("default:bookshelf", {
        sounds = default.node_sound_wood_defaults(),
        on_construct = function(pos)
                local meta = minetest.env:get_meta(pos)
-               meta:set_string("formspec","size[8,7;]list[context;books;0,0;8,2;]list[current_player;main;0,3;8,4;]")
+               meta:set_string("formspec", default.bookshelf_formspec)
                local inv = meta:get_inventory()
                inv:set_size("books", 8*2)
        end,