From 4c13a9f2f3adcc2469a8728700056b44bd1ef4ed Mon Sep 17 00:00:00 2001 From: jp Date: Sat, 21 Nov 2015 16:03:04 +0100 Subject: [PATCH] Highlight hotbar on all formspecs --- enchanting.lua | 13 +++++++------ handlers/registration.lua | 9 ++++++--- hive.lua | 4 ++-- mailbox.lua | 2 +- nodes.lua | 2 +- worktable.lua | 11 ++++++----- 6 files changed, 23 insertions(+), 18 deletions(-) diff --git a/enchanting.lua b/enchanting.lua index f393f36..2eb5f3a 100644 --- a/enchanting.lua +++ b/enchanting.lua @@ -1,22 +1,23 @@ local enchanting = {} screwdriver = screwdriver or {} +local xbg = default.gui_slots..default.get_hotbar_bg(0.5,4.5) function enchanting.tools_fs() - return "size[9,8;]"..default.gui_slots.. - "bgcolor[#080808BB;true]background[0,0;9,8;ench_ui.png]list[current_name;tool;0.9,2.9;1,1;]list[current_name;mese;2,2.9;1,1;]image[2,2.9;1,1;mese_layout.png]list[current_player;main;0.5,4.5;8,3;]".. + return "size[9,8;]"..xbg.. + "bgcolor[#080808BB;true]background[0,0;9,8;ench_ui.png]list[context;tool;0.9,2.9;1,1;]list[context;mese;2,2.9;1,1;]image[2,2.9;1,1;mese_layout.png]list[current_player;main;0.5,4.5;8,3;]".. "image_button[3.9,0.9;4,0.9;bg_btn.png;fast;Efficiency]image_button[3.9,1.82;4,1.1;bg_btn.png;durable;Durability]" end function enchanting.swords_fs() - return "size[9,8;]"..default.gui_slots.. - "bgcolor[#080808BB;true]background[0,0;9,8;ench_ui.png]list[current_name;tool;0.9,2.9;1,1;]list[current_name;mese;2,2.9;1,1;]image[2,2.9;1,1;mese_layout.png]list[current_player;main;0.5,4.5;8,3;]".. + return "size[9,8;]"..xbg.. + "bgcolor[#080808BB;true]background[0,0;9,8;ench_ui.png]list[context;tool;0.9,2.9;1,1;]list[context;mese;2,2.9;1,1;]image[2,2.9;1,1;mese_layout.png]list[current_player;main;0.5,4.5;8,3;]".. "image_button[3.9,2.95;4,0.9;bg_btn.png;sharp;Sharpness]" end function enchanting.default_fs(pos) local meta = minetest.get_meta(pos) - local formspec = "size[9,8;]"..default.gui_slots.. - "bgcolor[#080808BB;true]background[0,0;9,8;ench_ui.png]list[current_name;tool;0.9,2.9;1,1;]list[current_name;mese;2,2.9;1,1;]image[2,2.9;1,1;mese_layout.png]list[current_player;main;0.5,4.5;8,3;]" + local formspec = "size[9,8;]"..xbg.. + "bgcolor[#080808BB;true]background[0,0;9,8;ench_ui.png]list[context;tool;0.9,2.9;1,1;]list[context;mese;2,2.9;1,1;]image[2,2.9;1,1;mese_layout.png]list[current_player;main;0.5,4.5;8,3;]" meta:set_string("formspec", formspec) meta:set_string("infotext", "Enchantment Table") diff --git a/handlers/registration.lua b/handlers/registration.lua index 94f708b..bcc5c46 100644 --- a/handlers/registration.lua +++ b/handlers/registration.lua @@ -11,15 +11,18 @@ local default_inventory_size = 32 local default_inventory_formspecs = { ["8"] = "size[8,6]"..xbg.. "list[context;main;0,0;8,1;]".. - "list[current_player;main;0,2;8,4;]", + "list[current_player;main;0,2;8,4;]".. + default.get_hotbar_bg(0, 2), ["16"] = "size[8,7]"..xbg.. "list[context;main;0,0;8,2;]".. - "list[current_player;main;0,3;8,4;]", + "list[current_player;main;0,3;8,4;]".. + default.get_hotbar_bg(0, 3), ["24"] = "size[8,8]"..xbg.. "list[context;main;0,0;8,3;]".. - "list[current_player;main;0,4;8,4;]", + "list[current_player;main;0,4;8,4;]".. + default.get_hotbar_bg(0, 4), ["32"] = "size[8,9]"..xbg.. "list[context;main;0,0.3;8,4;]".. diff --git a/hive.lua b/hive.lua index 3e69ace..58f92f4 100644 --- a/hive.lua +++ b/hive.lua @@ -3,10 +3,10 @@ local hive = {} function hive.construct(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots + local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots..default.get_hotbar_bg(0,1.35) local formspec = "size[8,5;]"..xbg.. - "label[1.35,0;Bees are making honey\nwith pollen around...]image[6,0;1,1;hive_bee.png]image[5,0;1,1;hive_layout.png]list[current_name;honey;5,0;1,1;]list[current_player;main;0,1.35;8,4;]" + "label[1.35,0;Bees are making honey\nwith pollen around...]image[6,0;1,1;hive_bee.png]image[5,0;1,1;hive_layout.png]list[context;honey;5,0;1,1;]list[current_player;main;0,1.35;8,4;]" meta:set_string("formspec", formspec) meta:set_string("infotext", "Artificial Hive") diff --git a/mailbox.lua b/mailbox.lua index 846d86c..37bec1f 100644 --- a/mailbox.lua +++ b/mailbox.lua @@ -1,6 +1,6 @@ local mailbox = {} screwdriver = screwdriver or {} -local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots +local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots..default.get_hotbar_bg(0,5.25) xdecor.register("mailbox", { description = "Mailbox", diff --git a/nodes.lua b/nodes.lua index babac1f..e056d84 100644 --- a/nodes.lua +++ b/nodes.lua @@ -350,7 +350,7 @@ xdecor.register("enderchest", { on_rotate = screwdriver.rotate_simple, on_construct = function(pos) local meta = minetest.get_meta(pos) - local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots + local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots..default.get_hotbar_bg(0,5) meta:set_string("formspec", "size[8,9]"..xbg.. "list[current_player;enderchest;0,0;8,4;]".. "list[current_player;main;0,5;8,4;]") diff --git a/worktable.lua b/worktable.lua index 92c8334..2e494af 100644 --- a/worktable.lua +++ b/worktable.lua @@ -1,6 +1,6 @@ local worktable = {} screwdriver = screwdriver or {} -local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots +local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots..default.get_hotbar_bg(0,3.25) local nodes = { -- Nodes allowed to be cut. Mod name = {node name}. default = {"wood", "junglewood", "pine_wood", "acacia_wood", @@ -41,7 +41,8 @@ end function worktable.storage(pos) local inv = minetest.get_meta(pos):get_inventory() - local f = "size[8,7]"..xbg.."list[context;storage;0,0;8,2;]list[current_player;main;0,3.25;8,4;]" + local f = "size[8,7]"..xbg.. + "list[context;storage;0,0;8,2;]list[current_player;main;0,3.25;8,4;]" inv:set_size("storage", 8*2) return f end @@ -50,14 +51,14 @@ function worktable.construct(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() + local formspec = "size[8,7;]"..xbg.. + "list[context;forms;4,0;4,3;]label[0.95,1.23;Cut]box[-0.05,1;2.05,0.9;#555555]image[3,1;1,1;gui_furnace_arrow_bg.png^[transformR270]label[0.95,2.23;Repair]box[-0.05,2;2.05,0.9;#555555]image[0,1;1,1;worktable_saw.png]image[0,2;1,1;worktable_anvil.png]image[3,2;1,1;hammer_layout.png]list[context;input;2,1;1,1;]list[context;tool;2,2;1,1;]list[context;hammer;3,2;1,1;]button[0,0;2,1;craft;Crafting]button[2,0;2,1;storage;Storage]list[current_player;main;0,3.25;8,4;]" + inv:set_size("forms", 4*3) inv:set_size("input", 1) inv:set_size("tool", 1) inv:set_size("hammer", 1) - local formspec = "size[8,7;]"..xbg.. - "list[context;forms;4,0;4,3;]label[0.95,1.23;Cut]box[-0.05,1;2.05,0.9;#555555]image[3,1;1,1;gui_furnace_arrow_bg.png^[transformR270]label[0.95,2.23;Repair]box[-0.05,2;2.05,0.9;#555555]image[0,1;1,1;worktable_saw.png]image[0,2;1,1;worktable_anvil.png]image[3,2;1,1;hammer_layout.png]list[current_name;input;2,1;1,1;]list[current_name;tool;2,2;1,1;]list[current_name;hammer;3,2;1,1;]button[0,0;2,1;craft;Crafting]button[2,0;2,1;storage;Storage]list[current_player;main;0,3.25;8,4;]" - meta:set_string("formspec", formspec) meta:set_string("infotext", "Work Table") end