sorcery  Diff

Differences From Artifact [fac511da65]:

To Artifact [4b9992727f]:


    49     49   	local props = minetest.registered_items[item]._sorcery
    50     50   	if props and props.recipe then
    51     51   		return props.recipe
    52     52   	end
    53     53   	return {}
    54     54   end
    55     55   local modofname = function(id)
    56         -	local sep = string.find(id,':')
    57         -	if sep == nil then return nil end -- uh oh
    58         -	return string.sub(id, 1, sep - 1)
           56  +	local item = minetest.registered_nodes[id]
           57  +	if item == nil or item.mod_origin == '??' or not item.mod_origin then
           58  +		local sep = string.find(id,':')
           59  +		if sep == nil then return nil end -- uh oh
           60  +		return string.sub(id, 1, sep - 1)
           61  +	end
           62  +	return item.mod_origin
    59     63   end
    60     64   local item_restrict_eval = function(name, restrict)
    61     65   	for _,n in pairs(constants.exclude_names) do
    62     66   		if string.find(name,n) ~= nil then
    63     67   			return false
    64     68   		end
    65     69   	end
................................................................................
   277    281   			end
   278    282   		end;
   279    283   	};
   280    284   	grind = {
   281    285   		name = 'Milling Guide';
   282    286   		node = 'sorcery:mill';
   283    287   		booksuf = 'Manual';
   284         -		chance = 1;
          288  +		chance = 4;
   285    289   		w = 1, h = 2;
   286    290   		pick = function(restrict)
   287    291   			cache:populate_grindables()
   288    292   			if restrict then
   289    293   				local t = {}
   290    294   				for _, i in pairs(cache.grindables) do
   291    295   					local pd = sorcery.itemclass.get(i, 'grindable')
................................................................................
   324    328   						end
   325    329   					end
   326    330   					return {v,''} -- !!
   327    331   				end
   328    332   			end
   329    333   		end;
   330    334   	};
   331         -	-- wand = {
   332         -	--	booksuf = 'Grimoire';
   333         -	-- }
   334    335   	enchant = {
   335    336   		name = 'Enchantment Matrix';
   336    337   		node = 'sorcery:enchanter';
   337    338   		booksuf = 'Grimoire';
   338    339   		drawslots = false;
   339         -		chance = 6;
          340  +		chance = 4;
   340    341   		w = 2, h = 2;
   341    342   		pick = function(restrict)
   342    343   			-- TODO make sure affinity restrictions match
   343    344   			local names = {}
   344    345   			for k,v in pairs(sorcery.data.enchants) do
   345    346   				if v.recipe then names[#names+1] = k end
   346    347   			end
................................................................................
   454    455   	local props = k.props(result)
   455    456   	for i=1,#k.slots do
   456    457   		local ing = ingredients[i]
   457    458   		local x, y = k.slots[i][1], k.slots[i][2]
   458    459   		if ing and ing ~= '' then
   459    460   			local tt
   460    461   			if k.indesc then tt = k.indesc(ing) else tt = desc_builtin(ing) end
          462  +			local overlay = ''
          463  +			if minetest.get_item_group(ing, 'sorcery_extract') ~= 0 then
          464  +				overlay = string.format('item_image[%f,%f;0.6,0.6;%s]', x+0.5, y+0.5, ing)
          465  +				ing = minetest.registered_nodes[ing]._sorcery.extract.of
          466  +			end
   461    467   			t = t .. string.format([[
   462         -				item_image[%f,%f;1,1;%s]
          468  +				item_image[%f,%f;1,1;%s]%s
   463    469   				tooltip[%f,%f;1,1;%s]
   464         -			]], x,y, minetest.formspec_escape(group_eval(ing)),
          470  +			]], x,y, minetest.formspec_escape(group_eval(ing)), overlay,
   465    471   			    x,y, minetest.formspec_escape(tt))
   466    472   		else
   467    473   			if k.drawslots == nil or k.drawslots then
   468    474   				t = string.format('box[%f,%f;0.1,0.1;#00000060]',x+0.45,y+0.45) .. t
   469    475   			end
   470    476   		end
   471    477   	end