sorcery  Diff

Differences From Artifact [f2df9bf8e4]:

To Artifact [b8a7748341]:


    68     68   	if not metal.no_armor then for a,c in pairs(armors) do
    69     69   		sorcery.matreg.lookup[(metal.items and metal.items[a]) or ('sorcery:' .. a .. '_' .. name)] = {
    70     70   			metal = true;
    71     71   			id = name; data = metal;
    72     72   			value = c.cost * fragments_per_ingot;
    73     73   		}
    74     74   	end end
    75         -	sorcery.data.metallookup[ingot] = {
    76         -		id = name; data = metal;
    77         -		value = fragments_per_ingot;
    78         -	}
    79         -	sorcery.data.metallookup[block] = {
    80         -		id = name; data = metal;
    81         -		value = fragments_per_ingot * 9;
    82         -	}
    83         -	sorcery.data.metallookup[fragment] = {
    84         -		id = name; data = metal;
    85         -		value = 1;
    86         -	}
    87         -	sorcery.data.metallookup[disc] = {
    88         -		id = name; data = metal;
    89         -		value = 8/3;
    90         -	}
           75  +	local install = function(part,amt)
           76  +			sorcery.data.metallookup[part] = { id = name, data = metal, value = amt }
           77  +	end
           78  +	install(ingot,    fragments_per_ingot)
           79  +	install(block,    fragments_per_ingot*9)
           80  +	install(fragment, 1)
           81  +	install(powder,   1)
           82  +	install(disc,     8/3)
           83  +
    91     84   	if not metal.no_craftables then
    92         -		sorcery.data.metallookup[screw] = {
    93         -			id = name; data = metal;
    94         -			value = 0.5;
    95         -		}
           85  +		install(screw, 0.5)
    96     86   		minetest.register_craftitem(screw, {
    97     87   			description = sorcery.lib.str.capitalize(name) .. ' Screw';
    98     88   			inventory_image = sorcery.lib.image('sorcery_screw.png'):multiply(sorcery.lib.color(metal.tone)):render();
    99     89   			groups = { metal = 1; sorcery_screw = 1; sorcery_tech_component = 1; };
   100     90   			_sorcery = {
   101     91   				material = {
   102     92   					id = name, data = metal;
................................................................................
   129    119   				grindcost = 3;
   130    120   				grindvalue = 2*4;
   131    121   				value = 4 * (2/3);
   132    122   			};
   133    123   		};
   134    124   	})
   135    125   
          126  +	sorcery.lathe.register {
          127  +		input = ingot;
          128  +		output = {name = fragment; count = fragments_per_ingot};
          129  +		tech = 'cut', cost = 2;
          130  +	}
          131  +	sorcery.lathe.register {
          132  +		input = block;
          133  +		output = {name = fragment; count = fragments_per_ingot*9};
          134  +		tech = 'cut', cost = 2*7;
          135  +	}
   136    136   	sorcery.lathe.register {
   137    137   		input = ingot, mass = 2;
   138    138   		output = {name = disc, count = 3};
   139    139   		tech = 'cut', cost = 5;
   140    140   	}
   141    141   	sorcery.lathe.register {
   142    142   		input = block;
................................................................................
   144    144   		leftover = ingot;
   145    145   		tech = 'cut', cost = 5*7;
   146    146   	}
   147    147   
   148    148   	minetest.register_craftitem(powder, {
   149    149   		description = sorcery.lib.str.capitalize(name) .. ' Powder';
   150    150   		inventory_image = 'sorcery_' .. name .. '_powder.png';
          151  +		groups = {sorcery_powder = 1; powder = 1};
   151    152   	})
   152    153   	if metal.dye then
   153    154   		minetest.register_craft {
   154    155   			output = 'dye:' .. metal.dye .. ' 4';
   155    156   			recipe = {
   156    157   				{'',     powder,                   ''};
   157    158   				{powder,'basic_materials:paraffin',powder};
................................................................................
   221    222   		type = 'cooking';
   222    223   		recipe = ingot;
   223    224   		cooktime = (metal.cooktime or 4) * 0.5;
   224    225   		output = fragment .. ' ' .. tostring(fragments_per_ingot);
   225    226   	}
   226    227   	do local rec = {}
   227    228   		for i=1,fragments_per_ingot do
   228         -			rec[#rec+1]=fragment 
          229  +			rec[#rec+1]=fragment
   229    230   		end
   230    231   		minetest.register_craft {
   231    232   			type = 'shapeless';
   232    233   			recipe = rec;
   233    234   			output = ingot;
   234    235   		}
   235    236   	end