Use minetest.get_item_group for more flexibility

This commit is contained in:
codiac 2023-08-04 11:24:07 +10:00
parent a3bbb3694c
commit 4f2cb955b8
1 changed files with 9 additions and 2 deletions

View File

@ -1007,9 +1007,16 @@ end
----- JOBSITE LOGIC ----- JOBSITE LOGIC
local function get_profession_by_jobsite(js) local function get_profession_by_jobsite(js)
local is_cauldron = string.find(js, "mcl_cauldrons:cauldron")
for k,v in pairs(professions) do for k,v in pairs(professions) do
if v.jobsite == js or (is_cauldron and v.jobsite == "group:cauldron") then return k end if v.jobsite == js then
return k
-- Catch Nitwit doesn't have a jobsite
elseif v.jobsite and v.jobsite:find("^group:") then
local group = v.jobsite:gsub("^group:", "")
if minetest.get_item_group(js, group) > 0 then
return k
end
end
end end
end end