@base_moon_distance = 10

# Black Holes
special_init_01 = {
	class = sc_black_hole
	
	usage = misc_system_init
	usage_odds = 2
	
	planet = {
		class = star
		orbit_distance = 0
	}
	
	change_orbit = 60
	
	planet = {
		count = { min = 0 max = 1 }
		class = "pc_barren"
		entity = "barren_planet_01_destroyed_entity"
		size = { min = 10 max = 15 }
	}
	
	change_orbit = 30
	
	planet = {
		count = { min = 0 max = 1 }
		class = "pc_barren_cold"
		size = { min = 10 max = 20 }
	}
}

# Primitive Civilizations
special_init_02 = {
	class = "rl_standard_stars"
	
	usage = misc_system_init
	usage_odds = 6

	flags = { primitive_system }
	
	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 20
	
	planet = {
		orbit_distance = 20
		count = { min = 0 max = 3 }
	}
	
	change_orbit = 20
	
	planet = {
		count = 1
		orbit_distance = 0
		class = "rl_habitable_normal"
		orbit_angle = { min = 90 max = 270 }
		size = { min = 15 max = 25 }
		#tile_blockers = none
		
		init_effect = {
			prevent_anomaly = yes
			random_list = {
				# Industrial Civilization
				50 = {
					create_species = {
						name = random
						class = random
						portrait = random
						homeworld = THIS
						traits = {
							trait = random_trait
							trait = random_trait
						}
					}
					create_country = {
						name = random
						government = fragmented_nations
						species = last_created
						ethos = random
						flag = {
							icon = {
								category = "spherical"
								file = "flag_spherical_22.dds"
							}
							background= {
								category = "backgrounds"
								file = "new_dawn.dds"
							}
							colors={
								"turquoise"
								"green"
								"null"
								"null"
							}
						}
						type = primitive
					}
					last_created_country = {
						set_graphical_culture = industrial_01
						random_list = {
							25 = { 
								set_country_flag = industrial_age 
								set_primitive_age = industrial_age
							}
							25 = { 
								set_country_flag = machine_age
								set_primitive_age = machine_age
							}
							25 = { 
								set_country_flag = atomic_age 
								set_primitive_age = atomic_age
							}
							25 = { 
								set_country_flag = early_space_age 
								set_primitive_age = early_space_age
							}
						}
					}
					create_colony = {
						owner = last_created_country
						species = last_created
						ethos = owner
					}				
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}					
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_factory"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}						
					}					
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_factory"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}						
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}						
					}					
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}						
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}							
					}
					random_tile = {
						limit = { has_building = "building_colony_shelter" }
						remove_building = yes
					}
					last_created_country = {
						if = {
							limit = { has_country_flag = industrial_age }
							PREV = {
								create_army = {
									name = "Industrial Army"
									owner = last_created
									species = last_created
									type = "industrial_army"
								}
								create_army = {
									name = "Industrial Army"
									owner = last_created
									species = last_created
									type = "industrial_army"
								}
							}
							break = yes
						}
						if = {
							limit = { has_country_flag = machine_age }
							PREV = {
								create_army = {
									name = "Industrial Army"
									owner = last_created
									species = last_created
									type = "industrial_army"
								}
								create_army = {
									name = "Industrial Army"
									owner = last_created
									species = last_created
									type = "industrial_army"
								}
								create_army = {
									name = "Industrial Army"
									owner = last_created
									species = last_created
									type = "industrial_army"
								}
								create_army = {
									name = "Industrial Army"
									owner = last_created
									species = last_created
									type = "industrial_army"
								}
							}
							break = yes
						}
						if = {
							limit = { has_country_flag = atomic_age }
							PREV = {
								create_army = {
									name = "Post-Atomic Army"
									owner = last_created
									species = last_created
									type = "postatomic_army"
								}
								create_army = {
									name = "Post-Atomic Army"
									owner = last_created
									species = last_created
									type = "postatomic_army"
								}
								create_army = {
									name = "Post-Atomic Army"
									owner = last_created
									species = last_created
									type = "postatomic_army"
								}
								create_army = {
									name = "Post-Atomic Army"
									owner = last_created
									species = last_created
									type = "postatomic_army"
								}
							}
							break = yes
						}
						if = {
							limit = { has_country_flag = early_space_age }
							PREV = {
								create_army = {
									name = "Post-Atomic Army"
									owner = last_created
									species = last_created
									type = "postatomic_army"
								}
								create_army = {
									name = "Post-Atomic Army"
									owner = last_created
									species = last_created
									type = "postatomic_army"
								}
								create_army = {
									name = "Post-Atomic Army"
									owner = last_created
									species = last_created
									type = "postatomic_army"
								}
								create_army = {
									name = "Post-Atomic Army"
									owner = last_created
									species = last_created
									type = "postatomic_army"
								}
								create_army = {
									name = "Post-Atomic Army"
									owner = last_created
									species = last_created
									type = "postatomic_army"
								}
								create_fleet = {
									name = "Space Station" 
								}
								last_created_fleet = {
									set_owner = last_created_country
									create_ship = {
										name = "Space Station"
										design = "Space Station"
									}
									set_location = PREV
								}
							}
							break = yes
						}
					}
				}
				# Medieval Civilization
				50 = {
					create_species = {
						name = random
						class = random
						portrait = random
						homeworld = THIS
						traits = {
							trait = random_trait
							trait = random_trait
						}
					}
					create_country = {
						name = random
						government = primitive_feudalism
						species = last_created
						ethos = random
						flag = {
							icon = {
								category = "special"
								file = "primitive.dds"
							}
							background= {
								category = "backgrounds"
								file = "new_dawn.dds"
							}
							colors={
								"turquoise"
								"green"
								"null"
								"null"
							}
						}
						type = primitive
					}
					last_created_country = {
						set_graphical_culture = preindustrial_01
						random_list = {
							20 = { 
								set_country_flag = bronze_age 
								set_primitive_age = bronze_age
							}
							20 = { 
								set_country_flag = iron_age 
								set_primitive_age = iron_age
							}
							20 = { 
								set_country_flag = late_medieval_age 
								set_primitive_age = late_medieval_age
							}
							20 = { 
								set_country_flag = renaissance_age 
								set_primitive_age = renaissance_age
							}
							20 = { 
								set_country_flag = steam_age 
								set_primitive_age = steam_age
							}
						}
					}
					create_colony = {
						owner = last_created_country
						species = last_created
						ethos = owner
					}					
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}					
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}					
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}
					random_tile = {
						limit = { has_building = "building_colony_shelter" }
						remove_building = yes
					}
					last_created_country = {
						if = {
							limit = { has_country_flag = bronze_age }
							PREV = {
								create_army = {
									name = "Primitive Army"
									owner = last_created
									species = last_created
									type = "primitive_army"
								}
							}
							break = yes
						}
						if = {
							limit = { has_country_flag = iron_age }
							PREV = {
								create_army = {
									name = "Primitive Army"
									owner = last_created
									species = last_created
									type = "primitive_army"
								}
								create_army = {
									name = "Primitive Army"
									owner = last_created
									species = last_created
									type = "primitive_army"
								}
							}
							break = yes
						}
						if = {
							limit = { has_country_flag = late_medieval_age }
							PREV = {
								create_army = {
									name = "Primitive Army"
									owner = last_created
									species = last_created
									type = "primitive_army"
								}
								create_army = {
									name = "Primitive Army"
									owner = last_created
									species = last_created
									type = "primitive_army"
								}
								create_army = {
									name = "Primitive Army"
									owner = last_created
									species = last_created
									type = "primitive_army"
								}
							}
							break = yes
						}
						if = {
							limit = { has_country_flag = renaissance_age }
							PREV = {
								create_army = {
									name = "Primitive Army"
									owner = last_created
									species = last_created
									type = "primitive_army"
								}
								create_army = {
									name = "Primitive Army"
									owner = last_created
									species = last_created
									type = "primitive_army"
								}
								create_army = {
									name = "Primitive Army"
									owner = last_created
									species = last_created
									type = "primitive_army"
								}
								create_army = {
									name = "Primitive Army"
									owner = last_created
									species = last_created
									type = "primitive_army"
								}
							}
							break = yes
						}
						if = {
							limit = { has_country_flag = steam_age }
							PREV = {
								create_army = {
									name = "Primitive Army"
									owner = last_created
									species = last_created
									type = "primitive_army"
								}
								create_army = {
									name = "Primitive Army"
									owner = last_created
									species = last_created
									type = "primitive_army"
								}
								create_army = {
									name = "Industrial Army"
									owner = last_created
									species = last_created
									type = "industrial_army"
								}
								create_army = {
									name = "Industrial Army"
									owner = last_created
									species = last_created
									type = "industrial_army"
								}
							}
							break = yes
						}
					}
				}
			}
		}
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	planet = {
		orbit_distance = 20
		count = { min = 1 max = 4 }
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	planet = {
		orbit_distance = 20
		count = { min = 0 max = 2 }
	}
}

# Sol System (Primitive Humans)
special_init_03 = {
	name = "Sol"
	class = "sc_g"
	asteroids_distance = 120

	flags = { primitive_sol }
	
	planet = {
		name = "Sol"
		class = "pc_g_star"
		orbit_distance = 0
		orbit_angle = 1
		size = 30
		has_ring = no
	}
	
	planet = {
		class = "pc_molten"
		orbit_distance = 40
		orbit_angle = 15
		size = 10
		has_ring = no
	}
	
	planet = {
		class = "pc_toxic"
		orbit_distance = 20
		orbit_angle = 125
		size = 20
		has_ring = no
	}
	
	planet = {
		class = "pc_continental"
		orbit_distance = 20
		orbit_angle = 120
		size = 20
		has_ring = no
		entity = "continental_planet_earth_entity"
		#tile_blockers = none
		modifiers = none
		
		init_effect = {
			random_list = {
				# Early Space Age
				25 = {
					create_species = {
						name = Human
						plural = Humans
						class = "MAM"
						portrait = "human"
						homeworld = THIS
						traits = {
							trait = "trait_quick_learners"
							trait = "trait_nomadic"
						}
					}
					create_country = {
						name = random
						government = fragmented_nations
						species = last_created
						ethos = {
							ethic = "ethic_xenophile"
							ethic = "ethic_fanatic_individualist"			
						}
						flag = {
							icon = {
								category = "human"
								file = "flag_human_9.dds"
							}
							background= {
								category = "backgrounds"
								file = "circle.dds"
							}
							colors={
								"dark_blue"
								"green"
								"null"
								"null"
							}
						}
						type = primitive
					}
					last_created_country = {
						set_graphical_culture = industrial_01
						set_country_flag = early_space_age
						set_country_flag = humans_early_space_age
						set_primitive_age = early_space_age
					}
					create_colony = {
						owner = last_created_country
						species = last_created
						ethos = {
							ethic = "ethic_xenophile"
							ethic = "ethic_fanatic_individualist"			
						}
					}
					create_army = {
						name = "US Armed Forces West"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
					create_army = {
						name = "US Armed Forces East"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
					create_army = {
						name = "Chinese PLA"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
					create_army = {
						name = "Russian Armed Forces"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
					create_army = {
						name = "EU Combined Forces"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
					create_fleet = {
						name = "ISS II" 
					}
					last_created_fleet = {
						set_owner = last_created_country
						create_ship = {
							name = "ISS II"
							design = "Space Station"
						}
						set_location = PREV
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_factory"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}	
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_factory"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}	
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_factory"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}	
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}
					random_tile = {
						limit = { has_building = "building_colony_shelter" }
						remove_building = yes
					}
					last_created_country = {
						capital_scope = { set_name = "Sol III" }
					}
				}
				# Industrial
				25 = {
					create_species = {
						name = Human
						plural = Humans
						class = "MAM"
						portrait = "human"
						traits = {
							trait = "trait_quick_learners"
							trait = "trait_nomadic"
							#ideal_planet_class = "pc_continental"
						}
						homeworld = this
					}
					create_country = {
						name = random
						government = fragmented_nations
						species = last_created
						ethos = { 
							ethic = "ethic_materialist"
							ethic = "ethic_fanatic_militarist"
						}
						flag = {
							icon = {
								category = "human"
								file = "flag_human_7.dds"
							}
							background= {
								category = "backgrounds"
								file = "circle.dds"
							}
							colors={
								"dark_blue"
								"red"
								"null"
								"null"
							}
						}
						day_zero_contact = no
						type = primitive
					}
					last_created_country = {
						set_graphical_culture = industrial_01
						set_country_flag = machine_age
						set_country_flag = humans_machine_age
						set_primitive_age = machine_age
					}
					create_colony = {
						owner = last_created_country
						species = last_created
						ethos = { 
							ethic = "ethic_materialist"
							ethic = "ethic_fanatic_militarist"
						}
					}
					create_army = {
						name = "German Wehrmacht"
						owner = last_created
						species = last_created
						type = "industrial_army"
					}
					create_army = {
						name = "Soviet Red Army"
						owner = last_created
						species = last_created
						type = "industrial_army"
					}
					create_army = {
						name = "US Armed Forces"
						owner = last_created
						species = last_created
						type = "industrial_army"
					}
					create_army = {
						name = "British Armed Forces"
						owner = last_created
						species = last_created
						type = "industrial_army"
					}
					create_army = {
						name = "Imperial Japanese Forces"
						owner = last_created
						species = last_created
						type = "industrial_army"
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_factory"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}	
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_factory"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}	
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_factory"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}	
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_factory"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}	
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}							
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}
					random_tile = {
						limit = { has_building = "building_colony_shelter" }
						remove_building = yes
					}
					last_created_country = {
						capital_scope = { set_name = "Sol III" }
					}
				}
				# Medieval
				25 = {
					create_species = {
						name = Human
						plural = Humans
						class = "MAM"
						portrait = "human"
						homeworld = THIS
						traits = {
							trait = "trait_quick_learners"
							trait = "trait_nomadic"
						}
					}
					create_country = {
						name = random
						government = primitive_feudalism
						species = last_created
						ethos = random
						flag = {
							icon = {
								category = "ornate"
								file = "flag_ornate_11.dds"
							}
							background = {
								category = "backgrounds"
								file = "00_solid.dds"
							}
							colors = {
								"dark_blue"
								"dark_blue"
								"null"
								"null"
							}
						}
						day_zero_contact = no
						type = primitive
					}
					last_created_country = {
						set_graphical_culture = preindustrial_01
						set_country_flag = late_medieval_age
						set_country_flag = humans_late_medieval_age
						set_primitive_age = late_medieval_age
					}
					create_colony = {
						owner = last_created_country
						species = last_created
						ethos = { 
							ethic = "ethic_xenophobe"
							ethic = "ethic_spiritualist"
							ethic = "ethic_collectivist"
						}
					}
					create_army = {
						name = "Feudal Levies"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
					create_army = {
						name = "Feudal Levies"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
					create_army = {
						name = "Feudal Levies"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = {
							has_blocker = no
							has_grown_pop = no
							has_growing_pop = no
						}
						create_pop = {
							species = last_created
							ethos = owner
						}
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}
					random_tile = {
						limit = { 
							has_blocker = no 
							has_building = no 
							has_grown_pop = yes
						}
						set_building = "building_primitive_farm"
						add_resource = {
							resource = minerals
							amount = 1
							replace = yes
						}
					}
					random_tile = {
						limit = { has_building = "building_colony_shelter" }
						remove_building = yes
					}
					last_created_country = {
						capital_scope = { set_name = "Sol III" }
					}
				}
			}
		}
		
		moon = {
			class = "pc_barren_cold"
			size = 5
			orbit_distance = 12
			orbit_angle = 40
			has_ring = no
			entity = "cold_barren_planet_luna_entity"
		}
	}
	
	planet = {
		class = "pc_barren"
		orbit_distance = 20
		orbit_angle = 60
		size = 15
		has_ring = no
		entity = "barren_planet_mars_entity"
	}
	
	planet = {
		class = "pc_asteroid"
		orbit_distance = 20
		orbit_angle = -210
		size = 5
		has_ring = no
	}
	
	planet = {
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = -95
		size = 5
		has_ring = no
	}
	
	planet = {
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = 285
		size = 5
		has_ring = no
	}
	
	planet = {
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = -80
		size = 5
		has_ring = no
	}
	
	planet = {
		class = "pc_gas_giant"
		orbit_distance = 30
		orbit_angle = -160
		size = 35
		has_ring = no
		entity = "gas_giant_jupiter_entity"
		change_orbit = 6
		
		moon = {
			class = "pc_molten"
			size = 6
			orbit_distance = 10
			orbit_angle = 110
			has_ring = no
		}
		moon = {
			class = "pc_frozen"
			size = 6
			orbit_distance = 2.5
			orbit_angle = 10
			has_ring = no
		}
		moon = {
			class = "pc_frozen"
			size = 9
			orbit_distance = 2.5
			orbit_angle = 80
			has_ring = no
		}
		moon = {
			class = "pc_frozen"
			size = 7
			orbit_distance = 2.5
			orbit_angle = -155
			has_ring = no
		}
	}
	
	planet = {
		class = "pc_gas_giant"
		orbit_distance = 20
		orbit_angle = 170
		size = 30
		has_ring = yes
		entity = "gas_giant_05_entity"
		change_orbit = 7
		
		moon = {
			class = "pc_frozen"
			size = 8
			orbit_distance = 12
			orbit_angle = 320
			has_ring = no
		}
	}
	
	planet = {
		class = "pc_gas_giant"
		orbit_distance = 20
		orbit_angle = 125
		size = 20
		has_ring = no
		entity = "gas_giant_03_entity"
	}
	
	planet = {
		class = "pc_gas_giant"
		orbit_distance = 20
		orbit_angle = -195
		size = 20
		has_ring = no
		entity = "gas_giant_02_entity"
		change_orbit = 4
		
		moon = {
			class = "pc_frozen"
			size = 6
			orbit_distance = 7
			orbit_angle = 115
			has_ring = no
		}
	}
}

# Sol System (Nuclear Wasteland)
special_init_04 = {
	name = "Sol"
	class = "sc_g"
	asteroids_distance = 120

	flags = { nuked_sol }
	
	planet = {
		name = "Sol"
		class = "pc_g_star"
		orbit_distance = 0
		orbit_angle = 1
		size = 30
		has_ring = no
	}
	
	planet = {
		class = "pc_molten"
		orbit_distance = 40
		orbit_angle = 15
		size = 10
		has_ring = no
	}
	
	planet = {
		class = "pc_toxic"
		orbit_distance = 20
		orbit_angle = 125
		size = 20
		has_ring = no
	}
	
	planet = {
		class = "pc_nuked"
		orbit_distance = 20
		orbit_angle = 120
		size = 20
		has_ring = no
		anomaly = "sol_wasteland_category"
		
		moon = {
			class = "pc_barren_cold"
			size = 5
			orbit_distance = 12
			orbit_angle = 40
			has_ring = no
			entity = "cold_barren_planet_luna_entity"
		}
	}
	
	planet = {
		class = "pc_barren"
		orbit_distance = 20
		orbit_angle = 60
		size = 15
		has_ring = no
		entity = "barren_planet_mars_entity"
	}
	
	planet = {
		class = "pc_asteroid"
		orbit_distance = 20
		orbit_angle = -210
		size = 5
		has_ring = no
	}
	
	planet = {
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = -95
		size = 5
		has_ring = no
	}
	
	planet = {
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = 285
		size = 5
		has_ring = no
	}
	
	planet = {
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = -80
		size = 5
		has_ring = no
	}
	
	planet = {
		class = "pc_gas_giant"
		orbit_distance = 30
		orbit_angle = -160
		size = 35
		has_ring = no
		entity = "gas_giant_jupiter_entity"
		change_orbit = 6
		
		moon = {
			class = "pc_molten"
			size = 6
			orbit_distance = 10
			orbit_angle = 110
			has_ring = no
		}
		moon = {
			class = "pc_frozen"
			size = 6
			orbit_distance = 2.5
			orbit_angle = 10
			has_ring = no
		}
		moon = {
			class = "pc_frozen"
			size = 9
			orbit_distance = 2.5
			orbit_angle = 80
			has_ring = no
		}
		moon = {
			class = "pc_frozen"
			size = 7
			orbit_distance = 2.5
			orbit_angle = -155
			has_ring = no
		}
	}
	
	planet = {
		class = "pc_gas_giant"
		orbit_distance = 20
		orbit_angle = 170
		size = 30
		has_ring = yes
		entity = "gas_giant_05_entity"
		change_orbit = 7
		
		moon = {
			class = "pc_frozen"
			size = 8
			orbit_distance = 12
			orbit_angle = 320
			has_ring = no
		}
	}
	
	planet = {
		class = "pc_gas_giant"
		orbit_distance = 20
		orbit_angle = 125
		size = 20
		has_ring = no
		entity = "gas_giant_03_entity"
	}
	
	planet = {
		class = "pc_gas_giant"
		orbit_distance = 20
		orbit_angle = -195
		size = 20
		has_ring = no
		entity = "gas_giant_02_entity"
		change_orbit = 4
		
		moon = {
			class = "pc_frozen"
			size = 6
			orbit_distance = 7
			orbit_angle = 115
			has_ring = no
		}
	}
}

# Stone Age Primitives
special_init_05 = {
	class = "rl_standard_stars"
	
	usage = misc_system_init
	usage_odds = 4

	flags = { stone_age_primitive_system }
	
	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 20
	
	planet = {
		orbit_distance = 20
		count = { min = 0 max = 3 }
	}
	
	change_orbit = 20
	
	planet = {
		count = 1
		orbit_distance = 0
		class = "rl_habitable_normal"
		orbit_angle = { min = 90 max = 270 }
		size = { min = 15 max = 25 }
		flags = { stone_age_primitives }

		init_effect = {
			add_modifier = {
				modifier = "stone_age_civilization"
				days = -1
			}
		}
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	planet = {
		orbit_distance = 20
		count = { min = 1 max = 4 }
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	planet = {
		orbit_distance = 20
		count = { min = 0 max = 2 }
	}
}

# Guardians of Zanaam
special_init_06 = {
	class = "rl_standard_stars"
	asteroids_distance = 150
	usage = misc_system_init
	max_instances = 1
	spawn_chance = 10
	
	flags = { guardians_of_zanaam hostile_system }
	
	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 45
	
	planet = {
		count = 1
		class = "pc_barren"
		entity = "barren_planet_01_destroyed_entity"
		size = 25
		orbit_angle = { min = 90 max = 270 }
	}
	
	planet = {
		name = Zanaam
		count = 1
		orbit_distance = 30
		class = "pc_gaia"
		orbit_angle = { min = 90 max = 270 }
		size = 25
		
		init_effect = {
			random_tile = {
				limit = { has_blocker = no has_building = no }
				set_building = "building_zanaam_obelisk"
			}
			create_country = {
				name = "Guardians of Zanaam"
				type = faction
			}
			last_created_country = {
				set_country_flag = zanaam_country
				create_fleet = { name = "Guardians of Zanaam" }
				last_created_fleet = {
					set_owner = PREV
					set_fleet_flag = zanaam_fleet
					create_ship = {
						name = "Defensive Alpha"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Beta"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Gamma"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Delta"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Epsilon"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Zeta"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Eta"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Theta"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Iota"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Kappa"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Lambda"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Mu"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Nu"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Ksi"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Omicron"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Pi"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Rho"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Sigma"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Tau"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Upsilon"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Phi"
						design = "Guardian"
					}							
					create_ship = {
						name = "Defensive Chi"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Psi"
						design = "Guardian"
					}
					create_ship = {
						name = "Defensive Omega"
						design = "Guardian"
					}					
					set_location = PREVPREV
				}
			}
		}
	}
	
	change_orbit = 10
	
	planet = {
		count = 1
		orbit_distance = 20
		class = "pc_barren"
		entity = "barren_planet_01_destroyed_entity"
		orbit_angle = { min = 90 max = 270 }
		size = 25
	}
	
	planet = {
		count = 1
		orbit_distance = 20
		class = "pc_barren"
		entity = "barren_planet_01_destroyed_entity"
		orbit_angle = { min = 90 max = 270 }
		size = 25
	}
	
	init_effect = {
		create_ambient_object = {
			type = "abandoned_ship_2_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "abandoned_ship_2_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "abandoned_ship_2_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "abandoned_ship_2_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "abandoned_ship_2_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "abandoned_ship_2_object"
			location = solar_system
		}
	}
}

# Crystal Lair
special_init_07 = {
	class = "rl_standard_stars"
	asteroids_distance = 150
	
	usage = misc_system_init
	max_instances = 1
	
	flags = { hostile_system }
	
	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
		
		init_effect = {
			create_country = {
				name = "Shardlings"
				type = faction
			}
			last_created_country = {
				create_fleet = { name = "Shards of Obsidian" }
				last_created_fleet = {
					set_owner = PREV
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					set_location = {
						target = PREVPREV
						distance = 70
						angle = 90
					}
				}
				create_fleet = { name = "Shards of Diamond" }
				last_created_fleet = {
					set_owner = PREV
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					set_location = {
						target = PREVPREV
						distance = 70
						angle = 180
					}
				}
				create_fleet = { name = "Shards of Onyx" }
				last_created_fleet = {
					set_owner = PREV
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					set_location = {
						target = PREVPREV
						distance = 70
						angle = 270
					}
				}
				create_fleet = { name = "Shards of Sapphire" }
				last_created_fleet = {
					set_owner = PREV
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					create_ship = {
						name = "Shardling"
						design = "Small Crystal Entity Blue"
					}
					set_location = {
						target = PREVPREV
						distance = 70
						angle = 0
					}
				}
			}
		}
	}
	
	change_orbit = 150
	
	planet = {
		name = "Yormak's Tusk"
		count = 1
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = 10
	}
	planet = {
		name = "Yormak's Eye"
		count = 1
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = 46
	}
	planet = {	
		name = "Yormak's Tongue"
		count = 1
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = 97
	}
	planet = {
		name = "Yormak's Tail"
		count = 1
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = 145
	}
	planet = {
		name = "Yormak's Heart"
		count = 1
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = 189
	}
	planet = {
		name = "Yormak's Belly"
		count = 1
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = 231
	}
	planet = {
		name = "Yormak's Snout"
		count = 1
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = 286
	}
	planet = {
		name = "Yormak's Fist"
		count = 1
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = 321
	}
}

# Neutron Stars
special_init_08 = {
	class = sc_neutron_star
	
	usage = misc_system_init
	usage_odds = 2
	
	planet = {
		class = star
		orbit_distance = 0
	}
	
	change_orbit = 45
	
	planet = {
		count = { min = 1 max = 6 }
		orbit_distance = 20
		orbit_angle = { min = 90 max = 270 }
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
}

# Pulsars
special_init_09 = {
	class = sc_pulsar
	
	usage = misc_system_init
	usage_odds = 2
	
	planet = {
		class = star
		orbit_distance = 0
	}
	
	change_orbit = 45
	
	planet = {
		count = { min = 1 max = 6 }
		orbit_distance = 20
		orbit_angle = { min = 90 max = 270 }
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
}

### The Sanctuary
sanctuary_system = {
	asteroids_distance = 150
	usage = misc_system_init
	usage_odds = 2000000
	max_instances = 1
	flags = { sanctuary_system }
	spawn_chance = 10
	
	name = "Sanctuary"

	class = "sc_g"
	
	planet = {
		class = star
		orbit_distance = 0
		
		init_effect = {
			create_country = {
				name = "Sanctuary"
				type = faction
			}
			last_created_country = {
				save_event_target_as = sanctuary
				create_fleet = { name = "Sanctuary Core" }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = "Administrator"
						design = "Sanctuary Core"
						graphical_culture = "ai_01"
					}
					set_location = {
						target = PREVPREV
						distance = 25
						angle = random 
					}
					save_event_target_as = sanctuary_core
					set_fleet_flag = sanctuary_core
				}
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-2"
						graphical_culture = "ai_01"
					}
					set_location = {
						target = event_target:sanctuary_core
						distance = 8
						angle = 90
					}
				}
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-2"
						graphical_culture = "ai_01"
					}
					set_location = {
						target = event_target:sanctuary_core
						distance = 8
						angle = 180
					}
				}
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-2"
						graphical_culture = "ai_01"
					}
					set_location = {
						target = event_target:sanctuary_core
						distance = 8
						angle = 270
					}
				}
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-2"
						graphical_culture = "ai_01"
					}
					set_location = {
						target = event_target:sanctuary_core
						distance = 8
						angle = 0
					}
				}
			}
		}
	}
	
	change_orbit = 45
	
	planet = {
		class = "pc_ringworld_habitable"
		name = "Sanctuary A"
		orbit_angle = 30
		orbit_distance = 0
		tile_blockers = none
		modifiers = none
		
		init_effect = {
			prevent_anomaly = yes
			
			last_created_country = {
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-1"
						graphical_culture = "ai_01"
					}
					set_location = {
						target = PREVPREV
						distance = 1
						angle = random 
					}
				}
			}
			
			create_species = {
				name = random
				class = MAM
				portrait = random
				traits = {
					#ideal_planet_class = "pc_continental"
					trait = random_trait
					trait = random_trait
				}
				homeworld = this
			}
			create_country = {
				name = random
				government = primitive_feudalism
				species = last_created
				ethos = random
				flag = {
					icon = {
						category = "special"
						file = "primitive.dds"
					}
					background= {
						category = "backgrounds"
						file = "new_dawn.dds"
					}
					colors={
						"turquoise"
						"green"
						"null"
						"null"
					}
				}
				type = primitive
			}
			last_created_country = {
				random_list = {
					20 = { 
						set_country_flag = bronze_age 
						set_primitive_age = bronze_age
					}
					20 = { 
						set_country_flag = iron_age 
						set_primitive_age = iron_age
					}
					20 = { 
						set_country_flag = late_medieval_age 
						set_primitive_age = late_medieval_age
					}
					20 = { 
						set_country_flag = renaissance_age 
						set_primitive_age = renaissance_age
					}
					20 = { 
						set_country_flag = steam_age 
						set_primitive_age = steam_age
					}
				}
			}
			set_owner = last_created_country
			set_capital = yes
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = last_created
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = last_created
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = last_created
					ethos = owner
				}
			}
			if = {
				limit = {
					last_created_country = {
						OR = {
							has_country_flag = late_medieval_age 
							has_country_flag = renaissance_age 
							has_country_flag = steam_age
						}
					}					
				}
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_farm"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}				
			}
			if = {
				limit = {
					last_created_country = {
						OR = {
							has_country_flag = renaissance_age 
							has_country_flag = steam_age
						}
					}					
				}
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_farm"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}				
			}								
			if = {
				limit = {
					last_created_country = {
						has_country_flag = steam_age
					}					
				}
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}	
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}	
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_factory"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}	
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_factory"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}				
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}		
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}			
		}
	}
	planet = {
		class = "pc_ringworld_tech"
		name = "Sanctuary-B"
		orbit_angle = 30
		orbit_distance = 0
		
		init_effect = {
			last_created_country = {
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-2"
						graphical_culture = "ai_01"
					}
					set_location = PREVPREV
				}
			}
		}
	}
	planet = {
		class = "pc_ringworld_seam"
		name = "Sanctuary-C"
		orbit_angle = 30
		orbit_distance = 0
		
		init_effect = {
			last_created_country = {
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-2"
						graphical_culture = "ai_01"
					}
					set_location = PREVPREV
				}
			}
		}
	}
	planet = {
		class = "pc_ringworld_habitable"
		name = "Sanctuary-D"
		orbit_angle = 30
		orbit_distance = 0
		tile_blockers = none
		modifiers = none
		
		init_effect = {
			prevent_anomaly = yes
			
			last_created_country = {
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-1"
						graphical_culture = "ai_01"
					}
					set_location = {
						target = PREVPREV
						distance = 1
						angle = random 
					}
				}
			}
			
			create_species = {
				name = random
				class = REP
				portrait = random
				traits = {
					#ideal_planet_class = "pc_desert"
					trait = random_trait
					trait = random_trait
				}
				homeworld = this
			}
			create_country = {
				name = random
				government = primitive_feudalism
				species = last_created
				ethos = random
				flag = {
					icon = {
						category = "special"
						file = "primitive.dds"
					}
					background= {
						category = "backgrounds"
						file = "new_dawn.dds"
					}
					colors={
						"turquoise"
						"green"
						"null"
						"null"
					}
				}
				type = primitive
			}
			last_created_country = {
				random_list = {
					20 = { 
						set_country_flag = bronze_age 
						set_primitive_age = bronze_age
					}
					20 = { 
						set_country_flag = iron_age 
						set_primitive_age = iron_age
					}
					20 = { 
						set_country_flag = late_medieval_age 
						set_primitive_age = late_medieval_age
					}
					20 = { 
						set_country_flag = renaissance_age 
						set_primitive_age = renaissance_age
					}
					20 = { 
						set_country_flag = steam_age 
						set_primitive_age = steam_age
					}
				}
			}
			set_owner = last_created_country
			set_capital = yes
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = last_created
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = last_created
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = last_created
					ethos = owner
				}
			}
			if = {
				limit = {
					last_created_country = {
						OR = {
							has_country_flag = late_medieval_age 
							has_country_flag = renaissance_age 
							has_country_flag = steam_age
						}
					}					
				}
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_farm"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}				
			}
			if = {
				limit = {
					last_created_country = {
						OR = {
							has_country_flag = renaissance_age 
							has_country_flag = steam_age
						}
					}					
				}
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_farm"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}				
			}								
			if = {
				limit = {
					last_created_country = {
						has_country_flag = steam_age
					}					
				}
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}	
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}	
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_factory"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}	
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_factory"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}				
			}			
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}			
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}	
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}	
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}	
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}				
		}
	}
	planet = {
		class = "pc_ringworld_tech"
		name = "Sanctuary-E"
		orbit_angle = 30
		orbit_distance = 0
		
		init_effect = {
			last_created_country = {
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-2"
						graphical_culture = "ai_01"
					}
					set_location = PREVPREV
				}
			}
		}
	}
	planet = {
		class = "pc_ringworld_seam"
		name = "Sanctuary-F"
		orbit_angle = 30
		orbit_distance = 0
		
		init_effect = {
			last_created_country = {
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-2"
						graphical_culture = "ai_01"
					}
					set_location = PREVPREV
				}
			}
		}
	}
	planet = {
		class = "pc_ringworld_habitable"
		name = "Sanctuary-G"
		orbit_angle = 30
		orbit_distance = 0
		tile_blockers = none
		modifiers = none
		
		init_effect = {
			prevent_anomaly = yes
			
			last_created_country = {
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-1"
						graphical_culture = "ai_01"
					}
					set_location = {
						target = PREVPREV
						distance = 1
						angle = random 
					}
				}
			}
			
			create_species = {
				name = random
				class = MOL
				portrait = random
				traits = {
					#ideal_planet_class = "pc_ocean"
					trait = random_trait
					trait = random_trait
				}
				homeworld = this
			}
			create_country = {
				name = random
				government = primitive_feudalism
				species = last_created
				ethos = random
				flag = {
					icon = {
						category = "special"
						file = "primitive.dds"
					}
					background= {
						category = "backgrounds"
						file = "new_dawn.dds"
					}
					colors={
						"turquoise"
						"green"
						"null"
						"null"
					}
				}
				type = primitive
			}
			last_created_country = {
				random_list = {
					20 = { 
						set_country_flag = bronze_age 
						set_primitive_age = bronze_age
					}
					20 = { 
						set_country_flag = iron_age 
						set_primitive_age = iron_age
					}
					20 = { 
						set_country_flag = late_medieval_age 
						set_primitive_age = late_medieval_age
					}
					20 = { 
						set_country_flag = renaissance_age 
						set_primitive_age = renaissance_age
					}
					20 = { 
						set_country_flag = steam_age 
						set_primitive_age = steam_age
					}
				}
			}
			set_owner = last_created_country
			set_capital = yes
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = last_created
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = last_created
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = last_created
					ethos = owner
				}
			}
			if = {
				limit = {
					last_created_country = {
						OR = {
							has_country_flag = late_medieval_age 
							has_country_flag = renaissance_age 
							has_country_flag = steam_age
						}
					}					
				}
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_farm"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}				
			}
			if = {
				limit = {
					last_created_country = {
						OR = {
							has_country_flag = renaissance_age 
							has_country_flag = steam_age
						}
					}					
				}
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_farm"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}				
			}								
			if = {
				limit = {
					last_created_country = {
						has_country_flag = steam_age
					}					
				}
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}	
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}	
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_factory"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}	
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_factory"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}				
			}		
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}		
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}	
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}	
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}	
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}				
		}
	}
	planet = {
		class = "pc_ringworld_tech"
		name = "Sanctuary-H"
		orbit_angle = 30
		orbit_distance = 0
		
		init_effect = {
			last_created_country = {
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-2"
						graphical_culture = "ai_01"
					}
					set_location = PREVPREV
				}
			}
		}
	}
	planet = {
		class = "pc_ringworld_seam_damaged"
		name = "Sanctuary-I"
		orbit_angle = 30
		orbit_distance = 0
		
		init_effect = {
			create_ambient_object = {
				type = "medium_debris_01_object"
				location = THIS
			}
		}
	}
	planet = {
		class = "pc_ringworld_habitable"
		name = "Sanctuary-J"
		orbit_angle = 30
		orbit_distance = 0
		tile_blockers = none
		modifiers = none
		
		init_effect = {
			prevent_anomaly = yes
			
			last_created_country = {
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-1"
						graphical_culture = "ai_01"
					}
					set_location = {
						target = PREVPREV
						distance = 1
						angle = random 
					}
				}
			}
			
			create_species = {
				name = random
				class = FUN
				portrait = random
				traits = {
					#ideal_planet_class = "pc_tundra"
					trait = random_trait
					trait = random_trait
				}
				homeworld = this
			}
			create_country = {
				name = random
				government = primitive_feudalism
				species = last_created
				ethos = random
				flag = {
					icon = {
						category = "special"
						file = "primitive.dds"
					}
					background= {
						category = "backgrounds"
						file = "new_dawn.dds"
					}
					colors={
						"turquoise"
						"green"
						"null"
						"null"
					}
				}
				type = primitive
			}
			last_created_country = {
				random_list = {
					20 = { 
						set_country_flag = bronze_age 
						set_primitive_age = bronze_age
					}
					20 = { 
						set_country_flag = iron_age 
						set_primitive_age = iron_age
					}
					20 = { 
						set_country_flag = late_medieval_age 
						set_primitive_age = late_medieval_age
					}
					20 = { 
						set_country_flag = renaissance_age 
						set_primitive_age = renaissance_age
					}
					20 = { 
						set_country_flag = steam_age 
						set_primitive_age = steam_age
					}
				}
			}
			set_owner = last_created_country
			set_capital = yes
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = last_created
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = last_created
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = last_created
					ethos = owner
				}
			}
			if = {
				limit = {
					last_created_country = {
						OR = {
							has_country_flag = late_medieval_age 
							has_country_flag = renaissance_age 
							has_country_flag = steam_age
						}
					}					
				}
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_farm"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}				
			}
			if = {
				limit = {
					last_created_country = {
						OR = {
							has_country_flag = renaissance_age 
							has_country_flag = steam_age
						}
					}					
				}
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_farm"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}				
			}								
			if = {
				limit = {
					last_created_country = {
						has_country_flag = steam_age
					}					
				}
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}	
				random_tile = {
					limit = {
						has_blocker = no
						has_grown_pop = no
						has_growing_pop = no
					}
					create_pop = {
						species = last_created
						ethos = owner
					}
				}	
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_factory"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}	
				random_tile = {
					limit = { 
						has_blocker = no 
						has_building = no 
						has_grown_pop = yes
					}
					set_building = "building_primitive_factory"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}				
			}			
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}			
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}	
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}	
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}	
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = yes
				}
				set_building = "building_primitive_farm"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}						
			}				
		}
	}
	planet = {
		class = "pc_ringworld_tech"
		name = "Sanctuary-K"
		orbit_angle = 30
		orbit_distance = 0
		
		init_effect = {
			last_created_country = {
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-2"
						graphical_culture = "ai_01"
					}
					set_location = PREVPREV
				}
			}
		}
	}
	planet = {
		class = "pc_ringworld_seam"
		name = "Sanctuary-L"
		orbit_angle = 30
		orbit_distance = 0
		
		init_effect = {
			last_created_country = {
				create_fleet = { }
				last_created_fleet = {
					set_owner = event_target:sanctuary
					create_ship = {
						name = random
						design = "Defensive A-2"
						graphical_culture = "ai_01"
					}
					set_location = PREVPREV
				}
			}
		}
	}
	
	change_orbit = 105
	
	planet = {
		count = { min = 1 max = 4 }
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = { min = 90 max = 270 }
	}
	
	change_orbit = 45
	
	planet = {
		class = pc_gas_giant
		orbit_angle = { min = 90 max = 270 }
		size = 25
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 1 max = 4 }
			size = { min = 8 max = 20 }
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 6
		}
	}
	
	change_orbit = 30
	
	planet = {
		count = { min = 0 max = 2 }
		orbit_distance = 20
		orbit_angle = { min = 90 max = 270 }
	}
}

hyacinth_system = {
	class = "rl_standard_stars"
	flags = { hyacinth_system }

	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 45
	
	planet = {
		count = { min = 1 max = 2 }
		orbit_distance = 20
		orbit_angle = { min = 90 max = 270 }
		class = random_non_colonizable
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	change_orbit = 45
	
	planet = {
		orbit_angle = { min = 90 max = 270 }
		class = pc_barren
		flags = { hyacinth_planet }
	}
	
	change_orbit = 45
	
	planet = {
		orbit_angle = { min = 90 max = 270 }
		class = pc_gas_giant
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 3 }
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
}

# Sol System (Commonwealth of Man SP)
com_sol_system = {
	name = "Sol"
	
	class = "sc_g"
	asteroids_distance = 120
	flags = { sol_system com_sol }
	
	planet = {
		name = "Sol"
		class = "pc_g_star"
		orbit_distance = 0
		orbit_angle = 1
		size = 30
		has_ring = no
	}
	
	planet = {
		name = "Mercury"
		class = "pc_molten"
		orbit_distance = 40
		orbit_angle = 15
		size = 10
		has_ring = no
	}
	
	planet = {
		name = "Venus"
		class = "pc_toxic"
		orbit_distance = 20
		orbit_angle = 125
		size = 20
		has_ring = no
	}
	
	planet = {
		name = "Earth"
		class = "pc_continental"
		orbit_distance = 20
		orbit_angle = 120
		size = 16
		starting_planet = yes
		has_ring = no
		entity = "continental_planet_earth_entity"
		tile_blockers = none
		modifiers = none
		
		init_effect = {
			prevent_anomaly = yes
		}
		
		init_effect = {
			random_tile = {
				limit = { has_blocker = no has_building = no num_adjacent_tiles > 3 }
				set_building = "building_capital_1"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}	
				add_resource = {
					resource = minerals
					amount = 1
				}					
				random_neighboring_tile = {
					limit = { has_blocker = no has_building = no }
					set_building = "building_hydroponics_farm_1"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}
				random_neighboring_tile = {
					limit = { has_blocker = no has_building = no }
					set_building = "building_power_plant_1"
					add_resource = {
						resource = energy
						amount = 1
						replace = yes
					}						
				}
				random_neighboring_tile = {
					limit = { has_blocker = no has_building = no }
					set_building = "building_power_plant_1"
					add_resource = {
						resource = energy
						amount = 1
						replace = yes
					}						
				}
				random_neighboring_tile = {
					limit = { has_blocker = no has_building = no }
					set_building = "building_mining_network_1"
					add_resource = {
						resource = minerals
						amount = 1
						replace = yes
					}						
				}				
			}
			random_tile = {
				limit = { has_blocker = no has_building = no }
				set_blocker = "tb_failing_infrastructure"
				add_resource = {
					resource = engineering_research
					amount = 1
					replace = yes
				}				
			}
			random_tile = {
				limit = { has_blocker = no has_building = no }
				set_blocker = "tb_failing_infrastructure"
				add_resource = {
					resource = society_research
					amount = 1
					replace = yes
				}				
			}
			random_tile = {
				limit = { has_blocker = no has_building = no }
				set_blocker = "tb_failing_infrastructure"
				add_resource = {
					resource = physics_research
					amount = 1
					replace = yes
				}				
			}
			random_tile = {
				limit = { has_blocker = no has_building = no }
				set_blocker = "tb_decrepit_dwellings"
				add_resource = {
					resource = energy
					amount = 2
					replace = yes
				}					
			}
			random_tile = {
				limit = { has_blocker = no has_building = no }
				set_blocker = "tb_decrepit_dwellings"
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}					
			}
			random_tile = {
				limit = { has_blocker = no has_building = no }
				set_blocker = "tb_decrepit_dwellings"
				add_resource = {
					resource = energy
					amount = 1
					replace = yes
				}				
			}
			random_tile = {
				limit = { has_blocker = no has_building = no }
				add_resource = {
					resource = minerals
					amount = 1
					replace = yes
				}				
			}			
			random_country = {
				limit = { has_country_flag = human_2 }
				owner_species = { save_event_target_as = human_species }
			}
			create_country = {
				name = "United Nations of Earth"
				government = "indirect_democracy"
				species = event_target:human_species
				name_list = "Human"
				#ship_prefix = "UNS"
				ethos = {
					ethic = "ethic_xenophile"
					ethic = "ethic_fanatic_individualist"	
				}
				flag = {
					icon = {
						category = "human"
						file = "flag_human_8.dds"
					}
					background = {
						category = "backgrounds"
						file = "00_solid.dds"
					}
					colors = {
						"dark_blue"
						"dark_blue"
						"null"
						"null"
					}
				}
				type = default
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = event_target:human_species
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = event_target:human_species
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = event_target:human_species
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = event_target:human_species
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = event_target:human_species
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = event_target:human_species
					ethos = owner
				}
			}
			random_tile = {
				limit = {
					has_blocker = no
					has_grown_pop = no
					has_growing_pop = no
				}
				create_pop = {
					species = event_target:human_species
					ethos = owner
				}
			}
			set_owner = last_created_country
			create_spaceport = {
				owner = last_created_country
				initial_module = "missile_weapon"
			}
			last_created_country = { add_minerals = 300 }
		}
		
		moon = {
			name = "Luna"
			class = "pc_barren_cold"
			size = 5
			orbit_distance = 12
			orbit_angle = 40
			has_ring = no
			entity = "cold_barren_planet_luna_entity"
		}
	}
	
	planet = {
		name = "Mars"
		class = "pc_barren"
		orbit_distance = 20
		orbit_angle = 60
		size = 15
		has_ring = no
		entity = "barren_planet_mars_entity"
	}
	
	planet = {
		name = "1 Ceres"
		class = "pc_asteroid"
		orbit_distance = 20
		orbit_angle = -210
		size = 5
		has_ring = no
	}
	
	planet = {
		name = "2 Pallas"
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = -95
		size = 5
		has_ring = no
	}
	
	planet = {
		name = "3 Juno"
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = 285
		size = 5
		has_ring = no
	}
	
	planet = {
		name = "4 Vesta"
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = -80
		size = 5
		has_ring = no
	}
	
	planet = {
		name = "Jupiter"
		class = "pc_gas_giant"
		orbit_distance = 30
		orbit_angle = -160
		size = 35
		has_ring = no
		entity = "gas_giant_jupiter_entity"
		change_orbit = 6
		
		moon = {
			name = "Io"
			class = "pc_molten"
			size = 6
			orbit_distance = 10
			orbit_angle = 110
			has_ring = no
		}
		moon = {
			name = "Europa"
			class = "pc_frozen"
			size = 6
			orbit_distance = 2.5
			orbit_angle = 10
			has_ring = no
		}
		moon = {
			name = "Ganymede"
			class = "pc_frozen"
			size = 9
			orbit_distance = 2.5
			orbit_angle = 80
			has_ring = no
		}
		moon = {
			name = "Callisto"
			class = "pc_frozen"
			size = 7
			orbit_distance = 2.5
			orbit_angle = -155
			has_ring = no
		}
	}
	
	planet = {
		name = "Saturn"
		class = "pc_gas_giant"
		orbit_distance = 20
		orbit_angle = 170
		size = 30
		has_ring = yes
		entity = "gas_giant_05_entity"
		change_orbit = 7
		
		moon = {
			name = "Titan"
			class = "pc_frozen"
			size = 8
			orbit_distance = 12
			orbit_angle = 320
			has_ring = no
		}
	}
	
	planet = {
		name = "Uranus"
		class = "pc_gas_giant"
		orbit_distance = 20
		orbit_angle = 125
		size = 20
		has_ring = no
		entity = "gas_giant_03_entity"
	}
	
	planet = {
		name = "Neptune"
		class = "pc_gas_giant"
		orbit_distance = 20
		orbit_angle = -195
		size = 20
		has_ring = no
		entity = "gas_giant_02_entity"
		change_orbit = 4
		
		moon = {
			name = "Triton"
			class = "pc_frozen"
			size = 6
			orbit_distance = 7
			orbit_angle = 115
			has_ring = no
		}
	}
}

# AI Revolt System
ai_system_1 = {
	class = "rl_standard_stars"
	flags = { ai_system }
	asteroids_distance = 100
	
	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
		
		init_effect = { prevent_anomaly = yes }
	}
	
	change_orbit = 40
	
	planet = {
		orbit_distance = 20
		class = random_non_colonizable
		count = 2
		
		init_effect = { prevent_anomaly = yes }
	}
	
	change_orbit = 20
	
	planet = {
		count = 5
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = { min = 40 max = 100 }
		
		init_effect = { prevent_anomaly = yes }
	}
	
	change_orbit = 20
	
	planet = {
		orbit_distance = 20
		class = random_non_colonizable
		count = { min = 1 max = 3 }
		
		init_effect = { prevent_anomaly = yes }
		
		change_orbit = @base_moon_distance

		moon = {
			count = { min = 0 max = 1 }
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
			
			init_effect = { prevent_anomaly = yes }
		}
	}
	
	change_orbit = 20
	
	planet = {
		count = 1
		orbit_distance = 0
		class = "pc_ai"
		orbit_angle = { min = 90 max = 270 }
		size = 25
		tile_blockers = none
		
		init_effect = {
			prevent_anomaly = yes
		}
	}
	
	planet = {
		orbit_distance = 20
		count = { min = 0 max = 3 }
		class = random_non_colonizable
		
		init_effect = { prevent_anomaly = yes }
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
			
			init_effect = { prevent_anomaly = yes }
		}
	}
}

### Sentinel System
sentinel_system = {
	class = "rl_standard_stars"
	name = "Thelet"
	asteroids_distance = 200
	flags = { sentinel_system }

	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	planet = {
		class = "pc_molten"
		orbit_distance = 60
		orbit_angle = 45
		size = 10
		has_ring = no
	}
	
	planet = {
		class = "pc_molten"
		orbit_distance = 25
		orbit_angle = 85
		size = 28
		has_ring = no
	}
	
	planet = {
		class = "pc_barren"
		orbit_distance = 25
		orbit_angle = 45
		size = 16
		has_ring = yes
		
		moon = {
			class = "pc_barren_cold"
			size = 8
			orbit_distance = 14
			orbit_angle = 14
			has_ring = no
		}
	}
	
	planet = {
		flags = { sentinel_alpha }
		class = "pc_gaia"
		orbit_distance = 25
		orbit_angle = 150
		size = 25
		has_ring = no
		tile_blockers = none
	}
	
	planet = {
		class = "pc_barren_cold"
		orbit_distance = 25
		orbit_angle = 45
		size = 22
		has_ring = no
	}
	
	planet = {
		class = "pc_asteroid"
		orbit_distance = 40
		orbit_angle = 10
		size = 5
		has_ring = no
	}
	
	planet = {
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = 120
		size = 5
		has_ring = no
	}
	
	planet = {
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = 76
		size = 5
		has_ring = no
	}
	planet = {
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = 88
		size = 5
		has_ring = no
	}
	
	planet = {
		class = "pc_gas_giant"
		orbit_distance = 40
		orbit_angle = 210
		size = 35
		has_ring = yes
		change_orbit = 6
	}
	
	planet = {
		class = "pc_gas_giant"
		orbit_distance = 40
		orbit_angle = 140
		size = 38
		has_ring = no
		change_orbit = 6
		
		moon = {
			class = "pc_frozen"
			size = 7
			orbit_distance = 10
			orbit_angle = 40
			has_ring = no
		}
		moon = {
			class = "pc_barren_cold"
			size = 6
			orbit_distance = 2.5
			orbit_angle = 90
			has_ring = no
		}
		moon = {
			class = "pc_frozen"
			size = 5
			orbit_distance = 2.5
			orbit_angle = 220
			has_ring = no
		}
		moon = {
			class = "pc_frozen"
			size = 7
			orbit_distance = 2.5
			orbit_angle = -155
			has_ring = no
		}
	}
	
	planet = {
		class = "pc_frozen"
		orbit_distance = 40
		orbit_angle = 190
		size = 9
		has_ring = no
		change_orbit = 6
	}
	
	init_effect = {
		random_system_planet = {
			limit = { has_planet_flag = sentinel_alpha }
			prevent_anomaly = yes
			create_species = {
				name = random
				class = random
				portrait = random
				traits = random
				homeworld = this
			}
			create_country = {
				name = "Sentinels"
				type = sentinels
				government = military_order
				species = last_created
				ethos = {
					ethic = "ethic_fanatic_militarist"
					ethic = "ethic_individualist"	
				}
			}
			every_country = {
				establish_communications = last_created_country
			}
			create_colony = {
				owner = last_created_country
				species = owner_main_species
			}
			set_capital = yes
			create_spaceport = {
				owner = last_created_country
				initial_module = "fallen_empire_weapon"
			}
			last_created_country = {
				add_minerals = 5000
				add_energy = 5000
				add_influence = 5000
			}
			random_tile = {
				limit = { has_building = "building_colony_shelter" }
				remove_building = yes
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = no
				}
				set_building = "building_capital_3"
				create_pop = { species = last_created }
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = no
				}
				set_building = "building_ancient_factory"
				create_pop = { species = last_created }
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = no
				}
				set_building = "building_ancient_factory"
				create_pop = { species = last_created }
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = no
				}
				set_building = "building_ancient_factory"
				create_pop = { species = last_created }
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no
					has_grown_pop = no					
				}
				set_building = "building_ancient_factory"
				create_pop = { species = last_created }
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = no
				}
				set_building = "building_hydroponics_farm_3"
				create_pop = { species = last_created }
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = no
				}
				set_building = "building_hydroponics_farm_3"
				create_pop = { species = last_created }
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = no
				}
				set_building = "building_hydroponics_farm_3"
				create_pop = { species = last_created }
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = no
				}
				set_building = "building_hydroponics_farm_3"
				create_pop = { species = last_created }
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = no
				}
				set_building = "building_power_plant_3"
				create_pop = { species = last_created }
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = no
				}
				set_building = "building_power_plant_3"
				create_pop = { species = last_created }
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = no
				}
				set_building = "building_power_plant_3"
				create_pop = { species = last_created }
			}
			random_tile = {
				limit = { 
					has_blocker = no 
					has_building = no 
					has_grown_pop = no
				}
				set_building = "building_power_plant_3"
				create_pop = { species = last_created }
			}
			set_name = "Sentinel Alpha"
			create_army = {
				name = random
				owner = last_created_country
				species = last_created_country
				type = "psionic_army"
			}
			create_army = {
				name = random
				owner = last_created_country
				species = last_created_country
				type = "robotic_army"
			}
			create_army = {
				name = random
				owner = last_created_country
				species = last_created_country
				type = "robotic_army"
			}
			
			create_fleet = { }
			last_created_fleet = {
				set_owner = last_created_country
				create_ship = {
					name = "Sentinel Base"
					design = "Vigil"
				}
				set_location = {
					target = PREV
					distance = 10
					angle = 210
				}
			}
			create_fleet = { }
			last_created_fleet = {
				set_owner = last_created_country
				create_ship = {
					name = "Fortress G-12"
					design = "Sentinel-1"
					graphical_culture = "mammalian_01"
				}
				set_location = {
					target = PREV
					distance = 20
					angle = 40
				}
			}
			create_fleet = { }
			last_created_fleet = {
				set_owner = last_created_country
				create_ship = {
					name = "Fortress A-59"
					design = "Omega"
					graphical_culture = "fallen_empire_01"
				}
				set_location = {
					target = PREV
					distance = 10
					angle = 340
				}
			}
			last_created_country = {
				create_leader = {
					type = admiral
					species = owner_main_species
					name = random
					skill = 500
					traits = {
						trait = leader_trait_sentinel
					}
				}
			}
			create_fleet = { name = "Sentinel Battle Fleet" }
			last_created_fleet = {
				set_owner = last_created_country
				create_ship = {
					name = random
					design = "Judgment"
					graphical_culture = "fallen_empire_01"
				}
				assign_leader = last_created_leader
				create_ship = {
					name = random
					design = "Avatar"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Judgment"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Avatar"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Avatar"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Avatar"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Avatar"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Avatar"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Eclipse"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Eclipse"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Eclipse"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Eclipse"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Voidstalker"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Voidstalker"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Voidstalker"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Starfang"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Starfang"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Eclipse"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Eclipse"
					graphical_culture = "fallen_empire_01"
				}
				create_ship = {
					name = random
					design = "Eclipse"
					graphical_culture = "fallen_empire_01"
				}
				set_location = {
					target = PREV
					distance = 25
					angle = random 
				}
				
				set_fleet_stance = aggressive
				set_aggro_range = 500
				set_aggro_range_measure_from = return_point
			}
		}
		
		random_system_planet = {
			limit = { is_planet_class = pc_asteroid }
			set_planet_flag = ast_1
			create_fleet = { }
			last_created_fleet = {
				set_owner = last_created_country
				create_ship = {
					name = "Early Warning X-34"
					design = "Sentry"
				}
				set_location = {
					target = PREV
					distance = 10
					angle = random
				}
			}
		}
		
		random_system_planet = {
			limit = { 
				is_planet_class = pc_asteroid
				NOT = { has_planet_flag = ast_1 }
			}
			create_fleet = { }
			last_created_fleet = {
				set_owner = last_created_country
				create_ship = {
					name = "Refugee Site Alpha"
					design = "PR-417"
					graphical_culture = "pirate_01"
				}
				set_location = {
					target = PREV
					distance = 5
					angle = random
				}
			}
			create_fleet = { name = "Refugee Fleet" }
			last_created_fleet = {
				set_owner = last_created_country
				create_ship = {
					name = "Gray Moon"
					design = "C1"
				}
				last_created_ship = { set_disabled = yes }
				create_ship = {
					name = "Princess Kolos"
					design = "C1"
				}
				last_created_ship = { set_disabled = yes }
				create_ship = {
					name = "Kobyar Miru"
					design = "C2"
				}
				last_created_ship = { set_disabled = yes }
				create_ship = {
					name = "Deep Eyes"
					design = "C2"
				}
				last_created_ship = { set_disabled = yes }
				create_ship = {
					name = "Stellar Queen"
					design = "C2"
				}
				last_created_ship = { set_disabled = yes }
				set_location = {
					target = PREV
					distance = 10
					angle = random
				}
			}
		}
	}
}

# Crystal Manufactory version of Basic 4
crystal_manufactory_system = {
	class = "rl_standard_stars"
	flags = { manufactory_system }
	asteroids_distance = 120
	
	usage = misc_system_init
	usage_odds = 5
	max_instances = 1
	spawn_chance = 25
	
	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 120
	
	planet = {
		count = { min = 3 max = 6 }
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = { min = 90 max = 270 }
	}
	
	change_orbit = -80
	
	planet = {
		count = { min = 0 max = 2 }
		orbit_distance = 20
		orbit_angle = { min = 90 max = 270 }
	}
	
	change_orbit = 80
	
	planet = {
		count = { min = 0 max = 2 }
		orbit_distance = 40
		orbit_angle = { min = 90 max = 270 }
	}

	init_effect = {
		random_system_planet = {
			limit = {
				#is_asteroid = yes
				has_deposit_for = shipclass_mining_station
				#reduces spawn rate of manufactory, but not system
			}
			create_ambient_object = {
				type = "crystal_manufactory_object"
				location = this
			}
			last_created_ambient_object = {
				set_ambient_object_flag = manufactory
			}
			add_anomaly = CRYSTAL_MANUFACTORY_CAT
		}
	}
}

# Space Nomads origin point, based on basic_init_02
space_nomads_01 = {
	class = "rl_standard_stars"
	asteroids_distance = 95
	
	usage = misc_system_init
	usage_odds = 9999
	max_instances = 1
	spawn_chance = 25

	flags = { nomad01_system }
	
	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 30
	
	planet = {
		count = 2
		orbit_distance = 20
		orbit_angle = { min = 90 max = 270 }
	}
	
	change_orbit = 25
	
	planet = {
		count = { min = 1 max = 4 }
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = { min = 90 max = 270 }
	}
	
	planet = {
		count = { min = 2 max = 5 }
		orbit_distance = 25
		orbit_angle = { min = 90 max = 270 }
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}

	init_effect = {
		if = {
			limit = { NOT = { exists = event_target:nomad01_country } }
			create_species = {
				name = Nomad
				class = random
				portrait = random
				traits = random
				immortal = yes
			}
			create_country = {
				name = "Space Nomads"
				type = nomad
				species = last_created
				flag = {
					icon = {
						category = "pointy"
						file = "flag_pointy_15.dds"
					}
					background= {
						category = "backgrounds"
						file = "horizontal_stripe.dds"
					}
					colors={
						"grey"
						"dark_teal"
						"null"
						"null"
					}
				}
			}
			last_created_country = {
				set_country_flag = nomad01_country_flag
				save_global_event_target_as = nomad01_country
				#last_created_species = { save_event_target_as = nomad_leader_species }
			}
		}
		random_system_planet = { save_event_target_as = nomad_spawn }
		event_target:nomad01_country = {
			create_leader = {
				type = admiral
				species = owner_main_species
				name = random
				skill = 100
			}
			create_fleet = { name = "Nomadic Armada" }
			last_created_fleet = {
				set_owner = PREV
				set_fleet_stance = passive
				set_aggro_range_measure_from = self
				set_aggro_range = 0
				#create_ship_design = {
				#	design = Diaspora
				#	ftl = hyperdrive
				#}
				#create_ship = {
				#	name = "Home Five"
				#	design = "Diaspora"
				#}
				#create_ship = {
				#	name = "Home Six"
				#	design = "Diaspora"
				#}
				#create_ship_design = {
				#	design = Defender
				#	#graphical_culture = "pirate_01"
				#	ftl = hyperdrive
				#}
				create_ship = {
					name = "Protector"
					design = Defender
					graphical_culture = "pirate_01"
				}
				create_ship = {
					name = "Protector"
					design = Defender
					graphical_culture = "pirate_01"
				}
				create_ship = {
					name = "Protector"
					design = Defender
					graphical_culture = "pirate_01"
				}
				create_ship = {
					name = "Protector"
					design = Defender
					graphical_culture = "pirate_01"
				}
				create_ship = {
					name = "Protector"
					design = Defender
					graphical_culture = "pirate_01"
				}
				create_ship = {
					name = "Protector"
					design = "Defender"
					graphical_culture = "pirate_01"
				}
				create_ship = {
					name = "Protector"
					design = Defender
					graphical_culture = "pirate_01"
				}
				create_ship = {
					name = "Protector"
					design = Defender
					graphical_culture = "pirate_01"
				}
				create_ship = {
					name = "Protector"
					design = Defender
					graphical_culture = "pirate_01"
				}
				create_ship = {
					name = "Protector"
					design = Defender
					graphical_culture = "pirate_01"
				}
				#create_ship_design = {
				#	design = Diaspora
				#	ftl = hyperdrive
				#}
				create_ship = {
					name = "Home One"
					design = Diaspora
				}
				create_ship = {
					name = "Home Two"
					design = Diaspora
				}
				create_ship = {
					name = "Home Three"
					design = Diaspora
				}
				create_ship = {
					name = "Home Four"
					design = Diaspora
				}
				#create_ship_design = {
				#	design = Guardian
				#	#graphical_culture = "pirate_01"
				#	ftl = hyperdrive
				#}
				#create_ship = {
				#	name = "Guardian"
				#	design = "Guardian"
				#	graphical_culture = "pirate_01"
				#}
				#create_ship = {
				#	name = "Guardian"
				#	design = "Guardian"
				#	graphical_culture = "pirate_01"
				#}
				#create_ship = {
				#	name = "Guardian"
				#	design = "Guardian"
				#	graphical_culture = "pirate_01"
				#}
				#create_ship = {
				#	name = "Guardian"
				#	design = "Guardian"
				#	graphical_culture = "pirate_01"
				#}
				assign_leader = last_created_leader
				set_location = event_target:nomad_spawn
				
				queue_actions = {
					repeat = {
						find_random_system = {
							trigger = {
								id = nomad.1.trigger.1
								NOT = { 
									has_star_flag = hostile_system 
								}
								#any_planet = {
								#	OR = {
								#		has_mining_station = yes
								#		has_research_station = yes
								#	}
								#	exists = controller
								#	controller = { is_same_value = event_target:pirate_target }
								#}
								distance = {
									source = PREV
									max_distance = 50
									min_distance = 5
								}
							}
							found_system = {
								move_to = this
							}	
						}
						find_closest_planet = {
							trigger = {
								id = nomad.1.trigger.2
								is_star = yes
							}
							found_planet = {
								orbit_planet = this
								wait = {
									duration = 20
								}
							}
						}
						find_random_system = {
							trigger = {
								id = nomad.1.trigger.3
								any_planet = {
									is_star = yes
								}
							}
							found_system = {
								move_to = this
							}	
						}
						find_closest_planet = {
							trigger = {
								id = nomad.1.trigger.4
								is_star = yes
							}
							found_planet = {
								orbit_planet = this
								wait = {
									duration = 20
									random = 10
								}
							}
						}
					}
				}
			}
		}
	}
}