mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 00:19:32 +01:00
Use minetest.get_item_group for more flexibility
This commit is contained in:
parent
a3bbb3694c
commit
4f2cb955b8
1 changed files with 9 additions and 2 deletions
|
@ -1007,9 +1007,16 @@ end
|
|||
|
||||
----- JOBSITE LOGIC
|
||||
local function get_profession_by_jobsite(js)
|
||||
local is_cauldron = string.find(js, "mcl_cauldrons:cauldron")
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue