starlit  Diff

Differences From Artifact [29827ac7a0]:

To Artifact [3c399f0296]:


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
..
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
				count = b:get_count() - a:get_count();
			}
		end
	end
end

-- it is extremely unfortunate this function needs to exist.
-- minetest needs to export its matching capabilities already
fn.groupmatch = function(identity,item,exact)
	if exact == nil then exact = true end
	local count
	if type(identity) == 'table' then
		count = identity.count
		identity = identity.name
	else
................................................................................
	end

	if lib.str.beginswith(identity, 'group:') then
		local stack = ItemStack(item)
		local groups = lib.str.explode(string.sub(identity,7), ',')
		for _,g in pairs(groups) do
			local rn,rv = lib.tbl.split(g,'=')
			local gv = minetest.get_item_group(stack:get_name(), rn)
			if rv then
				if gv ~= tonumber(rv) then return false, stack end
			else
				if (not gv) or gv == 0 then return false, stack end
			end
		end








|







 







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
..
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
				count = b:get_count() - a:get_count();
			}
		end
	end
end

-- it is extremely unfortunate this function needs to exist.
-- luanti needs to export its matching capabilities already
fn.groupmatch = function(identity,item,exact)
	if exact == nil then exact = true end
	local count
	if type(identity) == 'table' then
		count = identity.count
		identity = identity.name
	else
................................................................................
	end

	if lib.str.beginswith(identity, 'group:') then
		local stack = ItemStack(item)
		local groups = lib.str.explode(string.sub(identity,7), ',')
		for _,g in pairs(groups) do
			local rn,rv = lib.tbl.split(g,'=')
			local gv = core.get_item_group(stack:get_name(), rn)
			if rv then
				if gv ~= tonumber(rv) then return false, stack end
			else
				if (not gv) or gv == 0 then return false, stack end
			end
		end