diff options
author | Zefram <zefram@fysh.org> | 2014-05-01 14:22:25 +0100 |
---|---|---|
committer | RealBadAngel <maciej.kasatkin@yahoo.com> | 2014-05-02 12:14:48 +0200 |
commit | 5d34b235ddf975a3fbcf1123b176c94731126dea (patch) | |
tree | 40dc517ab2ac413f68e91c934016206b1540f61d /callbacks.lua | |
parent | b3d83bc953905190e60eaf60c1dba3cec3def1a7 (diff) |
Handle ingredient quantities in craft guide
Alloy cooking recipes have quantities for the ingredients, which need to
be shown. The buttons on which the ingredients are shown don't natively
support showing an item count, so hack it up with the label facility.
Also, the button names, supporting clicking to see recipes recursively,
need to be based only on the item name part of the ingredient, dropping
the quantity part.
Diffstat (limited to 'callbacks.lua')
-rw-r--r-- | callbacks.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/callbacks.lua b/callbacks.lua index a1e2396..f1646ed 100644 --- a/callbacks.lua +++ b/callbacks.lua @@ -123,12 +123,12 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) for name, value in pairs(fields) do if string.sub(name, 1, 12) == "item_button_" then clicked_item = string.sub(name, 13) + if string.sub(clicked_item, 1, 6) == "group:" then + minetest.sound_play("click", {to_player=player_name, gain = 0.1}) + unified_inventory.apply_filter(player, clicked_item) + return + end break - elseif string.sub(name, 1, 11) == "item_group_" then - minetest.sound_play("click", - {to_player=player_name, gain = 0.1}) - unified_inventory.apply_filter(player, "group:"..string.sub(name, 12)) - return end end if clicked_item then |