diff options
author | Zefram <zefram@fysh.org> | 2014-06-13 09:54:21 +0100 |
---|---|---|
committer | Diego Martinez <kaeza@users.sf.net> | 2014-06-13 06:28:38 -0300 |
commit | dbf98cb694578223c0f3bb1016e054ce636f2276 (patch) | |
tree | 26e192261c35a04254e1032cf9a6181a9735540b /group.lua | |
parent | 7f4f0fd225f78ddde0c9c65bb1e2aa074c00949b (diff) |
Fix display of group ingredients
Commit 043f6081452365daaa033c58e0738527ccb64c3d broke a couple of things
in the course of its refactoring. This patch restores the "G" flag that
signals group ingredients, the preference for "default:" items as group
representatives (where a representative isn't specifically registered),
and the built-in registration of default:cobble as representative for
group:stone (because it's the most commonly-used item in that group).
Diffstat (limited to 'group.lua')
-rw-r--r-- | group.lua | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,6 +1,7 @@ unified_inventory.registered_group_items = { mesecon_conductor_craftable = "mesecons:wire_00000000_off", + stone = "default:cobble", wool = "wool:white", } @@ -21,7 +22,7 @@ end -- Among equally-preferred items, we just pick the one with the -- lexicographically earliest name. -function compute_group_item(group_name) +local function compute_group_item(group_name) local candidate_items = {} for itemname, itemdef in pairs(minetest.registered_items) do if (itemdef.groups.not_in_creative_inventory or 0) == 0 and @@ -40,8 +41,10 @@ function compute_group_item(group_name) for _, item in ipairs(candidate_items) do local pref if item == unified_inventory.registered_group_items[group_name] then + pref = 4 + elseif item == "default:"..group_name then pref = 3 - elseif item:gsub("^[^:]+:", "") == group_name then + elseif item:gsub("^[^:]*:", "") == group_name then pref = 2 else pref = 1 |