--require("__skewer_planet_vesta__/prototypes/modified_technologies.lua")
local function get_gas_name(name, alternative)
  if settings.startup["ske_vesta_gases"].value then
    return name
  else
    return alternative
  end
end
data:extend({
--Unlock the Planet
  {
    type = "technology",
    name = "planet-discovery-vesta",
    icons = util.technology_icon_constant_planet("__skewer_planet_vesta_assets_2__/graphics/technology/vesta.png"),
    icon_size = 256,
    essential = true,
    effects =
    {
		{ type = "unlock-space-location", space_location = "vesta", use_icon_overlay_constant = true },
		{ type = "unlock-recipe", recipe = "vesta-foundation"},
		{ type = "unlock-recipe", recipe = "ske-h2o"},
		{ type = "unlock-recipe", recipe = "ske-carbon-seperation"},
		{ type = "unlock-recipe", recipe = "ske-carbon-super-cooling"},
		{ type = "unlock-recipe", recipe = "ske-coal-mineralization"},
		{ type = "unlock-recipe", recipe = "ske-carbon-mineralization"},
    },
    prerequisites = {"cryogenic-science-pack", "fusion-reactor", "biochamber" },
    unit =
    {
      count = 1500,
      ingredients =
		{
			{"automation-science-pack", 1},
			{"logistic-science-pack", 1},
			{"chemical-science-pack", 1},
			{"military-science-pack", 1},
			{"utility-science-pack", 1},
			{"space-science-pack", 1},
		},
      time = 75
    }
  }, 
  
--==========================================---
--========== Techs exclusive to the Planet ==========---
--==========================================---
-- Stage 1, Algea; a new way to cultivate resources
  {
    type = "technology",
    name = "s1_dueterium",
    prerequisites = {"s1_algea_discovery" },
    icon = "__skewer_planet_vesta_assets__/graphics/technology/tritium_deuterium_production.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "nutrients-from-co2" },
		{ type = "unlock-recipe", recipe = "lithium-brine" },
--		{ type = "unlock-recipe", recipe = "ske_lithium" },
		{ type = "unlock-recipe", recipe = "tritium" },
--		{ type = "unlock-recipe", recipe = "ske_heavy_water" },
--		{ type = "unlock-recipe", recipe = "ske_hot_heavy_water" },
		{ type = "unlock-recipe", recipe = "deuterium" },
    },
    research_trigger =
    {
      type = "craft-item",
      item = "vesta-foundation",
      count = 25
    }
  },
-- Calcized Smelting
  {
    type = "technology",
    name = "s1_cluster_processing",
    icon = "__skewer_planet_vesta_assets_2__/graphics/technology/cluster-processing.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "calcized-iron-plate" },
		{ type = "unlock-recipe", recipe = "calcized-copper-plate" },
    },
    prerequisites = {"s1_algea_discovery" },
    research_trigger =
    {
      type = "mine-entity",
      entity = "vesta_rock_huge"
    }
  },
  {
    type = "technology",
    name = "s1_iridium",
    prerequisites = {"s1_dueterium" },
    icon = "__skewer_planet_vesta_assets__/graphics/technology/iridium_processing.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "vesta-electrolyzer" },
		{ type = "unlock-recipe", recipe = "iridium-plate" },
    },
    research_trigger =
    {
      type = "craft-fluid",
      fluid = "deuterium",
      count = 500
    }
  },
  {
    type = "technology",
    name = "s1_algea_discovery",
    prerequisites = {"planet-discovery-vesta" },
    icon = "__skewer_planet_vesta_assets__/graphics/technology/filter.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "ske_algea_water" },
--		{ type = "unlock-recipe", recipe = "ske_water_filter" },
		{ type = "unlock-recipe", recipe = "ske_co2_filter_carbon" },
		{ type = "unlock-recipe", recipe = "ske_co2_filter_oxygen" },
    },
    research_trigger =
    {
      type = "craft-fluid",
      fluid = get_gas_name("vesta_carbon", "carbon-gas"),
      count = 1000
    }
  },
  {
    type = "technology",
    name = "s1_gas_manipulation_science_pack",
    prerequisites = {"s1_algea_extracting"},
    icon = "__skewer_planet_vesta_assets__/graphics/technology/gas-manipulation-science-pack.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "gas-manipulation-science-pack" },
		{ type = "unlock-recipe", recipe = "steel-from-iron-algea" },
		{ type = "unlock-recipe", recipe = "ske_crude_solution" },
		{ type = "unlock-recipe", recipe = "ske-rocket-fuel-from-vesta" },
		{ type = "unlock-recipe", recipe = "ske-lds-from-vesta" },
		{ type = "unlock-recipe", recipe = "ske-processors-from-lithium" },
		{ type = "unlock-recipe", recipe = "ske_supermagnetic" },
    },
    research_trigger =
    {
      type = "craft-item",
      item = "supermagnet",
      count = 1
    }
  },
--=====================--
-- REWARD TECHNOLOGIES --
--=====================--
-- Fusion Enhancements
  {
    type = "technology",
    name = "s2_fusion_enhancements",
    prerequisites = {"s1_gas_manipulation_science_pack"},
    icon = "__skewer_planet_vesta_assets__/graphics/technology/plasma_handling.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "magnetic-pipe" },
		{ type = "unlock-recipe", recipe = "ske_dt_fuel" },
		{ type = "unlock-recipe", recipe = "ske_dt_fuel_container" },
    },
	unit = { 
	count = 500,
	ingredients =
		{
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1},
        {"chemical-science-pack", 1},
        {"production-science-pack", 1},
        {"utility-science-pack", 1},
        {"electromagnetic-science-pack", 1},
        {"gas-manipulation-science-pack", 1}
		},
		time = 60
	}
  },
-- Fusion Robots
  {
    type = "technology",
    name = "s2_fusion_robots",
    prerequisites = {"s1_gas_manipulation_science_pack", "s2_fusion_enhancements"},
    icon = "__skewer_planet_vesta_assets__/graphics/technology/fusion_robotics.png",
    icon_size = 128,
    effects =
    {
		{ type = "unlock-recipe", recipe = "ske_fusion_framework" },
		{ type = "unlock-recipe", recipe = "fusion-construction-robot" },
		{ type = "unlock-recipe", recipe = "fusion-logistic-robot" },
    },
	unit = { 
	count = 750,
	ingredients =
		{
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1},
        {"chemical-science-pack", 1},
        {"production-science-pack", 1},
        {"utility-science-pack", 1},
        {"electromagnetic-science-pack", 1},
        {"gas-manipulation-science-pack", 1}
		},
		time = 60
	}
  },
-- Combustion Furnace
  {
    type = "technology",
    name = "s2_plateworkings",
    prerequisites = {"s1_gas_manipulation_science_pack"},
    icon = "__skewer_planet_vesta_assets__/graphics/technology/CombustionFurnace_manual.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "vesta-combustion-furnace" },
		{ type = "unlock-recipe", recipe = "ske-water-electrolysis" },
		{ type = "unlock-recipe", recipe = "ske_cf_copper_hyd" },
		{ type = "unlock-recipe", recipe = "ske_cf_copper_oxy" },
		{ type = "unlock-recipe", recipe = "ske_cf_iron_hyd" },
		{ type = "unlock-recipe", recipe = "ske_cf_iron_oxy" },
		{ type = "unlock-recipe", recipe = "ske_cf_steel_hyd" },
		{ type = "unlock-recipe", recipe = "ske_cf_steel_oxy" },
    },
	unit =
	{
	count = 500,
	ingredients =
		{
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1},
        {"chemical-science-pack", 1},
        {"production-science-pack", 1},
        {"utility-science-pack", 1},
        {"electromagnetic-science-pack", 1},
        {"gas-manipulation-science-pack", 1}
		},
		time = 60
	}
  },
-- Increase belt stacking by one
  {
    type = "technology",
    name = "transport-belt-capacity-vesta",
    localised_description = {"technology-description.belt-capacity"},
    icons = util.technology_icon_constant_stack_size("__space-age__/graphics/technology/transport-belt-capacity.png"),
    effects =
    {
      {
        type = "belt-stack-size-bonus",
        modifier = 1
      },
      {
        type = "inserter-stack-size-bonus",
        modifier = 1
      }
    },
    prerequisites = {"transport-belt-capacity-2", "s1_gas_manipulation_science_pack"},
    unit =
    {
      count = 5000,
      ingredients =
      {
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1},
        {"chemical-science-pack", 1},
        {"production-science-pack", 1},
        {"utility-science-pack", 1},
        {"space-science-pack", 1},
        {"agricultural-science-pack", 1},
        {"gas-manipulation-science-pack", 1}
      },
      time = 180
    },
    upgrade = true
  },
-- Increase worker robot storage capacity by 1
  {
    type = "technology",
    name = "worker-robots-storage-vesta",
    icons = util.technology_icon_constant_capacity("__base__/graphics/technology/worker-robots-storage.png"),
    effects =
    {
      {
        type = "worker-robot-storage",
        modifier = 1
      }
    },
    prerequisites = {"worker-robots-storage-3", "s1_gas_manipulation_science_pack"},
    unit =
    {
      count = 2500,
      ingredients =
      {
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1},
        {"chemical-science-pack", 1},
        {"production-science-pack", 1},
        {"utility-science-pack", 1},
        {"space-science-pack", 1},
        {"agricultural-science-pack", 1},
        {"gas-manipulation-science-pack", 1}
      },
      time = 180
    },
    upgrade = true
  },
})

if mods["vanilla_galore_continued"] and mods["space_age_galore"]
then
data:extend({
	{
	type = "technology",
	name = "s2_intermediate_productivity",
	icon = "__skewer_planet_vesta_assets__/graphics/technology/intermediate_productivity.png",
	icon_size = 256,
	effects =
	{
		{ type = "change-recipe-productivity", recipe = "iron-gear-wheel", change = 0.1 },
		{ type = "change-recipe-productivity", recipe = "iron-stick", change = 0.1 },
		{ type = "change-recipe-productivity", recipe = "copper-cable", change = 0.1 },
		{ type = "change-recipe-productivity", recipe = "casting-iron-stick", change = 0.1 },
		{ type = "change-recipe-productivity", recipe = "casting-iron-gear-wheel", change = 0.1 },
		{ type = "change-recipe-productivity", recipe = "casting-copper-cable", change = 0.1 },
-- Space Age Galore and Vanilla Galore)
		{ type = "change-recipe-productivity", recipe = "vgal-steel-plate-iron-gear-wheel", change = 0.1 },
		{ type = "change-recipe-productivity", recipe = "vgal-steel-plate-iron-stick", change = 0.1 },
		{ type = "change-recipe-productivity", recipe = "vgal-holmium-solution-copper-cable", change = 0.1 },
	},
    prerequisites = {"s1_gas_manipulation_science_pack"},
	unit =
		{
		count_formula = "1.5^L*2500",
		ingredients =
		{
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1},
        {"chemical-science-pack", 1},
        {"production-science-pack", 1},
        {"gas-manipulation-science-pack", 1}
		},
		time = 90
		},
	max_level = "infinite",
	upgrade = true
	},
})
else
data:extend({
	{
	type = "technology",
	name = "s2_intermediate_productivity",
	icon = "__skewer_planet_vesta_assets__/graphics/technology/intermediate_productivity.png",
	icon_size = 256,
	effects =
	{
		{ type = "change-recipe-productivity", recipe = "iron-gear-wheel", change = 0.1 },
		{ type = "change-recipe-productivity", recipe = "iron-stick", change = 0.1 },
		{ type = "change-recipe-productivity", recipe = "copper-cable", change = 0.1 },
		{ type = "change-recipe-productivity", recipe = "casting-iron-stick", change = 0.1 },
		{ type = "change-recipe-productivity", recipe = "casting-iron-gear-wheel", change = 0.1 },
		{ type = "change-recipe-productivity", recipe = "casting-copper-cable", change = 0.1 },
	},
    prerequisites = {"s1_gas_manipulation_science_pack"},
	unit =
		{
		count_formula = "1.5^L*2500",      
		ingredients =
		{
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1},
        {"chemical-science-pack", 1},
        {"production-science-pack", 1},
        {"gas-manipulation-science-pack", 1}
		},
		time = 90
		},
	max_level = "infinite",
	upgrade = true
	},
})
end

-- Krastorio 2 Spaced Out Rare Metals Algea
if mods["Krastorio2-spaced-out"]
then
data:extend({
  {
    type = "technology",
    name = "s1_algea_culturing",
    prerequisites = {"s1_algea_discovery" },
    icon = "__skewer_planet_vesta_assets__/graphics/technology/algea_culturing.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "ske_algea_clump_iron" },
		{ type = "unlock-recipe", recipe = "ske_algea_clump_copper" },
		{ type = "unlock-recipe", recipe = "ske_algea_clump_stonite" },
		{ type = "unlock-recipe", recipe = "ske_methane_petro" },
		{ type = "unlock-recipe", recipe = "ske_algea_rare_metals_irritation" },
    },
    research_trigger =
    {
      type = "craft-fluid",
      fluid = "ske_algea_water",
      count = 15000
    }
  },
  {
    type = "technology",
    name = "s1_algea_extracting",
    prerequisites = {"s1_algea_culturing", "s1_iridium"},
    icon = "__skewer_planet_vesta_assets_2__/graphics/technology/Electrolyzer.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "supermagnet" },
		{ type = "unlock-recipe", recipe = "ske-algea-iron-electrolysis" },
		{ type = "unlock-recipe", recipe = "ske-algea-copper-electrolysis" },
		{ type = "unlock-recipe", recipe = "ske-algea-stone-electrolysis" },
		{ type = "unlock-recipe", recipe = "ske_algea_rare_metals_activation" },
    },
    research_trigger =
    {
      type = "craft-item",
      item = "vesta-electrolyzer",
      count = 1
    }
  },
})
else
data:extend({
  {
    type = "technology",
    name = "s1_algea_culturing",
    prerequisites = {"s1_algea_discovery" },
    icon = "__skewer_planet_vesta_assets__/graphics/technology/algea_culturing.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "ske_algea_clump_iron" },
		{ type = "unlock-recipe", recipe = "ske_algea_clump_copper" },
		{ type = "unlock-recipe", recipe = "ske_algea_clump_stonite" },
    },
    research_trigger =
    {
      type = "craft-fluid",
      fluid = "ske_algea_water",
      count = 15000
    }
  },
  {
    type = "technology",
    name = "s1_algea_extracting",
    prerequisites = {"s1_algea_culturing", "s1_iridium"},
    icon = "__skewer_planet_vesta_assets__/graphics/technology/Electrolysis.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "supermagnet" },
		{ type = "unlock-recipe", recipe = "ske-algea-iron-electrolysis" },
		{ type = "unlock-recipe", recipe = "ske-algea-copper-electrolysis" },
		{ type = "unlock-recipe", recipe = "ske-algea-stone-electrolysis" },
		{ type = "unlock-recipe", recipe = "ske_methane_petro" },
    },
    research_trigger =
    {
      type = "craft-item",
      item = "vesta-electrolyzer",
      count = 1
    }
  },
})
end
data:extend({
  {
    type = "technology",
    name = "ske_fusion_thruster",
    prerequisites = {"s1_gas_manipulation_science_pack", "s2_fusion_enhancements" },
    icon = "__skewer_planet_vesta_assets__/graphics/technology/fusion-thruster.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "ske_fusion_thruster" },
		{ type = "unlock-recipe", recipe = "fluorofuel" },
		{ type = "unlock-recipe", recipe = "plasmafuel" },
    },
	unit =
	{
	count = 2000,
	ingredients =
		{
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1},
        {"chemical-science-pack", 1},
        {"production-science-pack", 1},
        {"utility-science-pack", 1},
        {"electromagnetic-science-pack", 1},
        {"gas-manipulation-science-pack", 1}
		},
		time = 90
	}
  },
  {
    type = "technology",
    name = "fusion-missile",
    prerequisites = {"s1_gas_manipulation_science_pack", "s2_fusion_enhancements" },
    icon = "__skewer_planet_vesta_assets_2__/graphics/technology/fusion-missile.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "fusion-missile" },
    },
	unit =
	{
	count = 1000,
	ingredients =
		{
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1},
        {"chemical-science-pack", 1},
        {"production-science-pack", 1},
        {"utility-science-pack", 1},
        {"electromagnetic-science-pack", 1},
        {"gas-manipulation-science-pack", 1}
		},
		time = 90
	}
  },
})

if mods["corrundum"]
then
else
data:extend({
-- Hydrogen Sulfide processing for offworld
  {
    type = "technology",
    name = "hydrogen-sulfide",
    icon = "__skewer_planet_vesta_assets_2__/graphics/technology/hydrogen-sulfide.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "hydrogen-sulfide" },
    },
    prerequisites = {"s1_gas_manipulation_science_pack" },
	unit =
	{
	count = 2000,
	ingredients =
		{
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1},
        {"chemical-science-pack", 1},
        {"production-science-pack", 1},
        {"utility-science-pack", 1},
        {"electromagnetic-science-pack", 1},
        {"gas-manipulation-science-pack", 1}
		},
		time = 60
	}
  },
-- Carbon Dioxide processing for offworld
  {
    type = "technology",
    name = "carbon-dioxide",
    icon = "__skewer_planet_vesta_assets_2__/graphics/technology/carbon-dioxide-production.png",
    icon_size = 256,
    effects =
    {
		{ type = "unlock-recipe", recipe = "carbon-dioxide" },
		{ type = "unlock-recipe", recipe = "carbon-dioxide-2" },
    },
    prerequisites = {"s1_gas_manipulation_science_pack" },
	unit =
	{
	count = 1500,
	ingredients =
		{
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1},
        {"chemical-science-pack", 1},
        {"production-science-pack", 1},
        {"utility-science-pack", 1},
        {"electromagnetic-science-pack", 1},
        {"gas-manipulation-science-pack", 1}
		},
		time = 30
	}
  },
})
end