Add fancy inventory for bones
authorCraig Davison <craig.davison3@gmail.com>
Wed, 24 Dec 2014 19:54:24 +0000 (19:54 +0000)
committerNovatux <nathanael.courant@laposte.net>
Sat, 17 Jan 2015 15:05:19 +0000 (16:05 +0100)
mods/bones/init.lua

index 0f7625731be0515fc22643c937f64636333cd5d2..03ed61d65cd7e809ac7831face6d3422c1912608 100644 (file)
@@ -1,6 +1,8 @@
 -- Minetest 0.4 mod: bones
 -- See README.txt for licensing and other information. 
 
+bones = {}
+
 local function is_owner(pos, name)
        local owner = minetest.get_meta(pos):get_string("owner")
        if owner == "" or owner == name then
@@ -9,6 +11,16 @@ local function is_owner(pos, name)
        return false
 end
 
+bones.bones_formspec =
+       "size[8,9]"..
+       default.gui_bg..
+       default.gui_bg_img..
+       default.gui_slots..
+       "list[current_name;main;0,0.3;8,4;]"..
+       "list[current_player;main;0,4.85;8,1;]"..
+       "list[current_player;main;0,6.08;8,3;8]"..
+       default.get_hotbar_bg(0,4.85)
+
 minetest.register_node("bones:bones", {
        description = "Bones",
        tiles = {
@@ -158,9 +170,7 @@ minetest.register_on_dieplayer(function(player)
        player_inv:set_list("main", {})
        player_inv:set_list("craft", {})
        
-       meta:set_string("formspec", "size[8,9;]"..
-                       "list[current_name;main;0,0;8,4;]"..
-                       "list[current_player;main;0,5;8,4;]")
+       meta:set_string("formspec", bones.bones_formspec)
        meta:set_string("infotext", player_name.."'s fresh bones")
        meta:set_string("owner", player_name)
        meta:set_int("time", 0)