xt_penal_station = {
	entity = "enclave_station_trader_hull_entity"
	construction_entity = "enclave_station_trader_hull_entity"
	portrait = "GFX_megastructure_xt_penal_station"
	place_entity_on_planet_plane = no
	show_galactic_map_icon = no
	show_in_outliner = no
	use_planet_resource = yes
	custom_tooltip_requirements = "xt_penal_station_requirements"


	#portrait = "GFX_xt_prison_station_background"
	entity_offset = { x = -4 y = -4 }
	build_time = 360

	potential = {
		has_tradition = tr_xt_enforcement_3
	}
	resources = {
		category = megastructures
		cost = {
			alloys = 300
			influence = 25
		}
		produces = {
			unity = 5
		}
		upkeep = {
			energy = 3
		}
	}
	dismantle_potential = {
		always = yes
	}
	dismantle_cost = {
		category = megastructures
		cost = {
			energy = 500
		}
	}
	dismantle_time = 180
	on_dismantle_complete = {
		hidden_effect = {
			system_event = {
				id = xt.54
			}
		}
	}
	on_build_complete = {
		hidden_effect = {
			system_event = {
				id = xt.55
			}
		}
	}
	possible = {
		hidden_trigger = {
			exists = starbase
		}
		custom_tooltip = {
			fail_text = "requires_inside_border"
			is_inside_border = from
		}
	}
	placement_rules = {
		planet_possible = {
			custom_tooltip = {
				fail_text = "xt_requires_no_penal_station"
				solar_system = {
					has_xt_penal_station = no
				}			
			}
			custom_tooltip = {
				fail_text = "requires_surveyed_planet"
				is_surveyed = {			# prevent leaking habitability information
					who = prev.from
					status = yes
				}
			}
			custom_tooltip = {
				fail_text = "requires_no_anomaly"
				NOT = { has_anomaly = yes }
			}
			custom_tooltip = {
				fail_text = "requires_no_existing_megastructure"
				#can_build_megastructure_on_planet = yes
				NOR = {
					has_planet_flag = megastructure
					has_planet_flag = has_megastructure
					solar_system = {
						OR = {
							has_star_flag = ring_world_built
							has_star_flag = ithomes_gate
						}
					}
					is_planet_class = pc_ringworld_habitable
					is_planet_class = pc_ringworld_habitable_damaged
					is_planet_class = pc_ringworld_tech
					is_planet_class = pc_ringworld_tech_damaged
					is_planet_class = pc_ringworld_seam
					is_planet_class = pc_ringworld_seam_damaged
					is_planet_class = pc_habitat
				}
			}
			custom_tooltip = {
				fail_text = "requires_no_orbital_debris"
				NOR = {
					has_planet_flag = has_orbital_debris
				}
			}
			custom_tooltip = {
				fail_text = "requires_not_star"
				is_star = no
			}
			custom_tooltip = {
				fail_text = "requires_not_astral_scar"
				is_astral_scar = no
			}
			custom_tooltip = {
				fail_text = "requires_not_solarpunk"
				NOT = {
					solar_system = {
						has_star_flag = solarpunk_system_02
					}
				}
			}
		}
	}
	country_modifier = {
		xt_penal_station_modifier = 1
	}
}