# Icons set here are the ones show in the actual slot. The reason is so that we can support different icons for different sizes.

#Updated Range on these

# DEFAULT VALUES:
# is_missile = no
# is_beam = no
# is_point_defence = no

@missile_speed = 5

# ####################
# Missiles
# ####################

### Missile Launcher
weapon_component_template = {
	key = "MISSILE_1"
	size = small

	icon = "GFX_ship_part_missile_1"
	icon_frame = 1
	type = missile

	prerequisites = { "tech_missiles_1" }
	component_set = "MISSILE_1"
	projectile_gfx = "small_missile"
	tags = { weapon_type_explosive g_slot }
	ai_tags = { weapon_role_artillery artillery artillery_stealth energy_torpedoes energy_torpedoes_stealth }
	ai_tag_weight = 0
	upgrades_to = "MISSILE_2"
	resources = {
		category = ship_components
		cost = {
			alloys = @s_t1_cost
		}
		upkeep = {
			energy = @s_t1_upkeep_energy
			alloys = @s_t1_upkeep_alloys
		}
	}
	potential = {
		ship_uses_mauler_components = no
	}
}

### Missile Launcher

### Advanced Missile Launcher
weapon_component_template = {
	key = "MISSILE_2"
	size = small

	icon = "GFX_ship_part_missile_2"
	icon_frame = 1
	type = missile

	prerequisites = { "tech_missiles_2" }
	component_set = "MISSILE_2"
	projectile_gfx = "small_missile"
	tags = { weapon_type_explosive g_slot }
	ai_tags = { weapon_role_artillery artillery artillery_stealth energy_torpedoes energy_torpedoes_stealth }
	ai_tag_weight = 0
	upgrades_to = "MISSILE_3"
	resources = {
		category = ship_components
		cost = {
			alloys = @s_t2_cost
		}
		upkeep = {
			energy = @s_t2_upkeep_energy
			alloys = @s_t2_upkeep_alloys
		}
	}
	potential = {
		ship_uses_mauler_components = no
	}
}

### Strike Missile Launcher
weapon_component_template = {
	key = "MISSILE_3"
	size = small

	icon = "GFX_ship_part_missile_3"
	icon_frame = 1
	type = missile

	prerequisites = { "tech_missiles_3" }
	component_set = "MISSILE_3"
	projectile_gfx = "small_missile"
	tags = { weapon_type_explosive g_slot }
	ai_tags = { weapon_role_artillery artillery artillery_stealth energy_torpedoes energy_torpedoes_stealth }
	ai_tag_weight = 0
	upgrades_to = "MISSILE_4"
	resources = {
		category = ship_components
		cost = {
			alloys = @s_t3_cost
		}
		upkeep = {
			energy = @s_t3_upkeep_energy
			alloys = @s_t3_upkeep_alloys
		}
	}
	potential = {
		ship_uses_mauler_components = no
	}
}

### Heavy Missile Launcher
weapon_component_template = {
	key = "MISSILE_4"
	size = small

	icon = "GFX_ship_part_missile_4"
	icon_frame = 1
	type = missile

	prerequisites = { "tech_missiles_4" }
	component_set = "MISSILE_4"
	projectile_gfx = "small_missile"
	tags = { weapon_type_explosive g_slot }
	ai_tags = { weapon_role_artillery artillery artillery_stealth energy_torpedoes energy_torpedoes_stealth }
	ai_tag_weight = 0
	upgrades_to = "MISSILE_5"
	resources = {
		category = ship_components
		cost = {
			alloys = @s_t4_cost
			volatile_motes = @s_t4_rare
		}
		upkeep = {
			energy = @s_t4_upkeep_energy
			alloys = @s_t4_upkeep_alloys
		}
	}

	potential = {
		ship_uses_mauler_components = no
	}

	ai_weight = {
		weight = 1
		modifier = {
			factor = 0.0
			no_resource_for_component = { RESOURCE = volatile_motes }
		}
	}
}

### Advanced Heavy Missile Launcher
weapon_component_template = {
	key = "MISSILE_5"
	size = small

	icon = "GFX_ship_part_missile_5"
	icon_frame = 1
	type = missile

	prerequisites = { "tech_missiles_5" }
	component_set = "MISSILE_5"
	projectile_gfx = "small_missile"
	tags = { weapon_type_explosive g_slot }
	ai_tags = { weapon_role_artillery artillery artillery_stealth energy_torpedoes energy_torpedoes_stealth }
	ai_tag_weight = 0
	resources = {
		category = ship_components
		cost = {
			alloys = @s_t5_cost
			volatile_motes = @s_t5_rare
		}
		upkeep = {
			energy = @s_t5_upkeep_energy
			alloys = @s_t5_upkeep_alloys
		}
	}

	potential = {
		ship_uses_mauler_components = no
	}

	ai_weight = {
		weight = 1
		modifier = {
			factor = 0.0
			no_resource_for_component = { RESOURCE = volatile_motes }
		}
	}
}

# ####################
#	Swarmer Missiles
# ####################

### Swarmer Missile Launcher
weapon_component_template = {
	key = "SWARMER_MISSILE_1"
	size = medium

	icon = "GFX_ship_part_swarmer_missile_1"
	icon_frame = 1
	type = missile

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

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}

	prerequisites = { "tech_swarmer_missiles_1" }
	component_set = "SWARMER_MISSILE_1"
	projectile_gfx = "swarmer_missiles"
	tags = { weapon_type_explosive m_slot }
	ai_tags = { weapon_role_artillery artillery artillery_stealth energy_torpedoes energy_torpedoes_stealth }
	ai_tag_weight = 0
	upgrades_to = "SWARMER_MISSILE_2"
	resources = {
		category = ship_components
		cost = {
			alloys = @m_t3_cost
		}
		upkeep = {
			alloys = @m_t3_upkeep_alloys
		}
		upkeep = {
			trigger = {
				from = {
					country_uses_bio_ships = no
				}
			}
			energy = @m_t3_upkeep_energy
		}
		upkeep = {
			trigger = {
				from = {
					country_uses_bio_ships = yes
				}
			}
			food = @m_t3_upkeep_energy
		}
	}
}

### Advanced Swarmer Missile Launcher
weapon_component_template = {
	key = "SWARMER_MISSILE_2"
	size = medium

	icon = "GFX_ship_part_swarmer_missile_2"
	icon_frame = 1
	type = missile

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

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}

	prerequisites = { "tech_swarmer_missiles_2" }
	component_set = "SWARMER_MISSILE_2"
	projectile_gfx = "swarmer_missiles_02"
	tags = { weapon_type_explosive m_slot }
	ai_tags = { weapon_role_artillery artillery artillery_stealth energy_torpedoes energy_torpedoes_stealth }
	ai_tag_weight = 0
	resources = {
		category = ship_components
		cost = {
			alloys = @m_t5_cost
			volatile_motes = @m_t5_rare
		}
		upkeep = {
			alloys = @m_t5_upkeep_alloys
		}
		upkeep = {
			trigger = {
				from = {
					country_uses_bio_ships = no
				}
			}
			energy = @m_t5_upkeep_energy
		}
		upkeep = {
			trigger = {
				from = {
					country_uses_bio_ships = yes
				}
			}
			food = @m_t5_upkeep_energy
		}
	}

	ai_weight = {
		weight = 1
		modifier = {
			factor = 0.0
			no_resource_for_component = { RESOURCE = volatile_motes }
		}
	}
}

# ####################
# Torpedoes
# ####################

### Torpedo Launcher
weapon_component_template = {
	key = "TORPEDO_1"
	size = torpedo
	entity = "turret_torpedo_entity"

	icon = "GFX_ship_part_torpedo_1"
	icon_frame = 1
	type = missile

	firing_arc = 25.0

	prerequisites = { "tech_torpedoes_1" }
	component_set = "TORPEDO_1"
	projectile_gfx = "large_torpedo"
	tags = { weapon_type_explosive g_slot }
	ai_tags = { weapon_role_anti_shield explosive explosive_stealth }
	potential = {
		ship_uses_mauler_components = no
		ship_uses_harbinger_components = no
	}
	upgrades_to = "TORPEDO_2"
	resources = {
		category = ship_components
		cost = {
			alloys = @m_t3_cost
		}
		upkeep = {
			energy = @m_t3_upkeep_energy
			alloys = @m_t3_upkeep_alloys
		}
	}
}

### Armored Torpedoes
weapon_component_template = {
	key = "TORPEDO_2"
	size = torpedo
	entity = "turret_torpedo_entity"

	icon = "GFX_ship_part_torpedo_2"
	icon_frame = 1
	type = missile

	firing_arc = 25.0

	prerequisites = { "tech_torpedoes_2" }
	component_set = "TORPEDO_2"
	projectile_gfx = "large_torpedo_02"
	tags = { weapon_type_explosive g_slot }
	ai_tags = { weapon_role_anti_shield explosive explosive_stealth }
	potential = {
		ship_uses_mauler_components = no
		ship_uses_harbinger_components = no
	}
	upgrades_to = "TORPEDO_3"
	resources = {
		category = ship_components
		cost = {
			alloys = @m_t4_cost
			volatile_motes = @m_t4_rare
		}
		upkeep = {
			energy = @m_t4_upkeep_energy
			alloys = @m_t4_upkeep_alloys
		}
	}

	ai_weight = {
		weight = 1
		modifier = {
			factor = 0.0
			no_resource_for_component = { RESOURCE = volatile_motes }
		}
	}
}

### Devastator Torpedoes
weapon_component_template = {
	key = "TORPEDO_3"
	size = torpedo
	entity = "turret_torpedo_entity"

	icon = "GFX_ship_part_torpedo_3"
	icon_frame = 1
	type = missile

	firing_arc = 25.0

	prerequisites = { "tech_torpedoes_3" }
	component_set = "TORPEDO_3"
	projectile_gfx = "large_torpedo_03"
	tags = { weapon_type_explosive g_slot }
	ai_tags = { weapon_role_anti_shield explosive explosive_stealth }
	potential = {
		ship_uses_mauler_components = no
		ship_uses_harbinger_components = no
	}
	resources = {
		category = ship_components
		cost = {
			alloys = @m_t5_cost
			volatile_motes = @m_t5_rare
		}
		upkeep = {
			energy = @m_t5_upkeep_energy
			alloys = @m_t5_upkeep_alloys
		}
	}

	ai_weight = {
		weight = 1
		modifier = {
			factor = 0.0
			no_resource_for_component = { RESOURCE = volatile_motes }
		}
	}
}


# ####################
# Energy Torpedoes
# ####################

# NOTES:
# Energy torpedoes are deliberately energy weapons that fit in a torpedo slot.
# They use the costs and upkeep of large-size weapons, unlike regular torpedoes.

# ## Energy Torpedoes 1
weapon_component_template = {
	key = "ENERGY_TORPEDO_1"
	size = torpedo
	type = instant

	firing_arc = 25.0
	min_range = 3.0 #7.0 #45.0

	icon = "GFX_ship_part_energy_torpedo_1"
	icon_frame = 1
	prerequisites = { "tech_energy_torpedoes_1" }
	potential = {
		OR = {
			from = {
				country_uses_bio_ships = no
			}
			is_arkship_ship = yes
		}
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "ENERGY_TORPEDO_1"
	projectile_gfx = "proton_torpedoes"
	tags = { weapon_type_energy }
	ai_tags = { weapon_role_artillery artillery artillery_stealth energy_torpedoes energy_torpedoes_stealth }
	ai_tag_weight = 0
	upgrades_to = "ENERGY_TORPEDO_2"
	resources = {
		category = ship_components
		cost = {
			alloys = @l_t5_cost
			exotic_gases = @l_t5_rare
		}
		upkeep = {
			alloys = @l_t5_upkeep_alloys
			energy = @l_t5_upkeep_energy
		}
	}

	ai_weight = {
		weight = 1
		modifier = {
			factor = 0.0
			no_resource_for_component = { RESOURCE = exotic_gases }
		}
		modifier = {
			factor = @cosmic_storm_gravity_ai_weight_factor
			has_country_flag = affected_by_gravity_storm
		}
	}
}

# ## Energy Torpedoes 2
weapon_component_template = {
	key = "ENERGY_TORPEDO_2"
	size = torpedo
	type = instant

	firing_arc = 25.0
	min_range = 3.0 #7.0 #45.0

	icon = "GFX_ship_part_energy_torpedo_2"
	icon_frame = 1
	prerequisites = { "tech_energy_torpedoes_2" }
	potential = {
		OR = {
			from = {
				country_uses_bio_ships = no
			}
			is_arkship_ship = yes
		}
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "ENERGY_TORPEDO_2"
	projectile_gfx = "neutron_torpedoes"
	tags = { weapon_type_energy }
	ai_tags = { weapon_role_artillery artillery artillery_stealth energy_torpedoes energy_torpedoes_stealth }
	ai_tag_weight = 0
	resources = {
		category = ship_components
		cost = {
			alloys = @l_t6_cost
			exotic_gases = @l_t6_rare
		}
		upkeep = {
			alloys = @l_t6_upkeep_alloys
			energy = @l_t6_upkeep_energy
		}
	}

	ai_weight = {
		weight = 1
		modifier = {
			factor = 0.0
			no_resource_for_component = { RESOURCE = exotic_gases }
		}
		modifier = {
			factor = @cosmic_storm_gravity_ai_weight_factor
			has_country_flag = affected_by_gravity_storm
		}
	}
}