# possible section models:
# SHIPYARD_STARBASE_SECTION
# REFINERY_STARBASE_SECTION
# SCIENCE_STARBASE_SECTION
# HANGAR_STARBASE_SECTION
# ASSEMBLYYARD_STARBASE_SECTION
#
#####################################################################

##############################################


acot_theta_starbase_shipyard = {
	icon = "GFX_spaceport_module_acot_theta_starbase_shipyard"
	section = "ACOT_THETA_SHIPYARD_STARBASE_SECTION"
	construction_days = 5
	initial = yes

	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel	
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	resources = {
		category = starbase_modules
		cost = {
		}


	}

	on_finished = {
        set_ship_construction_type = starbase_shipyard
    }

	on_destroyed = {
        if = {
            limit = { NOT = { has_starbase_module = shipyard } }
            set_ship_construction_type = none
        }
    }

	station_modifier = {
		starbase_shipyard_capacity_add = 25
	}
	
	ai_build_at_chokepoint = no
	ai_build_outside_chokepoint = yes
	ai_weight = {
		weight = 50
	#	modifier = {
	#		factor = 100
	#		NOT = { has_starbase_module = shipyard }
	#	}
	}
}

acot_theta_starbase_anchorage = {
	icon = "GFX_spaceport_module_acot_theta_starbase_anchoragel"
	section = "ACOT_THETA_SHIPYARD_STARBASE_SECTION"
	construction_days = 5

	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel	
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	resources = {
		category = starbase_modules
		cost = {
		}
	}

	country_modifier = {
		country_naval_cap_add = 10000
		country_resource_max_add = 500000
	}
	triggered_country_modifier = {
		potential = { has_starbase_building = naval_logistics_office }
		country_naval_cap_add = 10000
	}
	triggered_country_modifier = {
		potential = { has_starbase_building = acot_theta_starbase_super_computer }
		country_naval_cap_add = 10000
		country_resource_max_add = 500000
	}
	
	ai_build_at_chokepoint = no
	ai_build_outside_chokepoint = yes
	ai_weight = {
		weight = 20
		modifier = {
			factor = 2
			count_starbase_modules = {
				type = acot_theta_starbase_anchorage
				count < 2
			}
		}		
	}
}

acot_theta_starbase_gun_battery = {
	section = "ACOT_THETA_BATTERY_STARBASE_SECTION"
	construction_days = 5
	icon = "GFX_spaceport_module_acot_theta_starbase_gun_battery"

	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel	
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	resources = {
		category = starbase_modules
		cost = {
		}
	}

	station_modifier = {
		starbase_trade_protection_range_add = 2
		starbase_trade_protection_add = 20
	}
	
	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 10
		modifier = {
			factor = 2
			exists = owner
			owner = {
				OR = {
					is_preferred_weapons = weapon_type_energy
					is_preferred_weapons = weapon_type_kinetic
				}			
			}
		}
	}

	show_in_tech = "tech_mass_drivers_1"
}

acot_theta_starbase_laser_battery = {
	section = "ACOT_THETA_PD_STARBASE_SECTION"
	construction_days = 5
	icon = "GFX_spaceport_module_acot_theta_starbase_laser_battery"

	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel		
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	resources = {
		category = starbase_modules
		cost = {
		}


	}

	station_modifier = {
		starbase_trade_protection_range_add = 2
		starbase_trade_protection_add = 20
	}
	
	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 10
		modifier = {
			factor = 2
			exists = owner
			owner = {
				OR = {
					is_preferred_weapons = weapon_type_energy
					is_preferred_weapons = weapon_type_kinetic
				}			
			}
		}
	}

}

acot_theta_starbase_missile_battery = {
	section = "ACOT_THETA_MISSILE_STARBASE_SECTION"
	icon = "GFX_spaceport_module_acot_theta_starbase_missile_battery"
	construction_days = 5	

	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel		
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	resources = {
		category = starbase_modules
		cost = {
		}


	}

	station_modifier = {
		starbase_trade_protection_range_add = 2
		starbase_trade_protection_add = 20
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 10
		modifier = {
			factor = 2
			exists = owner
			owner = { is_preferred_weapons = weapon_type_explosive }
		}	
	}

}

acot_theta_starbase_hangar_bay = {
	icon = "GFX_spaceport_module_acot_theta_starbase_hangar_bay"
	section = "ACOT_THETA_HANGAR_STARBASE_SECTION"
	construction_days = 5	
	
	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel		
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}


	resources = {
		category = starbase_modules
		cost = {
		}


	}

	station_modifier = {
		starbase_trade_protection_range_add = 2
		starbase_trade_protection_add = 20
	}

	ai_build_outside_chokepoint = yes
	ai_weight = {
		weight = 10
		modifier = {
			factor = 2
			exists = owner
			owner = { is_preferred_weapons = weapon_type_strike_craft }
		}	
	}

}

acot_theta_starbase_dark_generator_ee = {
	icon = "GFX_spaceport_module_acot_theta_starbase_dark_generator_EE"
	section = "ACOT_THETA_SHIPYARD_STARBASE_SECTION"
	construction_days = 5
	initial = yes
	
	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel		
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	possible = {
	}
	

	resources = {
		category = starbase_modules
		cost = {
		}
		upkeep = {
			sm_sr_perfect_runic_energy = 1
		}
		produces = {
			sr_dark_matter = 25000
			acot_sr_dark_energy = 25000
		}
	}
	
	ai_build_at_chokepoint = no
	ai_weight = {
		weight = 15
	}
}

acot_theta_starbase_dark_generator_s = {
	icon = "GFX_spaceport_module_acot_theta_starbase_dark_generator_S"
	section = "ACOT_THETA_SHIPYARD_STARBASE_SECTION"
	construction_days = 5
	initial = yes
	
	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel		
		owner = { 
			has_technology = tech_precursor_theia_design
			has_technology = tech_dark_matter_power_core_se
		}	
	}

	possible = {
	}
	

	resources = {
		category = starbase_modules
		cost = {
		}
		upkeep = {
			sm_sr_perfect_runic_energy = 1
		}
		produces = {
			acot_sr_stellarite = 5000
		}
	}
	
	ai_build_at_chokepoint = no
	ai_weight = {
		weight = 15
	}
}

acot_theta_starbase_dark_generator_re = {
	icon = "GFX_spaceport_module_acot_theta_starbase_dark_generator_RE"
	section = "ACOT_THETA_SHIPYARD_STARBASE_SECTION"
	construction_days = 5
	initial = yes
	
	potential = {
		has_aot_mod = yes
		#has_global_flag = has_aot_mod
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel		
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	possible = {
	}
	

	resources = {
		category = starbase_modules
		cost = {
		}
		upkeep = {
			sm_sr_perfect_runic_energy = 1
		}
		produces = {
			aot_sr_runic_power = 5000
		}
	}
	
	ai_build_at_chokepoint = no
	ai_weight = {
		weight = 15
	}
}


acot_theta_starbase_lab = {
	icon = "GFX_spaceport_module_acot_theta_starbase_lab"
	section = "ACOT_THETA_SHIPYARD_STARBASE_SECTION"
	construction_days = 5
	initial = yes
	
	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel			
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	resources = {
		category = starbase_modules
		cost = {
		}
		produces = {
			society_research = 1000
			engineering_research = 1000
			physics_research = 1000
		}
		produces = {
			trigger = {
				solar_system = {
					is_star_class = sc_black_hole			
				}				
			}
			society_research = 1000
			engineering_research = 1000
			physics_research = 1000
		}	
	}
	
	station_modifier = {
	}

	ai_build_at_chokepoint = no
	ai_weight = {
		weight = 15
	}
}

######## ANTI OVERFLOW COMPONENTS

acot_theta_no_hull_regen_1 = {
	icon = "GFX_ship_part_dark_matter_hull_noregen1"
	section = "ACOT_THETA_SHIPYARD_STARBASE_SECTION"
	construction_days = 5
	initial = yes
	
	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel			
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	resources = {
		category = starbase_modules
		cost = {
		}	
	}
	
	station_modifier = {
		ship_hull_regen_add_perc = -0.01
	}

	ai_build_at_chokepoint = no
	ai_weight = {
		weight = 0
	}
}

acot_theta_no_hull_regen_2 = {
	icon = "GFX_ship_part_dark_matter_hull_noregen2"
	section = "ACOT_THETA_SHIPYARD_STARBASE_SECTION"
	construction_days = 5
	initial = yes
	
	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel			
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	resources = {
		category = starbase_modules
		cost = {
		}	
	}
	
	station_modifier = {
		ship_hull_regen_add_perc = -0.05
	}

	ai_build_at_chokepoint = no
	ai_weight = {
		weight = 0
	}
}

acot_theta_no_armor_regen_1 = {
	icon = "GFX_ship_part_dark_matter_armor_noregen1"
	section = "ACOT_THETA_SHIPYARD_STARBASE_SECTION"
	construction_days = 5
	initial = yes
	
	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel			
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	resources = {
		category = starbase_modules
		cost = {
		}	
	}
	
	station_modifier = {
		ship_armor_regen_add_perc = -0.01
	}

	ai_build_at_chokepoint = no
	ai_weight = {
		weight = 0
	}
}

acot_theta_no_armor_regen_2 = {
	icon = "GFX_ship_part_dark_matter_armor_noregen2"
	section = "ACOT_THETA_SHIPYARD_STARBASE_SECTION"
	construction_days = 5
	initial = yes
	
	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel			
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	resources = {
		category = starbase_modules
		cost = {
		}	
	}
	
	station_modifier = {
		ship_armor_regen_add_perc = -0.05
	}

	ai_build_at_chokepoint = no
	ai_weight = {
		weight = 0
	}
}

acot_theta_no_shield_regen_1 = {
	icon = "GFX_ship_part_dark_matter_shield_noregen1"
	section = "ACOT_THETA_SHIPYARD_STARBASE_SECTION"
	construction_days = 5
	initial = yes
	
	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel			
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	resources = {
		category = starbase_modules
		cost = {
		}	
	}
	
	station_modifier = {
		ship_shield_regen_add_perc = -0.01
	}

	ai_build_at_chokepoint = no
	ai_weight = {
		weight = 0
	}
}

acot_theta_no_shield_regen_2 = {
	icon = "GFX_ship_part_dark_matter_shield_noregen2"
	section = "ACOT_THETA_SHIPYARD_STARBASE_SECTION"
	construction_days = 5
	initial = yes
	
	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_theta_starcitadel			
		owner = { 
			has_technology = tech_precursor_theia_design
		}	
	}

	resources = {
		category = starbase_modules
		cost = {
		}	
	}
	
	station_modifier = {
		ship_shield_regen_add_perc = -0.05
	}

	ai_build_at_chokepoint = no
	ai_weight = {
		weight = 0
	}
}

################## ORBITALS ##########################

acot_theta_ring_shipyard = {
	icon = "GFX_spaceport_module_acot_theta_starbase_shipyard"
	section = "ACOT_THETA_ORBITAL_RING_DEFAULT_MODULE_SECTION"
	construction_days = 5

	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_orbital_ring_t5		
		owner = { 
			has_technology = tech_precursor_orbital_ring
		}
	}

	resources = {
		category = starbase_modules
		cost = {
		}
		upkeep = {
			trigger = {
				solar_system = {
					NOT = {
						is_star_class = sc_black_hole		
					}
	
				}				
			}	
			sr_dark_matter = 5
		}
	}

	station_modifier = {
		starbase_shipyard_capacity_add = 25
	}

	on_finished = {
        set_ship_construction_type = starbase_shipyard
    }

	on_destroyed = {
        if = {
            limit = { NOT = { has_starbase_module = shipyard } }
            set_ship_construction_type = none
        }
    }

	triggered_station_modifier = {
		
	}
	
	ai_build_at_chokepoint = no
	ai_build_outside_chokepoint = yes
	ai_weight = {
		weight = 50
	#	modifier = {
	#		factor = 100
	#		NOT = { has_starbase_module = shipyard }
	#	}
	}
}

acot_theta_ring_anchorage = {
	icon = "GFX_spaceport_module_acot_theta_starbase_anchoragel"
	section = "ACOT_THETA_ORBITAL_RING_DEFAULT_MODULE_SECTION"
	construction_days = 5

	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_orbital_ring_t5		
		owner = { 
			has_technology = tech_precursor_orbital_ring
		}
	}

	resources = {
		category = starbase_modules
		cost = {
		}
		upkeep = {
			trigger = {
				solar_system = {
					NOT = {
						is_star_class = sc_black_hole		
					}
	
				}				
			}	
			sr_dark_matter = 5
		}	
	}

	country_modifier = {
		country_naval_cap_add = 10000
		country_resource_max_add = 500000
	}
	triggered_country_modifier = {
		potential = { has_starbase_building = naval_logistics_office }
		country_naval_cap_add = 10000
	}
	triggered_country_modifier = {
		potential = { has_starbase_building = acot_theta_starbase_super_computer }
		country_naval_cap_add = 10000
		country_resource_max_add = 500000
	}
	
	ai_build_at_chokepoint = no
	ai_build_outside_chokepoint = yes
	ai_weight = {
		weight = 20
		modifier = {
			factor = 2
			count_starbase_modules = {
				type = acot_orbital_ring_anchorage
				count < 2
			}
		}		
	}
}

acot_theta_ring_habitat = {
	icon = "GFX_spaceport_module_acot_theta_starbase_lab"
	section = "ACOT_THETA_ORBITAL_RING_DEFAULT_MODULE_SECTION"
	construction_days = 5

	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_orbital_ring_t5		
		owner = { 
			has_technology = tech_precursor_theia_design
		}
	}

	resources = {
		category = starbase_modules
		cost = {
		}
	}

	planet_modifier = {
		planet_max_districts_add = 10
		planet_max_buildings_add = 5
	}
	
	ai_build_at_chokepoint = no
	ai_build_outside_chokepoint = yes
	ai_weight = {
		weight = 20
		modifier = {
			factor = 2
			count_starbase_modules = {
				type = acot_orbital_ring_anchorage
				count < 2
			}
		}		
	}
}

acot_theta_ring_pd = {
	section = "ACOT_THETA_ORBITAL_RING_PD_MODULE_SECTION"
	construction_days = 5
	icon = "GFX_spaceport_module_acot_theta_starbase_laser_battery"

	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_orbital_ring_t5		
		owner = { 
			has_technology = tech_precursor_orbital_ring
		}
	}

	resources = {
		category = starbase_modules
		cost = {
		}
		upkeep = {
			trigger = {
				solar_system = {
					NOT = {
						is_star_class = sc_black_hole		
					}
	
				}				
			}	
			sr_dark_matter = 5
		}	
	}

	station_modifier = {
		ship_cloaking_detection_add = 1
	}
	
	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 10
		modifier = {
			factor = 2
			exists = owner
			owner = {
				OR = {
					is_preferred_weapons = weapon_type_energy
					is_preferred_weapons = weapon_type_kinetic
				}			
			}
		}
	}
}

acot_theta_ring_battery = {
	section = "ACOT_THETA_ORBITAL_RING_BATTERY_MODULE_SECTION"
	construction_days = 5
	icon = "GFX_spaceport_module_acot_theta_starbase_gun_battery"

	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_orbital_ring_t5		
		owner = { 
			has_technology = tech_precursor_orbital_ring
		}
	}

	resources = {
		category = starbase_modules
		cost = {
		}
		upkeep = {
			trigger = {
				solar_system = {
					NOT = {
						is_star_class = sc_black_hole		
					}
	
				}				
			}	
			sr_dark_matter = 5
		}	
	}

	station_modifier = {
		ship_cloaking_detection_add = 1
	}
	
	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 10
		modifier = {
			factor = 2
			exists = owner
			owner = {
				OR = {
					is_preferred_weapons = weapon_type_energy
					is_preferred_weapons = weapon_type_kinetic
				}			
			}
		}
	}
}

acot_theta_ring_missile = {
	section = "ACOT_THETA_ORBITAL_RING_MISSILE_MODULE_SECTION"
	construction_days = 5
	icon = "GFX_spaceport_module_acot_theta_starbase_missile_battery"

	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_orbital_ring_t5		
		owner = { 
			has_technology = tech_precursor_orbital_ring
		}
	}

	resources = {
		category = starbase_modules
		cost = {
		}
		upkeep = {
			trigger = {
				solar_system = {
					NOT = {
						is_star_class = sc_black_hole		
					}
	
				}				
			}	
			sr_dark_matter = 5
		}	
	}

	station_modifier = {
		ship_cloaking_detection_add = 1
	}
	
	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 10
		modifier = {
			factor = 2
			exists = owner
			owner = {
				is_preferred_weapons = weapon_type_explosive			
			}
		}
	}
}

acot_theta_ring_hangar = {
	section = "ACOT_THETA_ORBITAL_RING_HANGAR_MODULE_SECTION"
	construction_days = 5
	icon = "GFX_spaceport_module_acot_theta_starbase_hangar_bay"

	potential = {
		exists = owner
		has_starbase_size >= acot_precusor_orbital_ring_t5		
		owner = { 
			has_technology = tech_precursor_orbital_ring
		}
	}

	resources = {
		category = starbase_modules
		cost = {
		}
		upkeep = {
			trigger = {
				solar_system = {
					NOT = {
						is_star_class = sc_black_hole		
					}
	
				}				
			}	
			sr_dark_matter = 5
		}	
	}

	station_modifier = {
		ship_cloaking_detection_add = 1
	}
	
	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 10
		modifier = {
			factor = 2
			exists = owner
			owner = {
				is_preferred_weapons = weapon_type_strike_craft		
			}
		}
	}
}