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      5   		 0.4,  0.5,  0.5;
     6      6   	};
     7      7   }
     8      8   
     9      9   local function
    10     10   findextract(herb)
    11     11   	for name, e in pairs(sorcery.data.extracts) do
    12         -		if e[1] == herb then
           12  +		local found = false
           13  +		if sorcery.lib.item.groupmatch(e[1], herb) then
    13     14   			return name, {
    14     15   				color = e[2];
    15     16   				reqamt = e[3] or 3;
    16     17   				reqtime = e[4] or 75;
    17     18   			}
    18     19   		end
    19     20   	end

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

    31     31   			end
    32     32   		else
    33     33   			local is = ItemStack(identity)
    34     34   			identity,count = is:get_name(), is:get_count()
    35     35   		end
    36     36   	end
    37     37   
    38         -	local stack = ItemStack(item)
    39     38   	if sorcery.lib.str.beginswith(identity, 'group:') then
           39  +		local stack = ItemStack(item)
    40     40   		local groups = sorcery.lib.str.explode(string.sub(identity,7), ',')
    41     41   		for _,g in pairs(groups) do
    42     42   			local rn,rv = sorcery.lib.tbl.split(g,'=')
    43     43   			local gv = minetest.get_item_group(stack:get_name(), rn)
    44     44   			if rv then
    45     45   				if gv ~= tonumber(rv) then return false, stack end
    46     46   			else

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

   181    181   		return true
   182    182   	end;
   183    183   
   184    184   	tree_is_live = function(pos, checklight) -- VERY EXPENSIVE FUNCTION
   185    185   		-- this is going to require some explanation.
   186    186   		--
   187    187   		-- for various purposes, we want to be able to tell the difference between
   188         -		-- a tree that has grown naturally from the grown vs. a couple of trunk nodes
          188  +		-- a tree that has grown naturally from the ground vs. a couple of trunk nodes
   189    189   		-- that the player has jammed together, even if she's built her own counterfeit
   190    190   		-- tree. unfortunately, mtg provides no easy way to do this. the only 
   191    191   		-- difference between a cluster of trunk blocks and a real tree is that the
   192    192   		-- real tree will have a specific kind of leaves attached with their param2
   193    193   		-- set to 1 so that they can be distinguished for the purpose of leaf cleaning.
   194    194   		-- so to check a tree's state, we need to amass its whole potential body, and if
   195    195   		-- there are legitimate leaves connected, then we identify it as a legit tree.
................................................................................
   410    410   		for _,p in pairs(n) do
   411    411   			local sum = vector.add(pos, p)
   412    412   			local n = minetest.get_node(sum)
   413    413   			if n.name == 'ignore' then
   414    414   				minetest.load_area(sum)
   415    415   				n = minetest.get_node(sum)
   416    416   			end
   417         -			fn(sum, n)
          417  +			if fn(sum, n) == false then break end
   418    418   		end
   419    419   	end;
   420    420   
   421    421   	amass = amass;
   422    422   	
   423    423   	force = force;
   424    424