#Remember to update operation_sabotage_starbase if you add any new buildings.
# You will need to update the description, espionage_sabotage_starbase_building, remove_sabotage_starbase_flag, and has_nonshipyard_starbase_buildings

ring_minerals_hub = {
	icon = "GFX_orbitalring_mineral_hub"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = { has_technology = tech_mineral_purification_2 }
		is_orbital_ring = yes
	}

	inline_script = {
		script = buildings/planet_job_resource_produces_add
		JOB = miners # note this expects the plural, i.e. 'planet_miners_minerals_produces_add'
		RESOURCE = minerals
		AMOUNT = 0.5
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 100
			volatile_motes = 100
		}
		upkeep = {
			energy = 2
			volatile_motes = 1
		}
	}

	show_in_tech = "tech_mineral_purification_2"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_weight = {
		weight = 100
	}
}

ring_energy_hub = {
	icon = "GFX_orbitalring_energy_hub"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = { has_technology = tech_power_hub_2 }
		is_orbital_ring = yes
	}

	inline_script = {
		script = buildings/planet_job_resource_produces_add
		JOB = technician # note this expects the singular, i.e. 'planet_technician_energy_produces_add'
		RESOURCE = energy
		AMOUNT = 0.5
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 100
			exotic_gases = 100
		}
		upkeep = {
			energy = 2
			exotic_gases = 1
		}
	}

	show_in_tech = "tech_power_hub_2"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_weight = {
		weight = 100
	}
}

ring_food_hub = {
	icon = "GFX_orbitalring_food_hub"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = { has_technology = tech_food_processing_2 }
		is_orbital_ring = yes
	}

	inline_script = {
		script = buildings/planet_job_resource_produces_add
		JOB = farmers
		RESOURCE = food
		AMOUNT = 0.5
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 100
			volatile_motes = 100
		}
		upkeep = {
			energy = 2
			volatile_motes = 1
		}
	}

	show_in_tech = "tech_food_processing_2"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_weight = {
		weight = 100
	}
}

ring_trade_hub = {
	icon = "GFX_orbitalring_trade_hub"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = {
			has_technology = tech_interstellar_economics
			is_gestalt = no
		}
		is_orbital_ring = yes
	}

	planet_modifier = {
		planet_jobs_trade_produces_mult = 0.05
	}

	triggered_planet_modifier = {
		custom_tooltip = "sm_ring_trade_hub_effect"
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 100
			rare_crystals = 100
		}

		upkeep = {
			energy = 2
			rare_crystals = 1
		}
	}

	show_in_tech = "tech_interstellar_economics"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_weight = {
		weight = 100
	}
}

ring_bureaucracy_hub = {
	icon = "GFX_orbitalring_bureaucracy_hub"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = {
			has_technology = tech_effective_bureaucracy
			is_gestalt = no
		}
		is_orbital_ring = yes
	}

	planet_modifier = {
		planet_bureaucrats_unity_produces_add = 0.5
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 200
			rare_crystals = 300
		}

		upkeep = {
			energy = 2
			rare_crystals = 1
		}
	}

	show_in_tech = "tech_effective_bureaucracy"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
		is_gestalt = no
	}

	ai_weight = {
		weight = 100
	}
}

ring_synapse_hub = {
	icon = "GFX_orbitalring_synapse_hub"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = {
			has_technology = tech_hive_cluster
			is_hive_empire = yes
			is_wilderness_empire = no # failsafe: implied by denial of 'Hive Cluster' tech
		}
		is_orbital_ring = yes
	}

	planet_modifier = {
		custom_tooltip = "sm_ring_synapse_hub_effect"
		planet_bureaucrats_unity_produces_add = 0.5
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 200
			exotic_gases = 300
		}

		upkeep = {
			energy = 2
			exotic_gases = 1
		}
	}

	show_in_tech = "tech_hive_cluster"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_weight = {
		weight = 100
	}
}

ring_maintenance_hub = {
	icon = "GFX_orbitalring_maintenance_hub"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = {
			has_technology = tech_resource_processing_algorithms
			is_machine_empire = yes
		}
		is_orbital_ring = yes
	}

	planet_modifier = {
		custom_tooltip = "sm_ring_maintenance_hub_effect"
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 200
			exotic_gases = 300
		}

		upkeep = {
			energy = 2
			exotic_gases = 1
		}
	}

	show_in_tech = "tech_resource_processing_algorithms"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_weight = {
		weight = 100
	}
}

ring_consumer_goods_hub = {
	icon = "GFX_orbitalring_consumer_hub"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = {
			has_technology = tech_luxuries_2
			country_uses_consumer_goods = yes
		}
		is_orbital_ring = yes
	}

	triggered_planet_modifier = {
		potential = {
			industrial_jobs_are_catalytic_trigger = no
		}
		planet_artisans_consumer_goods_produces_add = 0.5
		planet_artisans_minerals_upkeep_add = 1
	}

	triggered_planet_modifier = {
		potential = {
			industrial_jobs_are_catalytic_trigger = yes
		}
		planet_artisans_consumer_goods_produces_add = 0.5
		planet_artisans_food_upkeep_add = 1
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 200
			rare_crystals = 300
		}

		upkeep = {
			energy = 5
			rare_crystals = 2
		}
	}

	show_in_tech = "tech_luxuries_2"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_weight = {
		weight = 100
	}
}

ring_alloys_hub = {
	icon = "GFX_orbitalring_alloy_hub"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = { has_technology = tech_alloys_2 }
		is_orbital_ring = yes
	}

	triggered_planet_modifier = {
		potential = {
			industrial_jobs_are_catalytic_trigger = no
		}
		planet_metallurgists_alloys_produces_add = 0.5
		planet_metallurgists_minerals_upkeep_add = 2
	}

	triggered_planet_modifier = {
		potential = {
			industrial_jobs_are_catalytic_trigger = yes
		}
		planet_metallurgists_alloys_produces_add = 0.5
		planet_metallurgists_food_upkeep_add = 2
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 200
			volatile_motes = 300
		}

		upkeep = {
			energy = 5
			volatile_motes = 2
		}
	}

	show_in_tech = "tech_alloys_2"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_weight = {
		weight = 100
	}
}

ring_psi_corps = {
	icon = "GFX_orbitalring_psi_corps"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = {
			NOT = {
				has_origin = origin_endbringers
			}
			has_psi_corps_tradition = yes
		}
		planet? = {
			OR = {
				NOR = {
					has_modifier = resort_colony
					has_modifier = slave_colony
				}
				AND = { # Allow Psi Corps on pleasure worlds
					has_modifier = resort_colony
					has_designation = col_pleasure
				}
			}
		}
		is_orbital_ring = yes
	}

	possible = {
		planet = {
			NOR = {
				has_building_construction = building_psi_corps
				has_building = building_psi_corps
			}
		}
	}

	abort_trigger = {
		exists = owner
		owner = {
			has_psi_corps_tradition = no
		}
	}

	destroy_trigger = {
		exists = owner
		owner = {
			has_psi_corps_tradition = no
		}
	}

	planet_modifier = {
		planet_stability_add = 2
	}

	inline_script = {
		script = jobs/telepaths_add
		AMOUNT = @building_static_jobs
	}

	triggered_planet_modifier = {
		potential = {
			planet = {
				OR = {
					num_assigned_jobs = {
						job = telepath
						value > 0
					}
					num_assigned_jobs = {
						job = dystopian_telepath
						value > 0
					}
					num_assigned_jobs = {
						job = telepath_drone
						value > 0
					}
				}
			}
		}
		psionic_pop_bonus_workforce_mult = 1
		mult = colony.value:psionic_workforce_from_telepaths
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 200
			rare_crystals = 300
		}

		upkeep = {
			energy = 5
			rare_crystals = 2
		}
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = yes

	ai_weight = {
		weight = 50
		modifier = {
			factor = 4
			planet = {
				OR = {
					has_designation = col_bureau
					has_designation = col_bureau_spiritualist
				}
			}
		}
	}
}

ring_orbital_shield_generator = {
	icon = "GFX_orbitalring_shield_generator"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_defense_cat

	potential = {
		exists = owner
		owner = {
			has_technology = tech_planetary_shield_generator
		}
		is_orbital_ring = yes
	}

	possible = {
		planet = {
			NOR = {
				has_building_construction = building_planetary_shield_generator
				has_building = building_planetary_shield_generator
			}
		}
	}

	station_modifier = {
		ship_shield_mult = 0.25
		ship_shield_hardening_add = 0.25
	}

	defense_platform_modifier = {
		ship_shield_mult = 0.25
		ship_shield_hardening_add = 0.25
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 200
			rare_crystals = 300
		}

		upkeep = {
			energy = 5
			rare_crystals = 2
		}
	}

	show_in_tech = "tech_planetary_shield_generator"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = yes

	ai_weight = {
		weight = 50
		modifier = {
			factor = 4
			planet = {
				has_designation = col_fortress
			}
		}
	}
}

ring_galactic_stock_exchange = {
	icon = "GFX_orbitalring_galactic_stock_exchange"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = {
			has_technology = tech_galactic_markets
		}
		is_orbital_ring = yes
		planet = {
			NOR = {
				has_modifier = resort_colony
				has_modifier = slave_colony
			}
		}
	}

	possible = {
		planet = {
			NOR = {
				has_building_construction = building_galactic_stock_exchange
				has_building = building_galactic_stock_exchange
			}
		}
	}

	abort_trigger = {
		exists = planet
		planet = {
			exists = owner
			OR = {
				owner = { is_regular_empire = no }
				has_modifier = slave_colony
				has_modifier = resort_colony
			}
		}
	}

	destroy_trigger = {
		exists = planet
		planet = {
			exists = owner
			OR = {
				owner = { is_regular_empire = no }
				has_modifier = slave_colony
				has_modifier = resort_colony
			}
		}
	}

	planet_modifier = {
		job_trader_add = @building_static_jobs_high
		planet_jobs_trade_produces_mult = 0.10
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 200
			rare_crystals = 300
		}

		upkeep = {
			energy = 5
			rare_crystals = 2
		}
	}

	show_in_tech = "tech_galactic_markets"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = yes

	ai_weight = {
		weight = 50
		modifier = {
			factor = 4
			planet = {
				planet_resource_compare = {
					resource = trade
					value > 50
					type = produces
				}
			}
		}
	}
}

ring_embassy_complex = {
	icon = "GFX_orbitalring_embassy_complex"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = {
			has_technology = tech_xeno_relations
			is_regular_empire = yes
		}
		is_orbital_ring = yes
		planet = {
			is_capital = yes
			NOR = {
				has_modifier = resort_colony
				has_modifier = slave_colony
			}
		}
	}

	possible = {
		planet = {
			NOR = {
				has_building_construction = building_embassy
				has_building = building_embassy
				has_building_construction = building_grand_embassy
				has_building = building_grand_embassy
			}
		}
	}

	abort_trigger = {
		OR = {
			AND = {
				exists = owner
				owner = { is_regular_empire = no }
			}
			planet = { is_capital = no }
		}
	}

	destroy_trigger = {
		OR = {
			AND = {
				exists = owner
				owner = { is_regular_empire = no }
			}
			planet = { is_capital = no }
		}
	}

	country_modifier = {
		envoys_add = 2
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_worker_coop_empire = no
				is_gestalt = no
			}
		}
		job_politician_add = @building_static_jobs_low
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_worker_coop_empire = yes
			}
		}
		job_bureaucrat_add = @building_static_jobs_low
		mult = 1.5
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 200
			rare_crystals = 300
		}

		upkeep = {
			energy = 5
			rare_crystals = 2
		}
	}

	show_in_tech = "tech_xeno_relations"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = yes

	ai_weight = {
		weight = 100
	}
}

ring_noble_estates = {
	icon = "GFX_orbitalring_noble_estates"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = {
			has_valid_civic = civic_aristocratic_elite
		}
		is_orbital_ring = yes
		planet = {
			NOR = {
				has_modifier = slave_colony
			}
		}
	}

	possible = {
		planet = {
			NOR = {
				has_building_construction = building_noble_estates
				has_building = building_noble_estates
			}
		}
	}

	abort_trigger = {
		exists = owner
		NOT = {
			owner = { has_civic = civic_aristocratic_elite }
		}
	}

	destroy_trigger = {
		exists = owner
		NOT = {
			owner = { has_civic = civic_aristocratic_elite }
		}
	}

	planet_modifier = {
		planet_housing_add = 200
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_worker_coop_empire = no
				is_gestalt = no
			}
		}
		job_politician_add = @building_static_jobs
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_worker_coop_empire = yes
			}
		}
		job_bureaucrat_add = @building_static_jobs
		mult = 1.5
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 200
			exotic_gases = 300
		}

		upkeep = {
			energy = 5
			exotic_gases = 2
		}
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = yes

	ai_weight = {
		weight = 100
	}
}

ring_slave_processing_facility = {
	icon = "GFX_orbitalring_slave_processing_facility"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		exists = owner
		owner = {
			has_technology = tech_neural_implants
			is_regular_empire = yes
			OR = {
				has_policy_flag = slavery_allowed
				has_exploited_disconnected_drones = yes
			}
		}
		is_orbital_ring = yes
		planet = {
			NOR = {
				has_modifier = resort_colony
			}
		}
	}

	possible = {
		planet = {
			NOR = {
				has_building_construction = building_slave_processing
				has_building = building_slave_processing
			}
		}
	}

	abort_trigger = {
		exists = owner
		OR = {
			owner = {
				NOR = {
					is_regular_empire = yes
					has_policy_flag = slavery_allowed
					has_exploited_disconnected_drones = yes
				}
			}
			AND = {
				exists = planet
				planet = { has_modifier = resort_colony }
			}
		}
	}

	destroy_trigger = {
		exists = owner
		OR = {
			owner = {
				NOR = {
					is_regular_empire = yes
					has_policy_flag = slavery_allowed
					has_exploited_disconnected_drones = yes
				}
			}
			AND = {
				exists = planet
				planet = { has_modifier = resort_colony }
			}
		}
	}

	planet_modifier = {
		pop_slave_bonus_workforce_mult = 0.10
		pop_slave_political_power = -0.25
		planet_resettlement_unemployed_mult = -0.50
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 200
			volatile_motes = 300
		}

		upkeep = {
			energy = 5
			volatile_motes = 2
		}
	}

	show_in_tech = "tech_neural_implants"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = yes

	ai_weight = {
		weight = 100
	}
}

ring_feeder = {
	icon = "GFX_starbase_feeder"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_utility_cat

	potential = {
		exists = owner
		owner = { has_technology = tech_critter_feeder } # 'Fruitful Partnership' Origin
		is_orbital_ring = yes
	}

	planet_modifier = {
		planet_farmers_food_produces_add = 0.5
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 50
			volatile_motes = 50
		}

		upkeep = {
			energy = 1
			volatile_motes = 1
		}
	}

	custom_tooltip = sm_feeder_tt

	show_in_tech = "tech_critter_feeder"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_weight = {
		weight = 100
	}
}

ring_growth_chamber = {
	icon = "GFX_spaceport_module_growth_chamber"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_naval_support_cat

	potential = {
		exists = owner
		owner = { has_technology = tech_growth_chamber_1 }
		is_orbital_ring = yes
	}

	possible = {
		custom_tooltip = {
			fail_text = "requires_orbital_shipyard"
			OR = {
				has_starbase_module = orbital_ring_shipyard
				starbase_buildable_is_in_queue_before = {
					first = orbital_ring_shipyard
					second = ring_growth_chamber
				}
			}
		}
	}

	orbit_modifier = {
		bioship_growth_progress_add = 2
		ship_orbit_upkeep_mult = 1.00
	}

	triggered_station_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_growth_chamber_2
			}
		}
		starbase_shipyard_capacity_add = 2
	}


	resources = {
		category = starbase_buildings
		cost = {
			alloys = 100
			exotic_gases = 50
		}
		upkeep = {
			food = 10
			exotic_gases = 2
		}
	}

	show_in_tech = "tech_growth_chamber_1"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_weight = {
		weight = 100 #use same weight here - ai weighting is done in starbase_types.txt
	}
}

ring_aura_emitter = {
	icon = "GFX_starbase_aura_emitter"
	construction_days = 180
	starbase_type = orbital_ring
	category = sm_utility_cat

	potential = {
		has_shroud_dlc = yes
		exists = owner
		is_orbital_ring = yes
		owner = {
			has_technology = tech_aura_resonation
		}
	}

	resources = {
		category = starbase_modules
		cost = {
			alloys = 500
		}
		upkeep = {
			energy = 3
			sr_zro = 1
		}
	}

	on_finished = {
		solar_system = {
			if = {
				limit = { is_psionic_aura_suppressed = no }
				natural_spawn_psionic_aura = { OWNER = root.owner }
			}
		}
	}

	show_in_tech = "tech_aura_resonation"

	show_tech_unlock_if = {
		has_overlord_dlc = yes
		is_nomadic = no
	}

	ai_weight = {
		weight = 100 #use same weight here - ai weighting is done in starbase_types.txt
	}
}
