sorcery  Diff

Differences From Artifact [a381d20de4]:

To Artifact [48691b218f]:


    39     39   		value = fragments_per_ingot * 9;
    40     40   	};
    41     41   }
    42     42   
    43     43   local tools, armors = sorcery.matreg.tools, sorcery.matreg.armors
    44     44   for name, metal in pairs(sorcery.data.metals) do
    45     45   	local ingot = metal.ingot or 'sorcery:' .. name .. '_ingot'
    46         -	local block = metal.block or 'sorcery:' .. name .. '_block'
           46  +	local block = metal.block or 'sorcery:' .. name .. 'block'
    47     47   	local screw = 'sorcery:screw_' .. name
    48     48   	local fragment = 'sorcery:fragment_' .. name
    49         -	if not metal.no_tools then for _,t in pairs(tools) do
           49  +	local powder = 'sorcery:powder_' .. name
           50  +	metal.parts = {
           51  +		ingot = ingot;
           52  +		block = block;
           53  +		screw = screw;
           54  +		fragment = fragment;
           55  +		powder = powder;
           56  +	}
           57  +	if not metal.no_tools then for t,c in pairs(tools) do
    50     58   		sorcery.matreg.lookup[(metal.items and metal.items[t]) or ('sorcery:' .. t .. '_' .. name)] = {
    51     59   			metal = true;
    52     60   			id = name; data = metal;
           61  +			value = c.cost * fragments_per_ingot;
    53     62   		}
    54     63   	end end
    55         -	if not metal.no_armor then for _,a in pairs(armors) do
           64  +	if not metal.no_armor then for a,c in pairs(armors) do
    56     65   		sorcery.matreg.lookup[(metal.items and metal.items[a]) or ('sorcery:' .. a .. '_' .. name)] = {
    57     66   			metal = true;
    58     67   			id = name; data = metal;
           68  +			value = c.cost * fragments_per_ingot;
    59     69   		}
    60     70   	end end
    61     71   	sorcery.data.metallookup[ingot] = {
    62     72   		id = name; data = metal;
    63     73   		value = fragments_per_ingot;
    64     74   	}
    65     75   	sorcery.data.metallookup[block] = {
................................................................................
    71     81   		value = 1;
    72     82   	}
    73     83   	sorcery.data.metallookup[screw] = {
    74     84   		id = name; data = metal;
    75     85   		value = 0; -- prevent use in smelting
    76     86   	}
    77     87   	minetest.register_craftitem(screw, {
    78         -		description = sorcery.lib.str.capitalize(name) .. ' screw';
           88  +		description = sorcery.lib.str.capitalize(name) .. ' Screw';
    79     89   		inventory_image = sorcery.lib.image('sorcery_screw.png'):multiply(sorcery.lib.color(metal.tone)):render();
    80     90   	})
           91  +	minetest.register_craftitem(powder, {
           92  +		description = sorcery.lib.str.capitalize(name) .. ' Powder';
           93  +		inventory_image = 'sorcery_' .. name .. '_powder.png';
           94  +	})
           95  +	if metal.dye then
           96  +		minetest.register_craft {
           97  +			output = 'dye:' .. metal.dye .. ' 4';
           98  +			recipe = {
           99  +				{'',     powder,                   ''};
          100  +				{powder,'basic_materials:paraffin',powder};
          101  +				{'','bucket:bucket_water',''};
          102  +			};
          103  +			replacements = {
          104  +				{'bucket:bucket_water', 'bucket:bucket_empty'};
          105  +			};
          106  +		};
          107  +	end
    81    108   	-- TODO: replace crafting recipe with kiln recipe
    82    109   	minetest.register_craft {
    83    110   		output = screw.. ' 4';
    84    111   		recipe = {
    85    112   			{fragment,fragment,fragment};
    86    113   			{'',      fragment,''};
    87    114   			{'',      fragment,''};
................................................................................
   107    134   			lump_image = (metal.image and metal.image.lump) or nil;
   108    135   			armor_weight = metal.armor_weight;
   109    136   			armor_protection = metal.armor_protection;
   110    137   		}
   111    138   	end
   112    139   	minetest.register_craftitem(fragment, {
   113    140   		inventory_image = 'sorcery_' .. name .. '_fragment.png';
   114         -		description = sorcery.lib.str.capitalize(name) .. ' fragment';
          141  +		description = sorcery.lib.str.capitalize(name) .. ' Fragment';
   115    142   	})
          143  +	minetest.register_craft {
          144  +		type = 'cooking';
          145  +		recipe = powder;
          146  +		cooktime = (metal.cooktime or 4) * 1.5;
          147  +		output = fragment;
          148  +	}
   116    149   	minetest.register_craft {
   117    150   		type = 'cooking';
   118    151   		recipe = ingot;
   119    152   		cooktime = (metal.cooktime or 4) / 2;
   120    153   		output = fragment .. ' ' .. tostring(fragments_per_ingot);
   121    154   	}
   122    155   	do local rec = {}
................................................................................
   124    157   			rec[#rec+1]=fragment 
   125    158   		end
   126    159   		minetest.register_craft {
   127    160   			type = 'shapeless';
   128    161   			recipe = rec;
   129    162   			output = ingot;
   130    163   		}
          164  +	end
          165  +	if metal.fuel then
          166  +		minetest.register_craft {
          167  +			type = 'fuel';
          168  +			recipe = powder;
          169  +			burntime = metal.fuel;
          170  +		}
   131    171   	end
   132    172   	if metal.mix then
   133    173   		sorcery.data.register.alloy(sorcery.lib.tbl.merge(metal.mix, {
   134    174   			output = name;
   135    175   			cooktime = metal.cooktime or 10;
   136    176   		}))
          177  +	end
          178  +	if metal.sinter then
          179  +		local powders = {}
          180  +		for _,m in pairs(metal.sinter) do
          181  +			powders[#powders+1] = 'sorcery:powder_' .. m
          182  +		end
          183  +		minetest.register_craft {
          184  +			type = 'shapeless';
          185  +			output = powder .. ' ' .. tostring(#powders);
          186  +			recipe = powders;
          187  +		};
   137    188   	end
   138    189   end