# Icons set here are the ones show in the actual slot.

@cost1 = 5
@cost2 = 10
@cost3 = 15
@cost4 = 20

@cost_fauna_1 = 20
@cost_fauna_2 = 40
@cost_fauna_3 = 60
@cost_fauna_4 = 80

@power0 = -5
@power1 = -10
@power2 = -15
@power3 = -20
@power4 = -30

#############
# UTILITIES #
#############

### NON-FTL DRIVE
utility_component_template = {
	key = "EMPTY_DRIVE"
	size = small
	icon = "GFX_ship_part_empty_ftl_drive"
	icon_frame = 1
	power = 0

	potential = {
		OR = {
			from = {
				country_uses_bio_ships = no
			}
			is_arkship_ship = yes
		}
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "ftl_components"
	upgrades_to = "HYPER_DRIVE_1"

	ai_weight = {
		base = 0
	}
}

# Subspace Drive

utility_component_template = {
	key = "SUBSPACE_DRIVE"
	size = small
	icon = "GFX_ship_part_subspace_drive"
	icon_frame = 1

	power = @power0
	resources = {
		category = ship_components
		cost = {
			alloys = @cost1
		}
	}

	potential = {
		OR = {
			is_eager_explorer_ship = yes
			is_ship_class = shipclass_military
			is_ship_class = shipclass_transport
			is_arkship_ship = yes
		}
		from = {
			country_uses_bio_ships = no
		}
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}

	ftl = no
	jumpdrive = yes
	ship_modifier = {
		ship_jumpdrive_cooldown_mult = -0.25
		ship_ftl_jumpdrive_range_mult = -0.50
	}
	prerequisites = { "tech_subspace_drive" }
	ai_weight = {
		weight = 1
	}
	component_set = "ftl_components"
	upgrades_to = "HYPER_DRIVE_1"
}


### HYPER DRIVES
utility_component_template = {
	key = "HYPER_DRIVE_1"
	size = small
	icon = "GFX_ship_part_hyper_drive_1"
	icon_frame = 1
	power = @power1
	resources = {
		category = ship_components
		cost = {
			alloys = @cost1
		}
	}
	ftl = yes

	ship_modifier = {
		ship_disengage_opportunities_add = 1
	}

	ai_weight = {
		weight = 1
	}

	potential = {
		is_eager_explorer_ship = no
		OR = {
			from = {
				country_uses_bio_ships = no
			}
			is_arkship_ship = yes
		}
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	prerequisites = { "tech_hyper_drive_1" }
	component_set = "ftl_components"
	upgrades_to = "HYPER_DRIVE_2"
}

utility_component_template = {
	key = "HYPER_DRIVE_2"
	size = small
	icon = "GFX_ship_part_hyper_drive_2"
	icon_frame = 1
	power = @power2
	resources = {
		category = ship_components
		cost = {
			alloys = @cost2
		}
	}
	ftl = yes
	ship_modifier = {
		ship_disengage_opportunities_add = 1
		ship_windup_mult = -0.25
	}

	ai_weight = {
		weight = 2
	}

	potential = {
		is_eager_explorer_ship = no
		OR = {
			from = {
				country_uses_bio_ships = no
			}
			is_arkship_ship = yes
		}
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	prerequisites = { "tech_hyper_drive_2" }
	component_set = "ftl_components"
	upgrades_to = "HYPER_DRIVE_3"
}

utility_component_template = {
	key = "HYPER_DRIVE_3"
	size = small
	icon = "GFX_ship_part_hyper_drive_3"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	ftl = yes
	ship_modifier = {
		ship_disengage_opportunities_add = 1
		ship_windup_mult = -0.5
	}

	ai_weight = {
		weight = 3
	}

	potential = {
		is_eager_explorer_ship = no
		OR = {
			from = {
				country_uses_bio_ships = no
			}
			is_arkship_ship = yes
		}
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	prerequisites = { "tech_hyper_drive_3" }
	component_set = "ftl_components"
	upgrades_to = "JUMP_DRIVE_1"
}

### Jump drives

utility_component_template = {
	key = "JUMP_DRIVE_1"
	size = small
	icon = "GFX_ship_part_jump_drive_1"
	icon_frame = 1
	power = @power4
	resources = {
		category = ship_components
		cost = {
			alloys = @cost4
		}
	}

	potential = {
		ship_uses_jump_drives = yes
		OR = {
			from = {
				country_uses_bio_ships = no
			}
			is_arkship_ship = yes
		}
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}

	ftl = yes
	jumpdrive = yes
	ship_modifier = {
		ship_disengage_opportunities_add = 1
		ship_windup_mult = -0.7
	}

	ai_weight = {
		weight = 4
	}

	prerequisites = { "tech_jump_drive_1" }
	component_set = "ftl_components"
	upgrades_to = "PSI_JUMP_DRIVE_1"
}

### Jump drives
utility_component_template = {
	key = "PSI_JUMP_DRIVE_1"
	size = small
	icon = "GFX_ship_part_psi_jump_drive_1"
	icon_frame = 1
	power = @power4
	resources = {
		category = ship_components
		cost = {
			alloys = @cost4
		}
	}

	potential = {
		ship_uses_jump_drives = yes
		OR = {
			from = {
				country_uses_bio_ships = no
			}
			is_arkship_ship = yes
		}
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}

	ftl = yes
	jumpdrive = yes
	ship_modifier = {
		ship_disengage_opportunities_add = 2
		ship_windup_mult = -0.8
		ship_ftl_jumpdrive_range_mult = 0.50
	}
	
	triggered_ship_modifier = {
 		potential = {
			OR = {
				owner = {
					OR = {
						is_country_type = extradimensional
						is_country_type = extradimensional_2
						is_country_type = extradimensional_3
					}
				}
				fleet = { has_fleet_flag = dimensional_fleet }
			}
			has_global_flag = sustained_ship_acceleration
			is_in_combat = no
 		}
 		modifier = {
			ship_base_speed_mult = 6.00
		}
	}
	
	triggered_ship_modifier = {
 		potential = {
			OR = {
				owner = {
					OR = {
						is_country_type = extradimensional
						is_country_type = extradimensional_2
						is_country_type = extradimensional_3
					}
				}
				fleet = { has_fleet_flag = dimensional_fleet }
			}
			NOT = { has_global_flag = sustained_ship_acceleration }
			is_in_combat = no
 		}
 		modifier = {
			ship_base_speed_mult = 4.25
		}
	}
	
	triggered_ship_modifier = {
 		potential = {
			OR = {
				owner = {
					OR = {
						is_country_type = extradimensional
						is_country_type = extradimensional_2
						is_country_type = extradimensional_3
					}
				}
				fleet = { has_fleet_flag = dimensional_fleet }
			}
			is_in_combat = yes
 		}
 		modifier = {
			ship_speed_reduction = 0.5
		}
	}

	ai_weight = {
		weight = 5
	}

	prerequisites = { "tech_psi_jump_drive_1" }
	component_set = "ftl_components"
}

##########################
# Space Fauna Components #
##########################

utility_component_template = {
	key = "BIO_DRIVE"
	size = small
	icon = "GFX_ship_part_bio_warp_drive_1"
	icon_frame = 1
	power = 0
	ftl = yes

	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost_fauna_1
		}
	}

	ship_modifier = {
		ship_disengage_opportunities_add = 1
	}

	ai_weight = {
		weight = 1
	}

	component_set = "ftl_components_bio"
	upgrades_to = "BIO_DRIVE_2"
}

utility_component_template = {
	key = "BIO_DRIVE_2"
	size = small
	icon = "GFX_ship_part_bio_warp_drive_2"
	icon_frame = 1
	power = 0
	ftl = yes

	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost_fauna_2
		}
	}

	ship_modifier = {
		ship_disengage_opportunities_add = 1
		ship_windup_mult = -0.2
	}

	ai_weight = {
		weight = 2
	}

	prerequisites = { "tech_hyper_drive_2" "tech_hyper_drive_bio_integration" }
	component_set = "ftl_components_bio"
	upgrades_to = "BIO_DRIVE_3"
}

utility_component_template = {
	key = "BIO_DRIVE_3"
	size = small
	icon = "GFX_ship_part_bio_subspace_drive"
	icon_frame = 1
	power = 0
	ftl = yes

	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost_fauna_3
		}
	}

	ship_modifier = {
		ship_disengage_opportunities_add = 1
		ship_windup_mult = -0.4
	}

	ai_weight = {
		weight = 3
	}

	prerequisites = { "tech_hyper_drive_3" "tech_hyper_drive_bio_integration" }
	component_set = "ftl_components_bio"
	upgrades_to = "BIO_DRIVE_4"
}

utility_component_template = {
	key = "BIO_DRIVE_4"
	size = small
	icon = "GFX_ship_part_bio_jump_drive_1"
	icon_frame = 1
	power = 0
	ftl = yes
	jumpdrive = yes

	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost_fauna_4
		}
	}

	ai_weight = {
		weight = 4
	}

	ship_modifier = {
		ship_disengage_opportunities_add = 1
		ship_windup_mult = -0.6
	}

	prerequisites = { "tech_jump_drive_1" "tech_hyper_drive_bio_integration" }
	component_set = "ftl_components_bio"
}

utility_component_template = {
	key = "BIO_DRIVE_5"
	size = small
	icon = "GFX_ship_part_bio_psi_jump_drive_1"
	icon_frame = 1
	power = 0
	ftl = yes
	jumpdrive = yes

	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost_fauna_4
		}
	}

	ship_modifier = {
		ship_disengage_opportunities_add = 2
		ship_windup_mult = -0.7
	}

	ai_weight = {
		weight = 5
	}

	prerequisites = { "tech_psi_jump_drive_1" "tech_hyper_drive_bio_integration" }
	component_set = "ftl_components_bio"
}
