From 86ad3e7c6a37699f7f8297a387bf08af74e36629 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Fri, 1 Apr 2016 22:10:20 -0400 Subject: Update all core mods --- unified_inventory/init.lua | 5 +++-- unified_inventory/item_names.lua | 3 +++ unified_inventory/register.lua | 10 ++-------- 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'unified_inventory') diff --git a/unified_inventory/init.lua b/unified_inventory/init.lua index b327ecd..d311ace 100644 --- a/unified_inventory/init.lua +++ b/unified_inventory/init.lua @@ -48,8 +48,9 @@ unified_inventory = { } -- Disable default creative inventory -if rawget(_G, "creative_inventory") then - function creative_inventory.set_creative_formspec(player, start_i, pagenum) +local creative = rawget(_G, "creative") or rawget(_G, "creative_inventory") +if creative then + function creative.set_creative_formspec(player, start_i, pagenum) return end end diff --git a/unified_inventory/item_names.lua b/unified_inventory/item_names.lua index 2c92d65..243b938 100644 --- a/unified_inventory/item_names.lua +++ b/unified_inventory/item_names.lua @@ -6,12 +6,15 @@ local dtimes = {} local dlimit = 3 -- HUD element will be hidden after this many seconds local air_hud_mod = minetest.get_modpath("4air") local hud_mod = minetest.get_modpath("hud") +local hudbars_mod = minetest.get_modpath("hudbars") local function set_hud(player) local player_name = player:get_player_name() local off = {x=0, y=-70} if air_hud_mod or hud_mod then off.y = off.y - 20 + elseif hudbars_mod then + off.y = off.y + 13 end huds[player_name] = player:hud_add({ hud_elem_type = "text", diff --git a/unified_inventory/register.lua b/unified_inventory/register.lua index b47b1c6..7042849 100644 --- a/unified_inventory/register.lua +++ b/unified_inventory/register.lua @@ -168,11 +168,6 @@ unified_inventory.register_page("craft", { -- stack_image_button(): generate a form button displaying a stack of items -- --- Normally a simple item_image_button[] is used. If the stack contains --- more than one item, item_image_button[] doesn't have an option to --- display an item count in the way that an inventory slot does, so --- we have to fake it using the label facility. --- -- The specified item may be a group. In that case, the group will be -- represented by some item in the group, along with a flag indicating -- that it's a group. If the group contains only one item, it will be @@ -182,7 +177,7 @@ local function stack_image_button(x, y, w, h, buttonname_prefix, item) local name = item:get_name() local count = item:get_count() local show_is_group = false - local displayitem = name + local displayitem = name.." "..count local selectitem = name if name:sub(1, 6) == "group:" then local group_name = name:sub(7) @@ -191,8 +186,7 @@ local function stack_image_button(x, y, w, h, buttonname_prefix, item) displayitem = group_item.item or "unknown" selectitem = group_item.sole and displayitem or name end - local label = string.format("\n\n%s%7d", show_is_group and " G\n" or " ", count):gsub(" 1$", " .") - if label == "\n\n ." then label = "" end + local label = show_is_group and "G" or "" return string.format("item_image_button[%f,%f;%u,%u;%s;%s;%s]", x, y, w, h, minetest.formspec_escape(displayitem), -- cgit v1.2.3