##### Superstructure Technologies
#####Start of Edits########################################################################################################
tech_orbital_arc_furnace = {
    area = engineering
    cost = @tier2cost3
    tier = 2
    category = { materials }
    ai_update_type = all
    weight = 0
    is_rare = yes
    is_reverse_engineerable = no
    weight = @tier2weight3

    potential = {
        has_machine_age_dlc = yes
    }

    weight_modifier = {
        factor = 0.5

        modifier = {
            factor = 0.2
            NOR = {
                has_trait_in_council = { TRAIT = leader_trait_expertise_materials }
                has_trait_in_council = { TRAIT = leader_trait_curator }
                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_maniacal }
                has_trait_in_council = { TRAIT = leader_trait_maniacal_2 }
                has_trait_in_council = { TRAIT = leader_trait_maniacal_3 }
            }
        }
        modifier = {
            factor = 2
            OR = {
                has_megastructure = orbital_arc_furnace_1
                has_megastructure = orbital_arc_furnace_2
                has_megastructure = orbital_arc_furnace_3
                has_megastructure = orbital_arc_furnace_4
            }
        }

        modifier = {
            factor = 2
            has_ascension_perk = ap_technological_ascendancy
        }
        modifier = {
            factor = @federation_perk_factor
            has_federation = yes
            federation = {
                has_federation_perk = rare_tech_boost
                any_member = { has_technology = tech_orbital_arc_furnace }
            }
        }
    }
    prereqfor_desc = {
        ship = {
            title = "allow_arc_furnace"
            desc = "orbital_arc_furnace_1_MEGASTRUCTURE_DETAILS"
        }
    }

    ai_weight = {
        factor = 4 #Please boost your economy AI

        modifier = {
            factor = 2
            is_ai = no #auto-research
        }
    }
}

tech_dyson_swarm = {
    area = physics
    cost = @tier2cost3
    tier = 2
    category = { computing }
    ai_update_type = all
    weight = 0
    is_rare = yes
    is_reverse_engineerable = no
    weight = @tier2weight3

    potential = {
        has_machine_age_dlc = yes
    }

    weight_modifier = {
        factor = 0.5
        modifier = {
            factor = 0.2
            NOR = {
                has_trait_in_council = { TRAIT = leader_trait_expertise_computing }
                has_trait_in_council = { TRAIT = leader_trait_curator }
                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_maniacal }
                has_trait_in_council = { TRAIT = leader_trait_maniacal_2 }
                has_trait_in_council = { TRAIT = leader_trait_maniacal_3 }
            }
        }
        modifier = {
            factor = 2
            OR = {
                has_megastructure = dyson_swarm_1
                has_megastructure = dyson_swarm_2
                has_megastructure = dyson_swarm_3
            }
        }
        modifier = {
            factor = 2
            has_ascension_perk = ap_technological_ascendancy
        }
        modifier = {
            factor = @federation_perk_factor
            has_federation = yes
            federation = {
                has_federation_perk = rare_tech_boost
                any_member = { has_technology = tech_dyson_swarm }
            }
        }
    }
    prereqfor_desc = {
        ship = {
            title = "allow_dyson_swarm"
            desc = "dyson_swarm_1_MEGASTRUCTURE_DETAILS"
        }
    }

    ai_weight = {
        factor = 1 #AI will have a harder time making use of this

        modifier = {
            factor = 2
            is_ai = no #auto-research
        }
    }
}
######END OF EDITS#######################################################################################################
# Digitization mind creation method
tech_identity_copy = {
    cost = @tier4cost1
    area = engineering
    tier = 4
    category = { industry }
    weight = 0 # Made available in script, not by research

    potential = {
        has_machine_age_dlc = yes
    }

    # Grants the Synthetic Identities: Identity Copy policy
    prereqfor_desc = {
        custom = {
            title = "TECH_UNLOCK_IDENTITY_COPY_TITLE"
            desc = "TECH_UNLOCK_IDENTITY_COPY_DESC"
        }
    }
}

# Digitization mind creation method
tech_identity_fusion = {
    cost = @tier4cost2
    area = engineering
    tier = 4
    category = { industry }
    weight = @tier4weight2

    potential = {
        has_machine_age_dlc = yes
        has_country_flag = advanced_identity_creation
    }

    # Grants the Synthetic Identities: Identity Fusion policy
    prereqfor_desc = {
        custom = {
            title = "TECH_UNLOCK_IDENTITY_FUSION_TITLE"
            desc = "TECH_UNLOCK_IDENTITY_FUSION_DESC"
        }
    }
}

# Digitization mind creation method
tech_identity_initialization = {
    cost = @tier4cost2
    area = engineering
    tier = 4
    category = { industry }
    weight = @tier4weight2

    potential = {
        has_machine_age_dlc = yes
        has_country_flag = advanced_identity_creation
    }

    # Grants the Synthetic Identities: Identity Initialization policy
    prereqfor_desc = {
        custom = {
            title = "TECH_UNLOCK_IDENTITY_INITIALIZATION_TITLE"
            desc = "TECH_UNLOCK_IDENTITY_INITIALIZATION_DESC"
        }
    }
}

###Synth Queen Techs
tech_synth_queen_knowledge = {
    area = physics
    tier = 5
    cost = @tier5cost1
    category = { computing }
    is_rare = yes
    weight = @tier5weight1

    potential = {
        has_machine_age_dlc = yes
        has_country_flag = synth_queen_knowledge
    }

    modifier = {
        all_technology_research_speed = 0.2
    }
}

tech_cosmogenesis_crisis_1 = {
    area = physics
    cost = 10000
    tier = 5
    category = { computing }
    ai_update_type = all
    is_rare = yes
    weight = 0

    potential = {
        has_machine_age_dlc = yes
        has_ascension_perk = ap_cosmogenesis
    }

    prereqfor_desc = {
        custom = {
            title = cosmogenesis_level_1_tech_title
            desc = cosmogenesis_level_1_tech_desc
        }
    }
}

tech_cosmogenesis_crisis_2 = {
    area = physics
    cost = 50000
    tier = 5
    category = { computing }
    ai_update_type = all
    is_rare = yes
    weight = 0

    potential = {
        has_machine_age_dlc = yes
        has_ascension_perk = ap_cosmogenesis
    }

    prereqfor_desc = {
        custom = {
            title = cosmogenesis_level_2_tech_title
            desc = cosmogenesis_level_2_tech_desc
        }
    }
}

tech_cosmogenesis_crisis_3 = {
    area = physics
    cost = 100000
    tier = 5
    category = { computing }
    ai_update_type = all
    is_rare = yes
    weight = 0

    potential = {
        has_machine_age_dlc = yes
        has_ascension_perk = ap_cosmogenesis
    }

    prereqfor_desc = {
        custom = {
            title = cosmogenesis_level_3_tech_title
            desc = cosmogenesis_level_3_tech_desc
        }
    }
}

tech_cosmogenesis_crisis_4 = {
	area = physics
	cost = 200000
	tier = 5
	category = { computing }
	ai_update_type = all
	is_rare = yes
	weight = 0

	potential = {
		has_machine_age_dlc = yes
		has_ascension_perk = ap_cosmogenesis
	}

	prereqfor_desc = {
		custom = {
			title = cosmogenesis_level_4_tech_title
			desc = cosmogenesis_level_4_tech_desc
		}
	}
}

tech_cosmogenesis_crisis_5 = {
	area = physics
	cost = 300000
	tier = 5
	category = { computing }
	ai_update_type = all
	is_rare = yes
	weight = 0

	potential = {
		has_machine_age_dlc = yes
		has_ascension_perk = ap_cosmogenesis
	}

	prereqfor_desc = {
		custom = {
			title = cosmogenesis_level_5_tech_title
			desc = cosmogenesis_level_5_tech_desc
		}
	}
}

tech_cosmogenesis_escort = {
	area = engineering
	cost = @fallentechcost
	tier = 5
	category = { voidcraft }
	ai_update_type = all
	is_rare = yes
	is_dangerous = yes
	weight = 0

	potential = {
		has_machine_age_dlc = yes
        country_uses_bio_ships = no
	}

	prereqfor_desc = {
		ship = {
			title = "TECH_UNLOCK_ESCORT_CONSTRUCTION_TITLE"
			desc = "TECH_UNLOCK_ESCORT_CONSTRUCTION_DESC"
		}
	}
}

tech_cosmogenesis_battlecruiser = {
	area = engineering
	cost = @fallentechcost
	tier = 5
	category = { voidcraft }
	ai_update_type = all
	is_rare = yes
	is_dangerous = yes
	weight = 0

	potential = {
		has_machine_age_dlc = yes
        country_uses_bio_ships = no
	}

	prereqfor_desc = {
		ship = {
			title = "TECH_UNLOCK_BATTLECRUISER_CONSTRUCTION_TITLE"
			desc = "TECH_UNLOCK_BATTLECRUISER_CONSTRUCTION_DESC"
		}
	}
}

tech_cosmogenesis_FE_titan = {
	area = engineering
	cost = @fallentechcost
	tier = 5
	category = { voidcraft }
	ai_update_type = all
	is_rare = yes
	is_dangerous = yes
	weight = 0

	potential = {
		has_machine_age_dlc = yes
        country_uses_bio_ships = no
	}

	prereqfor_desc = {
		ship = {
			title = "TECH_UNLOCK_FETITAN_CONSTRUCTION_TITLE"
			desc = "TECH_UNLOCK_FETITAN_CONSTRUCTION_DESC"
		}
	}
}

tech_cosmogenesis_weaver = {
	area = society
	cost = @fallentechcost
	tier = 5
	category = { biology }
	ai_update_type = all
	is_rare = yes
    is_dangerous = yes
	weight = 0

	potential = {
		has_machine_age_dlc = yes
        country_uses_bio_ships = yes
	}

	prereqfor_desc = {
		ship = {
			title = "TECH_UNLOCK_COSMO_WEAVER_CONSTRUCTION_TITLE"
			desc = "TECH_UNLOCK_COSMO_WEAVER_CONSTRUCTION_DESC"
		}
	}
}

tech_cosmogenesis_mauler = {
	area = society
	cost = @fallentechcost
	tier = 5
	category = { biology }
	ai_update_type = all
	is_rare = yes
	is_dangerous = yes
	weight = 0

	potential = {
		has_machine_age_dlc = yes
        country_uses_bio_ships = yes
	}

	prereqfor_desc = {
		ship = {
			title = "TECH_UNLOCK_COSMO_MAULER_CONSTRUCTION_TITLE"
			desc = "TECH_UNLOCK_COSMO_MAULER_CONSTRUCTION_DESC"
		}
	}
}

tech_cosmogenesis_harbinger = {
	area = society
	cost = @fallentechcost
	tier = 5
	category = { biology }
	ai_update_type = all
	is_rare = yes
	is_dangerous = yes
	weight = 0

	potential = {
		has_machine_age_dlc = yes
        country_uses_bio_ships = yes
	}

	prereqfor_desc = {
		ship = {
			title = "TECH_UNLOCK_COSMO_HARBINGER_CONSTRUCTION_TITLE"
			desc = "TECH_UNLOCK_COSMO_HARBINGER_CONSTRUCTION_DESC"
		}
	}
}

tech_cosmogenesis_stinger = {
	area = society
	cost = @fallentechcost
	tier = 5
	category = { biology }
	ai_update_type = all
	is_rare = yes
	is_dangerous = yes
	weight = 0

	potential = {
		has_machine_age_dlc = yes
        country_uses_bio_ships = yes
	}

	prereqfor_desc = {
		ship = {
			title = "TECH_UNLOCK_COSMO_STINGER_CONSTRUCTION_TITLE"
			desc = "TECH_UNLOCK_COSMO_STINGER_CONSTRUCTION_DESC"
		}
	}
}

tech_cosmogenesis_world = {
    area = engineering
    cost = @tier5cost1
    tier = 5
    category = { materials }
    ai_update_type = all
    is_rare = yes
    weight = 0

    potential = {
        has_machine_age_dlc = yes
        has_ascension_perk = ap_cosmogenesis
    }

    prereqfor_desc = {
        custom = {
            title = "TECH_UNLOCK_COSMOWORLD_CONSTRUCTION_TITLE"
            desc = "TECH_UNLOCK_COSMOWORLD_CONSTRUCTION_DESC"
        }
    }
}

tech_cosmogenesis_thesis = {
    area = physics
    cost = 75000
    cost_per_level = @fallentechcost
    tier = 4
    category = { computing }
    levels = -1
    is_dangerous = yes
    weight = @repeatableTechWeight

    potential = {
        has_machine_age_dlc = yes
        has_ascension_perk = ap_cosmogenesis
    }

    weight_modifier = {
        modifier = {
            factor = 0
            NOT = { has_crisis_level = crisis_cosmogenesis_level_4 }
        }
    }

    weight_modifier = {
        modifier = {
            factor = 5
            has_technology = tech_cosmogenesis_crisis_3
        }
    }

    prereqfor_desc = {
        custom = {
            title = cosmogenesis_thesis_tech_title
            desc = cosmogenesis_thesis_tech_desc
        }
    }
}

## Synaptic Lathe Technologies

tech_lathe_resonator = {
    area = physics
    cost = 30000
    tier = 5
    category = { computing }
    ai_update_type = all
    is_rare = yes
    weight = @tier5weight1

    potential = {
        has_machine_age_dlc = yes
        has_ascension_perk = ap_cosmogenesis
        has_technology = tech_cosmogenesis_world
    }

    weight_modifier = {
        modifier = {
            factor = 0
            NOT = {
                any_owned_planet = {
                    is_planet_class = pc_cosmogenesis_world
                }
                has_ascension_perk = ap_cosmogenesis
            }
        }
        modifier = {
            factor = 2
            any_owned_planet = {
                is_planet_class = pc_cosmogenesis_world
                pop_amount >= 5000
            }
        }
        modifier = {
            factor = 2
            any_owned_planet = {
                is_planet_class = pc_cosmogenesis_world
                pop_amount >= 10000
            }
        }
    }
}

tech_lathe_overclocker = {
    area = physics
    cost = 30000
    tier = 5
    category = { computing }
    ai_update_type = all
    is_rare = yes
    weight = @tier5weight1

    potential = {
        has_machine_age_dlc = yes
        has_ascension_perk = ap_cosmogenesis
        has_technology = tech_cosmogenesis_world
    }

    weight_modifier = {
        modifier = {
            factor = 0
            NOT = {
                any_owned_planet = {
                    is_planet_class = pc_cosmogenesis_world
                }
                has_ascension_perk = ap_cosmogenesis
            }
        }
        modifier = {
            factor = 2
            any_owned_planet = {
                is_planet_class = pc_cosmogenesis_world
                pop_amount >= 5000
            }
        }
        modifier = {
            factor = 2
            any_owned_planet = {
                is_planet_class = pc_cosmogenesis_world
                pop_amount >= 10000
            }
        }
    }
}

tech_lathe_preserver = {
    area = society
    cost = 30000
    tier = 5
    category = { biology }
    ai_update_type = all
    is_rare = yes
    weight = @tier5weight1

    potential = {
        has_machine_age_dlc = yes
        has_ascension_perk = ap_cosmogenesis
        has_technology = tech_cosmogenesis_world
    }

    weight_modifier = {
        modifier = {
            factor = 0
            NOT = {
                any_owned_planet = {
                    is_planet_class = pc_cosmogenesis_world
                }
                has_ascension_perk = ap_cosmogenesis
            }
        }
        modifier = {
            factor = 2
            any_owned_planet = {
                is_planet_class = pc_cosmogenesis_world
                pop_amount >= 5000
            }
        }
        modifier = {
            factor = 2
            any_owned_planet = {
                is_planet_class = pc_cosmogenesis_world
                pop_amount >= 10000
            }
        }
    }
}

tech_lathe_life_support = {
    area = society
    cost = 30000
    tier = 5
    category = { biology }
    ai_update_type = all
    is_rare = yes
    weight = @tier5weight1

    potential = {
        has_machine_age_dlc = yes
        has_ascension_perk = ap_cosmogenesis
        has_technology = tech_cosmogenesis_world
    }

    weight_modifier = {
        modifier = {
            factor = 0
            NOT = {
                any_owned_planet = {
                    is_planet_class = pc_cosmogenesis_world
                }
                has_ascension_perk = ap_cosmogenesis
            }
        }
        modifier = {
            factor = 2
            any_owned_planet = {
                is_planet_class = pc_cosmogenesis_world
                pop_amount >= 5000
            }
        }
        modifier = {
            factor = 2
            any_owned_planet = {
                is_planet_class = pc_cosmogenesis_world
                pop_amount >= 10000
            }
        }
    }
}

tech_lathe_cogitator = {
    area = society
    cost = 30000
    tier = 5
    category = { military_theory }
    ai_update_type = all
    is_rare = yes
    weight = @tier5weight1

    potential = {
        has_machine_age_dlc = yes
        has_ascension_perk = ap_cosmogenesis
        has_technology = tech_cosmogenesis_world
    }

    weight_modifier = {
        modifier = {
            factor = 0
            NOT = {
                any_owned_planet = {
                    is_planet_class = pc_cosmogenesis_world
                }
                has_ascension_perk = ap_cosmogenesis
            }
        }
        modifier = {
            factor = 2
            any_owned_planet = {
                is_planet_class = pc_cosmogenesis_world
                pop_amount >= 5000
            }
        }
        modifier = {
            factor = 2
            any_owned_planet = {
                is_planet_class = pc_cosmogenesis_world
                pop_amount >= 10000
            }
        }
    }
}

tech_lathe_validator = {
    area = physics
    cost = 30000
    tier = 5
    category = { computing }
    ai_update_type = all
    is_rare = yes
    weight = @tier5weight1

    potential = {
        has_machine_age_dlc = yes
        has_ascension_perk = ap_cosmogenesis
        has_technology = tech_cosmogenesis_world
    }

    weight_modifier = {
        modifier = {
            factor = 0
            NOT = {
                any_owned_planet = {
                    is_planet_class = pc_cosmogenesis_world
                }
                has_ascension_perk = ap_cosmogenesis
            }
        }
        modifier = {
            factor = 2
            any_owned_planet = {
                is_planet_class = pc_cosmogenesis_world
                pop_amount >= 5000
            }
        }
        modifier = {
            factor = 2
            any_owned_planet = {
                is_planet_class = pc_cosmogenesis_world
                pop_amount >= 10000
            }
        }
    }
}
# Synth Queen Nanite ship component

tech_nanite_repair_system_synth_queen = {
    area = engineering
    cost = @tier5cost3
    tier = 5
    category = { materials }
    ai_update_type = all
    is_rare = yes
    weight = 0

    potential = {
        has_machine_age_dlc = yes
    }
}