From e4d0438bf49ed62433654f835201ca2f7f1acc2b Mon Sep 17 00:00:00 2001 From: addi Date: Tue, 12 Jul 2016 16:24:24 +0200 Subject: [PATCH] update Formspec of box and shelf to fit into minetest_game --- furniture.lua | 36 ++++++++++++++++++++++++------------ init.lua | 4 ++++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/furniture.lua b/furniture.lua index dc86c00..f603334 100644 --- a/furniture.lua +++ b/furniture.lua @@ -18,6 +18,16 @@ minetest.register_node("darkage:chain", { groups = {snappy=1,cracky=2,oddly_breakable_by_hand=2}, legacy_wallmounted = true }) +local box_formspec = [[ + size[8,9] + list[context;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] + listring[context;main] + listring[current_player;main] +]].. darkage.formbg + + minetest.register_node("darkage:box", { description = "Box", @@ -26,11 +36,7 @@ minetest.register_node("darkage:box", { sounds = default.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", [[ - size[8,8] - list[context;main;0,0;8,3;] - list[current_player;main;0,4;8,4;] - ]]) + meta:set_string("formspec", box_formspec ) meta:set_string("infotext", "Box") local inv = meta:get_inventory() inv:set_size("main", 16) @@ -54,6 +60,18 @@ minetest.register_node("darkage:box", { end, }) +local shelves_formspec = [[ + size[8,9] + list[context;up;0,0;8,2;] + list[context;down;0,2.3;8,2;] + + list[current_player;main;0,4.85;8,1;] + list[current_player;main;0,6.08;8,3;8] + listring[context;up] + listring[context;down] + listring[current_player;main] +]].. darkage.formbg + minetest.register_node("darkage:wood_shelves", { description = "Wooden Shelves", tiles = { "darkage_shelves.png","darkage_shelves.png","darkage_shelves.png", @@ -63,13 +81,7 @@ minetest.register_node("darkage:wood_shelves", { sounds = default.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec",[[ - size[8,10] - list[context;up;0,0;8,3;] - list[context;down;0,3;8,3;] - - list[current_player;main;0,6;8,4;] - ]]) + meta:set_string("formspec", shelves_formspec) meta:set_string("infotext", "Wooden Shelves") local inv = meta:get_inventory() inv:set_size("up", 16) diff --git a/init.lua b/init.lua index 15325c3..284851f 100644 --- a/init.lua +++ b/init.lua @@ -2,6 +2,10 @@ minetest.log("action"," ---- Dark Age Version 1.3 is Loading! ---- ") darkage = {}; -- Create darkage namespace +darkage.formbg = (default.gui_bg or "").. + (default.gui_bg_img or "").. + (default.gui_slots or "") + local MODPATH = minetest.get_modpath("darkage") dofile(MODPATH.."/nodes.lua")