


if mods["Yuoki"] then
	omni.crystal.add_crystal("y-res1","Durotal")
	omni.crystal.add_crystal("y-res2","Nuatreel")
end

if mods["bobplates"] then
	omni.lib.add_recipe_ingredient("omni-inserter",{type="item",name="brass-gear-wheel",amount=3})
	omni.lib.add_recipe_ingredient("crystal-reactor",{type = "item", name = "steel-pipe", amount = 10})
end

omni.crystal.add_crystal("iron-ore","Iron")
omni.crystal.add_crystal("copper-ore","Copper")
omni.crystal.add_crystal("uranium-ore","Uranium")

require("prototypes.recipes.bobs")
require("prototypes.recipes.angels")

local salt_omnide_icon = function(metal)
	local nr = 5
    --Build the icons table
    local icons = {}
	icons[#icons+1] = {icon = "__omnimatter_crystal__/graphics/icons/omnide-salt.png"}
	icons[#icons+1] = {icon = data.raw.item[metal].icon,scale=0.4,shift={-10,10}}
    return icons
end

if omni.lib.end_with("test","st") then log("end function work") end
local crystalines = {}
if not mods["angelsrefining"] then
	local turn_to_plate = {}
	local cat = {
		type = "item-subgroup",
		name = "omnide-salts",
		group = "omnicrystal",
		order = "aa",
	}
	crystalines[#crystalines+1]=cat
	for _,rec in pairs(data.raw.recipe) do
		if omni.lib.end_with(rec.name,"-omnitraction") then
			local ore = rec.results[1].name
			local plate = ""
			if ore == "quartz" then
				plate = "quartz"
			elseif ore == "bauxite-ore" then
				plate = "aluminium-plate"
			elseif ore == "rutile-ore" then
				plate = "titanium-plate"
			elseif ore == "uranium-ore" then
				plate = "uranium-235"
			else				
				plate = string.sub(ore,1,string.len(ore)-string.len("-ore")).."-plate"
			end
			rec.results[1].name=plate
			rec.icon=data.raw.item[plate].icon
			rec.localised_name = {"recipe-name.item", {"item-name."..plate}}
			local tier = omni.matter.ore_tier(ore)
			omni.lib.add_unlock_recipe("crystallology-"..tier+1, rec.name)
			log(ore)
			local ic = salt_omnide_icon(ore)
			local solution = {
				type = "recipe",
				name = ore.."-salting",
				localised_name = {"recipe-name.omnide-salting", {"item-name."..ore}},
				localised_description = {"recipe-description.pure_extraction", {"item-name."..ore}},
				category = "omniplant",
				subgroup = "omnide-salts",
				enabled = false,
				ingredients = {
				{type="item",name=ore,amount=1},
				{type="fluid",name="hydromnic-acid",amount=120},
				},
				order = "a[angelsore1-crushed]",
				icons = ic,
				results = {
				{type="item",name=ore.."-omnide-salt",amount=1},
				},
				energy_required = 5,
			}
			crystalines[#crystalines+1]=solution
			omni.lib.add_unlock_recipe("crystallology-"..tier+1, ore.."-salting")

		end
	end
	data:extend(crystalines)
end
--mni.matter.ore_tier

--omnimatter_crystal
data.raw["inserter"]["filter-inserter"].hand_base_picture.filename="__omnimatter_crystal__/graphics/inserter/filter-inserter-hand-base.png"
data.raw["inserter"]["filter-inserter"].hand_base_picture.hr_version.filename="__omnimatter_crystal__/graphics/inserter/hr-filter-inserter-hand-base.png"
data.raw["inserter"]["filter-inserter"].hand_closed_picture.filename="__omnimatter_crystal__/graphics/inserter/filter-inserter-hand-closed.png"
data.raw["inserter"]["filter-inserter"].hand_closed_picture.hr_version.filename="__omnimatter_crystal__/graphics/inserter/hr-filter-inserter-hand-closed.png"
data.raw["inserter"]["filter-inserter"].hand_open_picture.filename="__omnimatter_crystal__/graphics/inserter/filter-inserter-hand-open.png"
data.raw["inserter"]["filter-inserter"].hand_open_picture.hr_version.filename="__omnimatter_crystal__/graphics/inserter/hr-filter-inserter-hand-open.png"
data.raw["inserter"]["filter-inserter"].platform_picture.sheet.filename="__omnimatter_crystal__/graphics/inserter/filter-inserter-platform.png"
data.raw["inserter"]["filter-inserter"].platform_picture.sheet.hr_version.filename="__omnimatter_crystal__/graphics/inserter/hr-filter-inserter-platform.png"
data.raw["inserter"]["filter-inserter"].icon="__omnimatter_crystal__/graphics/icons/filter-inserter.png"
data.raw.item["filter-inserter"].icon = "__omnimatter_crystal__/graphics/icons/filter-inserter.png"
