# Worldseeders
# Scope: planet (one inside our borders). Can this world be marked as a terraforming
# candidate and then actually be terraformed by the system's owner?
# The conditions follow vanilla's links in common/terraform/02_special_terraform_links.txt:
# - pc_barren / pc_barren_cold + terraforming_candidate: any owner with
#   tech_climate_restoration (World Shaper, which this perk requires, needs that tech);
# - pc_toxic + toxic_terraforming_candidate: the owner needs ap_detox or the
#   knights_detox flag;
# - pc_frozen + frozen_terraforming_candidate: the owner needs ap_hydrocentric and an
#   aquatic founder species.
# pc_molten has no candidate link, so molten worlds are never marked.
apb_seeders_valid_world = {
	OR = {
		is_planet_class = pc_barren
		is_planet_class = pc_barren_cold
		AND = {
			is_planet_class = pc_toxic
			solar_system = {
				exists = space_owner
				space_owner = {
					OR = {
						has_ascension_perk = ap_detox
						has_country_flag = knights_detox
					}
				}
			}
		}
		AND = {
			is_planet_class = pc_frozen
			solar_system = {
				exists = space_owner
				space_owner = {
					has_ascension_perk = ap_hydrocentric
					OR = {
						has_aquatic_trait = yes
						has_trait = trait_robot_aquatic
					}
				}
			}
		}
	}
	is_terraforming_candidate = no
	is_terraforming = no
	has_anomaly = no
	NOR = {
		has_planet_flag = megastructure
		has_planet_flag = has_megastructure
		has_deposit = d_nanites_deposit
	}
	# Vanilla removes candidates from Dyson Sphere systems (01_dyson_sphere.txt).
	solar_system = { NOT = { has_star_flag = dyson_sphere_built } }
}

# Scope: country. Is there a world left to find?
apb_seeders_has_valid_world = {
	any_planet_within_border = {
		apb_seeders_valid_world = yes
	}
}
