sorcery  Check-in [9599e69051]

Overview
Comment:fix group matching
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9599e690511abbf2c2b2c64a72c761f03b7b5c104ff17cda14bd1061131b0bcc
User & Date: lexi on 2021-10-27 18:11:38
Other Links: manifest | tags
Context
2022-03-18
01:50
updates check-in: 4b5ada2414 user: lexi tags: trunk
2021-10-27
18:11
fix group matching check-in: 9599e69051 user: lexi tags: trunk
17:10
fix wine compat check-in: 17322fc1b2 user: lexi tags: trunk
Changes

Modified distiller.lua from [4be66a79c1] to [38382a5879].

5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
		 0.4,  0.5,  0.5;
	};
}

local function
findextract(herb)
	for name, e in pairs(sorcery.data.extracts) do
		if e[1] == herb then

			return name, {
				color = e[2];
				reqamt = e[3] or 3;
				reqtime = e[4] or 75;
			}
		end
	end







|
>







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
		 0.4,  0.5,  0.5;
	};
}

local function
findextract(herb)
	for name, e in pairs(sorcery.data.extracts) do
		local found = false
		if sorcery.lib.item.groupmatch(e[1], herb) then
			return name, {
				color = e[2];
				reqamt = e[3] or 3;
				reqtime = e[4] or 75;
			}
		end
	end

Modified lib/item.lua from [21229f1a9e] to [390f387a79].

31
32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
			end
		else
			local is = ItemStack(identity)
			identity,count = is:get_name(), is:get_count()
		end
	end

	local stack = ItemStack(item)
	if sorcery.lib.str.beginswith(identity, 'group:') then

		local groups = sorcery.lib.str.explode(string.sub(identity,7), ',')
		for _,g in pairs(groups) do
			local rn,rv = sorcery.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







<

>







31
32
33
34
35
36
37

38
39
40
41
42
43
44
45
46
			end
		else
			local is = ItemStack(identity)
			identity,count = is:get_name(), is:get_count()
		end
	end


	if sorcery.lib.str.beginswith(identity, 'group:') then
		local stack = ItemStack(item)
		local groups = sorcery.lib.str.explode(string.sub(identity,7), ',')
		for _,g in pairs(groups) do
			local rn,rv = sorcery.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

Modified lib/node.lua from [f2e6b0cbe1] to [6d3c2359aa].

181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
...
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
		return true
	end;

	tree_is_live = function(pos, checklight) -- VERY EXPENSIVE FUNCTION
		-- this is going to require some explanation.
		--
		-- for various purposes, we want to be able to tell the difference between
		-- a tree that has grown naturally from the grown vs. a couple of trunk nodes
		-- that the player has jammed together, even if she's built her own counterfeit
		-- tree. unfortunately, mtg provides no easy way to do this. the only 
		-- difference between a cluster of trunk blocks and a real tree is that the
		-- real tree will have a specific kind of leaves attached with their param2
		-- set to 1 so that they can be distinguished for the purpose of leaf cleaning.
		-- so to check a tree's state, we need to amass its whole potential body, and if
		-- there are legitimate leaves connected, then we identify it as a legit tree.
................................................................................
		for _,p in pairs(n) do
			local sum = vector.add(pos, p)
			local n = minetest.get_node(sum)
			if n.name == 'ignore' then
				minetest.load_area(sum)
				n = minetest.get_node(sum)
			end
			fn(sum, n)
		end
	end;

	amass = amass;
	
	force = force;








|







 







|







181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
...
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
		return true
	end;

	tree_is_live = function(pos, checklight) -- VERY EXPENSIVE FUNCTION
		-- this is going to require some explanation.
		--
		-- for various purposes, we want to be able to tell the difference between
		-- a tree that has grown naturally from the ground vs. a couple of trunk nodes
		-- that the player has jammed together, even if she's built her own counterfeit
		-- tree. unfortunately, mtg provides no easy way to do this. the only 
		-- difference between a cluster of trunk blocks and a real tree is that the
		-- real tree will have a specific kind of leaves attached with their param2
		-- set to 1 so that they can be distinguished for the purpose of leaf cleaning.
		-- so to check a tree's state, we need to amass its whole potential body, and if
		-- there are legitimate leaves connected, then we identify it as a legit tree.
................................................................................
		for _,p in pairs(n) do
			local sum = vector.add(pos, p)
			local n = minetest.get_node(sum)
			if n.name == 'ignore' then
				minetest.load_area(sum)
				n = minetest.get_node(sum)
			end
			if fn(sum, n) == false then break end
		end
	end;

	amass = amass;
	
	force = force;