diff options
author | RealBadAngel <maciej.kasatkin@o2.pl> | 2016-02-09 04:42:31 +0100 |
---|---|---|
committer | RealBadAngel <maciej.kasatkin@o2.pl> | 2016-02-09 04:42:45 +0100 |
commit | b3c6c922861f9936cc03fae5cd6cabb9cacd9e27 (patch) | |
tree | 93c94691793e0d3c3b3287b4ac9663cfe5584280 /register.lua | |
parent | 8f91abbfb87ee6a29102314dda417c1cff015bb5 (diff) |
Remove count from item_image_button label,
item_image_buttons can now display properly item stacks
Diffstat (limited to 'register.lua')
-rw-r--r-- | register.lua | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/register.lua b/register.lua index b47b1c6..7042849 100644 --- a/register.lua +++ b/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), |