sorcery  recipes.lua at [58edda50fc]

File recipes.lua artifact 4091d897f1 part of check-in 58edda50fc


-- convenience defs
local D = sorcery.data
local function mtlp(n, p) return D.metals[n].parts[p] end
local function ingot(metal) return mtlp(metal,'ingot') end
-- tweaks

minetest.register_craft {
	type = "shapeless";
	recipe = {
		"group:water_bucket",
		"vessels:glass_bottle",
		"vessels:glass_bottle",
		"vessels:glass_bottle"
	};
	output = "sorcery:potion_water 3";
	replacements = {
		{ "group:water_bucket", "bucket:bucket_empty" }
	};
}
minetest.register_craft {
	output = 'dye:white 4';
	recipe = {
		{'',           'sorcery:ash',             ''};
		{'sorcery:ash','basic_materials:paraffin','sorcery:ash'};
		{'',           'bucket:bucket_water',     ''};
	};
	replacements = {
		{'bucket:bucket_water', 'bucket:bucket_empty'};
	};
};

minetest.register_craft {
	type = "shapeless";
	recipe = {
		"bucket:bucket_empty";
		"sorcery:potion_water";
		"sorcery:potion_water";
		"sorcery:potion_water";
	};
	output = "bucket:bucket_water";
	replacements = {
		{ "sorcery:potion_water", "vessels:glass_bottle" };
		{ "sorcery:potion_water", "vessels:glass_bottle" };
		{ "sorcery:potion_water", "vessels:glass_bottle" };
	};
}

minetest.register_craft {
	type = 'shapeless';
	recipe = {
		'group:scissors';
		'basic_materials:plastic_sheet';
	};
	output = 'basic_materials:plastic_strip 3';
	replacements = {
		{'group:scissors','group:scissors'};
	};
}

minetest.register_craft {
	recipe = {
		{"", ingot('gold')};
		{ingot('bronze'),""}
	};
	output = "sorcery:dagger";
}

---- magitech

-- infuser


minetest.register_craft {
	type = 'shapeless';
	recipe = {
		'basic_materials:empty_spool';
		'basic_materials:empty_spool';
		'sorcery:infuser_concentrator';
	};
	replacements = {
		{'basic_materials:empty_spool', 'basic_materials:steel_wire'};
		{'basic_materials:empty_spool', 'basic_materials:copper_wire'};
	};
	output = "default:obsidian_shard";
}

minetest.register_craft {
	type = 'shapeless';
	recipe = {
		'xdecor:honey';
		'xdecor:bowl';
		'basic_materials:oil_extract';
	};
	output = "sorcery:grease_sealant";
}

minetest.register_craft {
	recipe = {
		{ ingot('tin'), 'bucket:bucket_empty',ingot('tin')};
		{ ingot('bronze'), 'sorcery:infuser_chamber',ingot('copper')};
		{ 'sorcery:infuser_tube', 'sorcery:infuser_tube', 'sorcery:infuser_tube' };
	};
	output = "sorcery:infuser";
}

minetest.register_craft {
	output = "sorcery:displacer";
	recipe = {
		{ingot('platinum'),'sorcery:screw_tungsten',ingot('platinum')};
		{'basic_materials:copper_wire','sorcery:core_syncretic','doors:trapdoor_steel'};
		{ingot('platinum'),'sorcery:screw_tungsten',ingot('platinum')};
	};
	replacements = {
		{'basic_materials:copper_wire','basic_materials:empty_spool'};
	};
}

minetest.register_craft {
	output = "sorcery:displacer_transmit_attune";
	recipe = {
		{ingot('platinum'),'sorcery:screw_tungsten',ingot('platinum')};
		{'sorcery:leyline_stabilizer','sorcery:core_mandatic','sorcery:tuning_disc'};
		{ingot('platinum'),'sorcery:screw_tungsten',ingot('platinum')};
	};
}

minetest.register_craft {
	output = "sorcery:displacer_transmit_gem";
	recipe = {
		{ingot('platinum'),'sorcery:screw_tungsten',ingot('platinum')};
		{'sorcery:leyline_stabilizer','sorcery:core_mandatic','sorcery:gem_ruby'};
		{ingot('platinum'),'sorcery:screw_tungsten',ingot('platinum')};
	};
}

minetest.register_craft {
	output = "sorcery:displacer_receive_attune";
	recipe = {
		{ingot('platinum'),'sorcery:screw_tungsten',ingot('platinum')};
		{'sorcery:inverter_coil','sorcery:core_mandatic','sorcery:tuning_disc'};
		{ingot('platinum'),'sorcery:screw_tungsten',ingot('platinum')};
	};
}

minetest.register_craft {
	output = "sorcery:displacer_receive_gem";
	recipe = {
		{ingot('platinum'),'sorcery:screw_tungsten',ingot('platinum')};
		{'sorcery:inverter_coil','sorcery:core_mandatic','sorcery:gem_ruby'};
		{ingot('platinum'),'sorcery:screw_tungsten',ingot('platinum')};
	};
}

minetest.register_craft {
	output = 'sorcery:raycaster';
	recipe = {
		{'sorcery:gem_amethyst', 'sorcery:gem_amethyst', 'sorcery:gem_amethyst'};
		{ingot('gold'),'sorcery:beam_generator',ingot('gold')};
		{'sorcery:gem_amethyst', 'sorcery:gem_amethyst', 'sorcery:gem_amethyst'};
	};
}

minetest.register_craft {
	output = 'sorcery:tuning_disc';
	recipe = {
		{'','sorcery:gem_emerald',''};
		{'',mtlp('silver','disc'),''};
		{'sorcery:inverter_coil','sorcery:warding_plate','sorcery:inverter_coil'};
	};
}

minetest.register_craft {
	output = 'sorcery:farcaster';
	recipe = {
		{ingot('gold'),ingot('iridium'),ingot('gold')};
		{'sorcery:core_mandatic','default:diamondblock','sorcery:tuning_disc'};
		{ingot('gold'),ingot('iridium'),ingot('gold')};
	};
}

minetest.register_craft {
	output = 'sorcery:portal_node';
	recipe = {
		{ingot('tungsten'),'sorcery:core_mandatic',ingot('tungsten')};
		{ingot('aluminum'),mtlp('platinum','block'),ingot('aluminum')};
		{ingot('tungsten'),'sorcery:core_mandatic',ingot('tungsten')};
	};
}

minetest.register_craft {
	output = 'sorcery:portal_reflector';
	recipe = {
		{'basic_materials:steel_bar',ingot('tin'),'basic_materials:steel_bar'};
		{'sorcery:gem_amethyst','sorcery:inverter_coil','sorcery:gem_amethyst'};
		{'basic_materials:steel_bar','xpanes:bar_flat','basic_materials:steel_bar'};
	}
}

minetest.register_craft {
	output = 'sorcery:portal_pad';
	recipe = {
		{'basic_materials:steel_bar','xpanes:bar_flat','basic_materials:steel_bar'};
		{'sorcery:gem_amethyst','sorcery:beam_generator','sorcery:gem_amethyst'};
		{'basic_materials:steel_bar',ingot('tin'),'basic_materials:steel_bar'};
	}
}

minetest.register_craft {
	output = 'sorcery:gravity_manipulator';
	recipe = {
		{ingot('cobalt'),'sorcery:screw_platinum','basic_materials:silver_wire'};
		{'sorcery:inverter_coil','sorcery:core_counterpraxic',ingot('levitanium')};
		{ingot('cobalt'),'sorcery:screw_platinum','basic_materials:silver_wire'};
	};
}

minetest.register_craft {
	output = 'sorcery:gravitator_off';
	recipe = {
		{ingot('platinum'),'basic_materials:plastic_sheet',ingot('platinum')};
		{'xpanes:pane_flat','sorcery:gravity_manipulator','basic_materials:plastic_sheet'};
		{ingot('platinum'),'basic_materials:plastic_sheet',ingot('platinum')};
	};
}

minetest.register_craft {
	output = 'sorcery:powder_firestorm 5';
	type = 'shapeless';
	recipe = {
		mtlp('lithium','powder'), mtlp('lithium','powder');
		mtlp('silver','powder');
		'basic_materials:oil_extract';
		'sorcery:flame_oil';
		'tnt:gunpowder';
		'farming:mixing_bowl';
	};
	replacements = {
		{'sorcery:flame_oil', 'xdecor:bowl'};
		{'farming:mixing_bowl', 'farming:mixing_bowl'};
	};
}

for i,e in ipairs{'frost','flame','force'} do
	minetest.register_craftitem('sorcery:essence_'..e, {
		description = sorcery.lib.str.capitalize(e) .. ' Essence';
		inventory_image = 'sorcery_essence_'..e..'.png';
		group = { sorcery_elemental_essence = 1 };
		_sorcery = {
			material = {
				sacrifice_value = i ^ 6;
			}
		}
	})
end

minetest.register_craftitem('sorcery:inferno_crystal', {
	-- made with melding wand from ruby, lithium ingot, and gunpowder
	-- under sign of the wyvern or the winged serpent
	inventory_image = 'sorcery_inferno_crystal.png';
	description = 'Inferno Crystal';
	groups = {sorcery_magical = 1, fuel = 1};
	_sorcery = {
		material = {
			gem = true;
			sacrifice_value = 900;
		};
	}
})

minetest.register_craft {
	output = 'sorcery:powder_firestorm 6';
	type = 'shapeless';
	recipe = {'sorcery:inferno_crystal', 'xdecor:hammer'};
	replacements = {
		{'xdecor:hammer','xdecor:hammer'};
		{'sorcery:inferno_crystal', 'sorcery:shard_ruby 5'};
	}
}

minetest.register_craftitem('sorcery:powder_firestorm', {
	inventory_image = 'sorcery_powder_firestorm.png';
	description = 'Firestorm Powder';
	groups = { sorcery_ingredient = 1, fuel = 1 };
})

minetest.register_craft {
	type = 'fuel', burntime = 8 * 15;
	recipe = 'sorcery:powder_firestorm';
};

minetest.register_craft {
	type = 'fuel', burntime = 8 * 85;
	recipe = 'sorcery:inferno_crystal';
	replacement = {{'sorcery:inferno_crystal', 'sorcery:shard_ruby 6'}};
};

minetest.register_craftitem('sorcery:gravity_manipulator', {
	description = 'Gravity Manipulator';
	inventory_image = 'sorcery_gravity_manipulator.png';
	groups = {
		sorcery_magitech = 1;
		sorcery_tech_component = 1;
	};
})


local regtech = function(id, desc, groups, recipe, qty, replacements, props)
	minetest.register_craftitem('sorcery:' .. id,{
		description = desc;
		inventory_image = 'sorcery_'..id..'.png';
		groups = sorcery.lib.tbl.merge({
			sorcery_magitech = 1;
			sorcery_tech_component = 1;
		}, groups or {});
		_sorcery = props;
	})
	if recipe then
		minetest.register_craft {
			output = string.format('sorcery:%s %u', id, qty or 1);
			recipe = recipe;
			replacements = replacements;
		}
	end
end

local regcore = function(core,name)
	regtech('core_'..core, name .. ' Core', {sorcery_magitech_core = 1})
end

local mprop = function(metal, amt)
	local gc, gv
	amt = amt or 1
	if math.floor(amt) ~= amt then
		if amt < 1 then
			gc = math.floor(1 / amt)
		else
			local n = 0
			for i = 2,10 do
				if math.floor(amt * i) == amt * i then
					n = i
					break
				end
			end
			if n == 0 then error "can't determine metal value for item" end
			gc = i
			gv = amt * i
		end
	else
		gc = 1
		gv = amt
	end
	return { material = {
		metal = true; id = metal;
		data = sorcery.data.metals[metal];
		grindcost = gc;
		grindvalue = gv;
		value = amt;
	}}
end

regtech('field_emitter', 'Field Emitter', {metal = 1})
regtech('leyline_stabilizer', 'Leyline Stabilizer', {metal = 1})
regtech('beam_generator', 'Beam Generator', {metal = 1})
regtech('inversion_matrix', 'Inversion Matrix', {metal = 1})
regtech('inverter_coil', 'Inverter Coil', {metal = 1})
regtech('suppression_matrix', 'Suppression Matrix', {metal = 1})
regtech('tuning_disc', 'Tuning Disc', {metal = 1})
	-- used in constructing devices that are subject to attunement wand
regtech('gravity_manipulator', 'Gravity Manipulator', {metal = 1})
regtech('valve','Valve', {metal = 1}, {
	{'','default:bronze_ingot',''};
	{'basic_materials:plastic_sheet','basic_materials:steel_bar','basic_materials:plastic_sheet'};
	{'','default:bronze_ingot',''};
},3,nil, mprop('bronze',2*4,1,2*4))
regtech('pipe','Pipe', {metal = 1},nil, nil, nil, mprop('aluminum', 4))

sorcery.lathe.register_metal {
	metal = 'aluminum';
	output = 'sorcery:pipe';
	tech = 'cut', cost = 8;
	mass = 4;
}

sorcery.lathe.register_metal {
	metal = 'steel';
	output = 'basic_materials:steel_strip';
	tech = 'cut', cost = 2;
	mass = 0.5;
}
sorcery.lathe.register_metal {
	metal = 'copper';
	output = 'basic_materials:copper_strip';
	tech = 'cut', cost = 1;
	mass = 0.5;
}

minetest.register_craft {
	output = 'sorcery:trough';
	recipe = {
		{ingot 'aluminum','',ingot 'aluminum'};
		{ingot 'aluminum','',ingot 'aluminum'};
		{ingot 'aluminum',ingot 'aluminum',ingot 'aluminum'};
	};
}

regtech('infuser_tube', 'Infusion Tube', {metal = 1}, {
	{"basic_materials:copper_strip",'sorcery:infuser_concentrator', "basic_materials:copper_strip"};
	{"", mtlp('copper','disc'), "basic_materials:gold_wire"};
	{"", 'sorcery:pipe', ""};
}, 1, {
	{"basic_materials:gold_wire", "basic_materials:empty_spool"}
})
regtech('infuser_chamber', 'Infuser Chamber', nil, {
	{'default:clay_brick','sorcery:grease_sealant','default:clay_brick'};
	{'default:clay_brick',mtlp('steel','disc'),'default:clay_brick'};
}, 1, {
	{'sorcery:grease_sealant','xdecor:bowl'};
})
regtech('infuser_concentrator', 'Infuser Concentrator', nil, {
	{'basic_materials:steel_wire'};
	{'default:obsidian_shard'};
	{'basic_materials:copper_wire'};
}, 1, {
	{'basic_materials:steel_wire', 'basic_materials:empty_spool'};
	{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
})


regtech('warding_plate', 'Warding Plate', {metal = 1}, {
	{'basic_materials:gold_wire','basic_materials:gold_wire','basic_materials:gold_wire'};
	{'',mtlp('vidrium','block'),''};
	{'basic_materials:gold_wire','basic_materials:gold_wire','basic_materials:gold_wire'};
}, 4, {
	{'basic_materials:gold_wire', 'basic_materials:empty_spool'};
	{'basic_materials:gold_wire', 'basic_materials:empty_spool'};
	{'basic_materials:gold_wire', 'basic_materials:empty_spool'};
	{'basic_materials:gold_wire', 'basic_materials:empty_spool'};
	{'basic_materials:gold_wire', 'basic_materials:empty_spool'};
	{'basic_materials:gold_wire', 'basic_materials:empty_spool'};
})
regtech('ley_puncture', 'Ley Puncture', {metal = 1}, {
	{'default:flint',mtlp('tungsten','disc'),'group:sorcery_ley_cable'};
	{'','group:sorcery_ley_cable',''};
	{'group:sorcery_ley_cable',mtlp('tungsten','disc'),'default:flint'};
})
regtech('radiatic_filament', 'Radiatic Filament', {metal=1},{
	{mtlp('gold','wire'),mtlp('steel','wire'),mtlp('gold','wire')};
	{ingot'tungsten',mtlp('steel','wire'),ingot'tungsten'};
	{mtlp('silver','wire'),mtlp('steel','wire'),mtlp('silver','wire')};
}, 3, {
	{mtlp('steel','wire'), 'basic_materials:empty_spool'};
	{mtlp('steel','wire'), 'basic_materials:empty_spool'};
	{mtlp('steel','wire'), 'basic_materials:empty_spool'};
	{mtlp('silver','wire'), 'basic_materials:empty_spool'};
	{mtlp('silver','wire'), 'basic_materials:empty_spool'};
	{mtlp('gold','wire'), 'basic_materials:empty_spool'};
	{mtlp('gold','wire'), 'basic_materials:empty_spool'};
})
regtech('tacit_couple', 'Tacit Couple', {metal=1}, {
	{mtlp('steel','fragment'),mtlp('copper','wire'),mtlp('steel','fragment')};
	{'sorcery:radiatic_filament', 'basic_materials:steel_bar', 'sorcery:radiatic_filament'};
	{mtlp('steel','fragment'),mtlp('copper','wire'),mtlp('steel','fragment')};
})
regtech('tacit_web', 'Tacit Web', {metal=1},{
	{mtlp('gold',  'fragment'),mtlp('vidrium','wire'),    mtlp('gold',  'fragment')};
	{mtlp('copper','wire'),    mtlp('iridium','fragment'),mtlp('copper','wire')};
	{mtlp('silver','fragment'),mtlp('vidrium','wire'),    mtlp('silver','fragment')};
},1,{
	{mtlp('vidrium','wire'), 'basic_materials:empty_spool'};
	{mtlp('copper','wire'), 'basic_materials:empty_spool'};
	{mtlp('copper','wire'), 'basic_materials:empty_spool'};
	{mtlp('vidrium','wire'), 'basic_materials:empty_spool'};
})
regtech('aetherial_harmonizer', 'Aetherial Harmonizer', {metal=1}, {
	{ingot'brass'};
	{mtlp('tungsten','disc')};
	{ingot'brass'};
})
regtech('aether_coruscator', 'Aether Coruscator', {metal=1}, {
	{'sorcery:aetherial_harmonizer','','sorcery:aetherial_harmonizer'};
	{ingot'aluminum','sorcery:radiatic_filament',ingot'aluminum'};
	{ingot'aluminum',ingot'aluminum',ingot'aluminum'};
})
regtech('pulse_rectifier', 'Pulse Rectifier', {metal = 1})
regtech('current_felicitator', 'Current Felicitator', {metal = 1}, {
	{'basic_materials:silver_wire','basic_materials:silver_wire','basic_materials:silver_wire'};
	{'sorcery:cobalt_ingot','sorcery:inversion_matrix','sorcery:cobalt_ingot'};
	{'default:bronze_ingot','sorcery:platinum_ingot','default:bronze_ingot'};
},1,{
	{'basic_materials:silver_wire', 'basic_materials:empty_spool'};
	{'basic_materials:silver_wire', 'basic_materials:empty_spool'};
	{'basic_materials:silver_wire', 'basic_materials:empty_spool'};
})
regtech('axial_dispulsor', 'Axial Dispulsor',{metal=1})
regtech('conduction_plate', 'Conduction Plate', {metal = 1}, {
	{'','sorcery:disc_copper',''};
	{'','stairs:slab_stone',''};
	{'basic_materials:copper_wire','basic_materials:steel_bar','basic_materials:copper_wire'};
}, 1, {
	{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
	{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
})

regtech('catalytic_convector', 'Catalytic Convector', {metal = 1}, {
	{'basic_materials:heating_element', 'default:gold_ingot', 'basic_materials:heating_element'};
	{'default:mese_crystal','default:mese_crystal','default:mese_crystal'};
	{'sorcery:tungsten_ingot','sorcery:oil_flame','sorcery:tungsten_ingot'};
}, 1, {
	{'sorcery:oil_flame',sorcery.register.residue.db['sorcery:oil_flame']};
})

regtech('herb_crusher', 'Herb Crusher', nil, {
	{'group:sorcery_screw',ingot'copper','group:sorcery_screw'};
	{'group:wood','basic_materials:steel_bar','group:wood'};
	{'group:wood','xpanes:chainlink_flat','group:wood'};
}, 1)


regcore('syncretic', 'Syncresis')
regcore('mandatic', 'Mandatic')
-- regcore('praxic', 'Praxis')
regcore('counterpraxic', 'Counterpraxis')


--- possible other components
-- felicitator
-- flux rectifier
-- flux suppressor
-- flux amplifier
-- tacit web
-- radiatic filament
-- radia transducer
-- transductive coil
-- affine macerator
-- state extender
-- state disruptor
-- axial dispulsor
-- aether coruscator

minetest.register_craft {
	output = 'sorcery:leyline_stabilizer';
	recipe = {
		{'basic_materials:copper_wire','group:sorcery_ley_cable','basic_materials:copper_wire'};
		{'sorcery:grease_neutralizing','group:sorcery_ley_cable','sorcery:grease_neutralizing'};
		{'basic_materials:copper_wire','group:sorcery_ley_cable','basic_materials:copper_wire'};
	};
	replacements = {
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
		{'sorcery:grease_neutralizing', 'xdecor:bowl'};
		{'sorcery:grease_neutralizing', 'xdecor:bowl'};
	};
}

minetest.register_craft {
	output = 'sorcery:beam_generator';
	recipe = {
		{'xpanes:bar_flat','xpanes:pane_flat','xpanes:bar_flat'};
		{'sorcery:screw_aluminum','sorcery:gem_sapphire','sorcery:screw_aluminum'};
		{'xpanes:bar_flat','sorcery:gem_luxite','xpanes:bar_flat'};
	};
}

minetest.register_craft {
	output = 'sorcery:suppression_matrix';
	recipe = {
		{'sorcery:fragment_electrum','basic_materials:steel_strip','sorcery:fragment_cobalt'};
		{'basic_materials:copper_strip','xpanes:bar_flat','basic_materials:copper_strip'};
		{'sorcery:fragment_cobalt','basic_materials:steel_strip','sorcery:fragment_electrum'};
	};
}

minetest.register_craft {
	output = 'sorcery:core_counterpraxic';
	recipe = {
		{'sorcery:gem_ruby_shard','sorcery:tungsten_ingot','sorcery:gem_ruby_shard'};
		{'sorcery:tungsten_ingot','sorcery:gem_emerald','sorcery:tungsten_ingot'};
		{'sorcery:gem_ruby_shard','sorcery:tungsten_ingot','sorcery:gem_ruby_shard'};
	};
}

minetest.register_craft {
	output = 'sorcery:core_syncretic';
	recipe = {
		{'sorcery:gem_sapphire_shard','default:gold_ingot','sorcery:gem_sapphire_shard'};
		{'default:gold_ingot','default:diamond','default:gold_ingot'};
		{'sorcery:gem_sapphire_shard','default:gold_ingot','sorcery:gem_sapphire_shard'};
	};
}

minetest.register_craft {
	output = 'sorcery:core_mandatic';
	recipe = {
		{'sorcery:gem_amethyst_shard','sorcery:silver_ingot','sorcery:gem_amethyst_shard'};
		{'sorcery:silver_ingot','sorcery:gem_sapphire','sorcery:silver_ingot'};
		{'sorcery:gem_amethyst_shard','sorcery:silver_ingot','sorcery:gem_amethyst_shard'};
	};
}

minetest.register_craft {
	output = 'sorcery:inverter_coil';
	recipe = {
		{'sorcery:screw_platinum','basic_materials:steel_wire','sorcery:screw_platinum'};
		{'basic_materials:copper_wire','default:tin_ingot','basic_materials:copper_wire'};
		{'sorcery:screw_platinum','basic_materials:steel_wire','sorcery:screw_platinum'};
	};
	replacements = {
		{'basic_materials:steel_wire', 'basic_materials:empty_spool'};
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
		{'basic_materials:steel_wire', 'basic_materials:empty_spool'};
	};
}

minetest.register_craft {
	output = 'sorcery:inversion_matrix';
	recipe = {
		{'','sorcery:inverter_coil','basic_materials:gold_wire'};
		{'sorcery:inverter_coil','sorcery:leyline_stabilizer','sorcery:inverter_coil'};
		{'basic_materials:gold_wire','sorcery:inverter_coil',''};
	};
	replacements = {
		{'basic_materials:gold_wire', 'basic_materials:empty_spool'};
		{'basic_materials:gold_wire', 'basic_materials:empty_spool'};
	};
}


minetest.register_craft {
	output = 'sorcery:field_emitter';
	recipe = {
		{'basic_materials:steel_bar','xpanes:pane_flat','basic_materials:steel_bar'};
		{'sorcery:beam_generator','sorcery:leyline_stabilizer','sorcery:beam_generator'};
		{'sorcery:beam_generator','basic_materials:copper_wire','sorcery:beam_generator'};
	};
	replacements = {
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
	};
}

minetest.register_craft {
	output = 'sorcery:emitter_barrier';
	recipe = {
		{'sorcery:suppression_matrix','sorcery:suppression_matrix','sorcery:suppression_matrix'};
		{'sorcery:field_emitter','sorcery:core_counterpraxic','sorcery:inverter_coil'};
		{'default:tin_ingot','default:tin_ingot','default:tin_ingot'};
	};
}

minetest.register_craft {
	output = 'sorcery:generator';
	recipe = {
		{'sorcery:aluminum_ingot','sorcery:aluminum_ingot','sorcery:aluminum_ingot'};
		{'default:bronze_ingot','basic_materials:copper_wire','default:bronze_ingot'};
		{'default:steel_ingot','default:furnace','default:steel_ingot'};
	};
	replacements = {
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
	};
}

---- writing
minetest.register_craftitem('sorcery:ink', {
	description = "Ink";
	inventory_image = "sorcery_ink_bottle.png";
	groups = { liquid = 1; ink = 1; }
})

minetest.register_craftitem('sorcery:erasure_fluid', {
	description = "Erasure Fluid";
	inventory_image = "sorcery_erasure_fluid_bottle.png";
	groups = { liquid = 1; sorcery_writingstand_operand = 1; }
})

minetest.register_craft {
	output = 'sorcery:ink';
	type = 'shapeless';
	recipe = {
		'sorcery:potion_water';
		'dye:black', 'dye:black', 'dye:black';
		'xdecor:honey';
		'basic_materials:oil_extract';
		'basic_materials:oil_extract';
	};
}

minetest.register_craft {
	output = 'sorcery:erasure_fluid 3';
	type = 'shapeless';
	recipe = {
		'sorcery:potion_water';
		'sorcery:potion_water';
		'sorcery:potion_water';
		'basic_materials:oil_extract';
		'sorcery:powder_aluminum';
		'sorcery:powder_tin';
	}
}

minetest.register_craft {
	output = 'sorcery:erasure_fluid 3';
	type = 'shapeless';
	recipe = {
		'vessels:glass_bottle';
		'vessels:glass_bottle';
		'vessels:glass_bottle';
		'bucket:bucket_water';
		'basic_materials:oil_extract';
		'sorcery:powder_aluminum';
		'sorcery:powder_tin';
	};
	replacements = {
		{'bucket:bucket_water','bucket:bucket_empty'};
	};
}
minetest.register_craft {
	output = 'sorcery:writing_stand';
	recipe = {
		{'screwdriver:screwdriver','default:book','default:gold_ingot'};
		{'group:sorcery_screw','group:wood','group:sorcery_screw'};
		{'group:wood','default:stick','group:wood'};
	};
	replacements = {
		{'screwdriver:screwdriver','screwdriver:screwdriver'};
	};
};

sorcery.register.residue.link('sorcery:ink','vessels:glass_bottle')
sorcery.register.residue.link('sorcery:erasure_fluid','vessels:glass_bottle')

---- altar
minetest.register_craftitem('sorcery:candle', {
	-- TODO make candle node
	inventory_image = 'sorcery_candle.png';
	description = 'Votive Candle';
	groups = {
		candle = 1;
	};
})

minetest.register_craft {
	recipe = {
		{'farming:string'};
		{'basic_materials:paraffin'};
		{'basic_materials:paraffin'};
	};
	output = "sorcery:candle";
}

minetest.register_craft {
	recipe = {
		{'sorcery:candle','sorcery:candle','sorcery:candle'};
		{'sorcery:coin_gold','stairs:slab_stone','sorcery:coin_bronze'};
		{'','sorcery:coin_tin',''};
	};
	output = "sorcery:altar";
}
minetest.clear_craft { output = 'morelights:bulb'; }
minetest.register_craft {
	recipe = {
		{'xpanes:pane_flat', 'sorcery:gem_luxite_shard', 'xpanes:pane_flat'};
		{'sorcery:gem_luxite_shard', 'default:mese_crystal_fragment','sorcery:gem_luxite_shard'};
		{'xpanes:pane_flat', 'basic_materials:copper_wire', 'xpanes:pane_flat'};
	};
	replacements = {
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
	};
	output = 'morelights:bulb 4';
}

local auxdyes = {
	[{'vidrium','iridium','vidrium'}]= 'violet';
	[{'iridium','vidrium','iridium'}]= 'mulberry';
	[{'cobalt','iridium','cobalt'}  ]= 'magenta';
	[{'iridium','cobalt','iridium'} ]= 'fuchsia';
	[{'iridium','gold','iridium'}   ]= 'rose';
	[{'iridium','copper','iridium'} ]= 'crimson';
	[{'aluminum','tin','aluminum'}  ]= 'pink';
	[{'copper','gold','copper'}     ]= 'orange';
	[{'bronze','gold','bronze'}     ]= 'amber';
	[{'bronze','copper','bronze'}   ]= 'brown';
	[{'vidrium','gold','vidrium'}   ]= 'lime';
	[{'vidrium','cobalt','vidrium'} ]= 'cerulean';
	[{'vidrium','cobalt','levitanium'}] = 'azure';
}

for metals,color in pairs(auxdyes) do
	local dye = 'dye:' .. color
	if minetest.registered_items[dye] then
		local pd = {} for i=1,3 do
			pd[i] = mtlp(metals[i],'powder')
		end
		minetest.register_craft {
			output = dye .. ' 4';
			recipe = {
				{'',    pd[2],                     ''};
				{pd[1],'basic_materials:paraffin', pd[3]};
				{'',   'bucket:bucket_water',      ''};
			};
		}
	end
end

local potion_auto_recipe = function(id, substance, tools, container)
	local recipe = tools
	local replace = {}
	local batches = 1
	for _,v in pairs(tools) do
		replace[#replace + 1] = {v,v}
	end

	if substance.core and #substance.core > 0 then
		batches = #substance.core
		recipe = sorcery.lib.tbl.append(recipe, substance.core)
	elseif container then
		recipe[#recipe + 1] = container
	end
	if substance.mix and #substance.mix > 0 then
		recipe = sorcery.lib.tbl.append(recipe, substance.mix)
		for _,r in pairs(substance.mix) do
			if sorcery.register.residue.db[r] then
				replace[#replace + 1] = {
					r, sorcery.register.residue.db[r]
				}
			end
		end
	end

	minetest.register_craft {
		type = 'shapeless';
		recipe = recipe;
		replacements = replace;
		output = id .. ' ' .. batches;
	}
end
-- auto-generate recipes for potionmaking oils
for n,v in pairs(sorcery.data.oils) do
	if (v.core and #v.core > 0) or (v.mix and #v.mix > 0) then
		local id = 'sorcery:oil_' .. n
		potion_auto_recipe(id,v,{'farming:mortar_pestle'},'xdecor:bowl')
	end
end

for n,v in pairs(sorcery.data.greases) do
	if (v.core and #v.core > 0) or (v.mix and #v.mix > 0) then
		local id = 'sorcery:grease_' .. n
		potion_auto_recipe(id,v,{'farming:mixing_bowl'},'xdecor:bowl')
	end
end

sorcery.lathe.register_metal {
	metal = 'steel';
	output = 'basic_materials:steel_bar';
	tech = 'cut', cost = 3;
	mass = 2;
}