tech_robomodding_m = {
	cost = @tier2cost1
	area = engineering
	tier = 1
	category = { industry }
	prerequisites = { "tech_powered_exoskeletons" }
	weight = @tier2weight1

	feature_flags = {
		modify_robots
	}

	modifier = {
		pop_environment_tolerance = 0.05
		leader_lifespan_add = 20
	}

	potential = {
		OR = {
			is_machine_empire = yes
			is_individual_machine = yes
			is_hive_empire_with_machines = yes
		}
	}

	weight_modifier = {

	}
	ai_weight = {
		factor = @robots_ai_tech_factor

	}
}

tech_robomodding = {
	cost = @tier2cost1
	area = engineering
	tier = 1
	category = { industry }
	prerequisites = { "tech_robotic_workers" }
	weight = @tier2weight1

	feature_flags = {
		modify_robots
	}

	modifier = {
		pop_environment_tolerance = 0.05
	}

	potential = {
		NOR = {
			has_ethic = "ethic_gestalt_consciousness"
			is_individual_machine = yes
		}
	}

	weight_modifier = {
		modifier = {
			factor = 0
			has_policy_flag = robots_outlawed
		}

	}

	ai_weight = {
		modifier = {
			factor = 0
			NOT = { has_ai_personality_behaviour = robot_exploiter }
			NOT = { has_ai_personality_behaviour = robot_liberator }
		}
		modifier = {
			factor = 2
			has_origin = origin_mechanists
		}
		modifier = {
			factor = 2
			has_ascension_perk = ap_synthetic_evolution
		}

		modifier = {
			factor = @robots_ai_tech_factor
			is_materialist = yes
		}
	}
}

tech_robomodding_points_1 = {
	cost = @tier3cost1
	area = engineering
	tier = 2
	category = { industry }
	prerequisites = { "tech_robomodding" "tech_droid_workers" }
	weight = @tier3weight1

	modifier = {
		ROBOT_species_trait_points_add = 3
		MACHINE_species_trait_points_add = 3
	}

	potential = {
		NOT = {
			has_ethic = "ethic_gestalt_consciousness"
			is_individual_machine = yes
		}
	}

	weight_modifier = {
		modifier = {
			factor = 0
			has_policy_flag = robots_outlawed
		}
		modifier = {
			factor = 2
			has_origin = origin_mechanists
		}

	}

	ai_weight = {
		modifier = {
			factor = 0
			NOT = { has_ai_personality_behaviour = robot_exploiter }
			NOT = { has_ai_personality_behaviour = robot_liberator }
		}
		modifier = {
			factor = 2
			has_origin = origin_mechanists
		}
		modifier = {
			factor = 2
			has_ascension_perk = ap_synthetic_evolution
		}

		modifier = {
			factor = @robots_ai_tech_factor
			is_materialist = yes
		}
	}
}

tech_robomodding_points_2 = {
	cost = @tier4cost1
	area = engineering
	tier = 4
	category = { industry }
	is_rare = yes
	prerequisites = { "tech_robomodding_points_1" "tech_synthetic_workers" }
	weight = @tier4weight1

	modifier = {
		ROBOT_species_trait_points_add = 1
		MACHINE_species_trait_points_add = 1
	}

	potential = {
		NOT = {
			has_ethic = "ethic_gestalt_consciousness"
			is_individual_machine = yes
		}
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0
			has_policy_flag = robots_outlawed
		}
		modifier = {
			factor = 2
			has_origin = origin_mechanists
		}
		modifier = {
			factor = 4
			has_ascension_perk = ap_synthetic_evolution
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_robomodding_points_2
		}
		modifier = {
			factor = 0.50
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_maniacal }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_2 }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_3 }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius_2 }
				has_trait_in_council = { TRAIT = leader_trait_curator }
				has_trait_in_council = { TRAIT = leader_trait_expertise_industry }
			}
		}
	}

	ai_weight = {
		modifier = {
			factor = 0
			NOT = { has_ai_personality_behaviour = robot_exploiter }
			NOT = { has_ai_personality_behaviour = robot_liberator }
		}
		modifier = {
			factor = 2
			has_origin = origin_mechanists
		}
		modifier = {
			factor = 2
			has_ascension_perk = ap_synthetic_evolution
		}

		modifier = {
			factor = @robots_ai_tech_factor
			is_materialist = yes
		}
	}
}

### Machine Empire Techs

# Binary Motivators
tech_binary_motivators = {
	cost = @tier3cost1
	area = engineering
	tier = 3
	category = { industry }
	prerequisites = { "tech_colonial_centralization" "tech_robomodding_m" }
	weight = @tier3weight1

	gateway = robotics

	modifier = {
		ROBOT_species_trait_points_add = 3
		MACHINE_species_trait_points_add = 3
	}

	potential = {
		OR = {
			is_machine_empire = yes
			is_individual_machine = yes
			is_hive_empire_with_machines = yes
		}
	}

	weight_modifier = {

	}

	ai_weight = {
		factor = @robots_ai_tech_factor

	}
}

# Nanite Assemblers
tech_nanite_assemblers = {
	cost = @tier4cost1
	area = engineering
	tier = 4
	category = { industry }
	prerequisites = { "tech_binary_motivators" "tech_galactic_administration" }
	is_rare = yes
	weight = @tier4weight1

	modifier = {
		ROBOT_species_trait_points_add = 1
		MACHINE_species_trait_points_add = 1
	}

	potential = {
		OR = {
			is_machine_empire = yes
			is_individual_machine = yes
			is_hive_empire_with_machines = yes
		}
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0.20
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_maniacal }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_2 }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_3 }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius_2 }
				has_trait_in_council = { TRAIT = leader_trait_curator }
				has_trait_in_council = { TRAIT = leader_trait_expertise_industry }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_nanite_assemblers
		}
	}

	ai_weight = {
		factor = @robots_ai_tech_factor

	}
}

# Mega Assembly
tech_mega_assembly = {
	cost = @tier4cost1
	area = engineering
	tier = 4
	category = { industry }
	prerequisites = { "tech_binary_motivators" "tech_galactic_administration" }
	is_rare = yes
	weight = @tier4weight1

	potential = {
		OR = {
			is_machine_empire = yes
			is_individual_machine = yes
			is_hive_empire_with_machines = yes
		}
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0.20
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_maniacal }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_2 }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_3 }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius_2 }
				has_trait_in_council = { TRAIT = leader_trait_curator }
				has_trait_in_council = { TRAIT = leader_trait_expertise_industry }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_mega_assembly
		}
	}

	ai_weight = {
		factor = @pop_growth_tech_ai_factor

	}
}

# Adaptive Combat Algorithms
tech_adaptive_combat_algorithms = {
	cost = @tier2cost2
	area = society
	tier = 2
	category = { military_theory }
	weight = @tier2weight2

	potential = {
		OR = {
			is_machine_empire = yes
			is_individual_machine = yes
		}
	}

	weight_modifier = {
		factor = 1.5

	}

	ai_weight = {

	}
}

# Biomechanics
tech_biomechanics = {
	cost = @tier4cost2
	area = society
	category = { biology }
	tier = 4
	is_rare = yes
	prerequisites = { "tech_adaptive_combat_algorithms" }
	weight = @tier4weight2

	potential = {
		OR = {
			is_machine_empire = yes
			is_individual_machine = yes
		}
	}

	weight_modifier = {
		modifier = {
			factor = 0.10
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_biology }
				has_trait_in_council = { TRAIT = leader_trait_curator }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_biomechanics
		}
	}
}


# Micro Replicators
tech_micro_replicators = {
	cost = @tier2cost2
	area = engineering
	tier = 2
	category = { industry }
	weight = @tier2weight2

	modifier = {
		planet_pop_assembly_mult = 0.10
	}

	potential = {
		OR = {
			is_machine_empire = yes
			is_individual_machine = yes
			is_hive_empire_with_machines = yes
		}
	}

	weight_modifier = {
		factor = 1.5

	}

	ai_weight = {
		factor = @pop_growth_tech_ai_factor

	}
}

# Self-Assembling Components
tech_self_assembling_components = {
	cost = @tier3cost3
	area = engineering
	tier = 3
	category = { industry }
	weight = @tier3weight3
	prerequisites = { "tech_micro_replicators" }

	modifier = {
		planet_pop_assembly_mult = 0.10
	}

	potential = {
		OR = {
			is_machine_empire = yes
			is_individual_machine = yes
			is_hive_empire_with_machines = yes
		}
	}

	weight_modifier = {
		factor = 1.5

	}

	ai_weight = {
		factor = @pop_growth_tech_ai_factor

	}
}
