@distance = 50
@base_moon_distance = 10

cycle_system_initializer = {
	name = "NAME_Sol"
	
	class = "sc_g"
	asteroids_distance = 145
	flags = { sol_system sol }
	
	usage = custom_empire

	init_effect = {
		every_neighbor_system = {
			set_star_flag = empire_cluster
			every_neighbor_system = {
				set_star_flag = empire_cluster
			}
		}
	}
	
	planet = {
		name = "NAME_Sol"
		class = "pc_g_star"
		orbit_distance = 0
		orbit_angle = 1
		size = 30
		has_cycle = no
	}
	
	planet = {
		name = "NAME_Mercury"
		class = "pc_molten"
		orbit_distance = 40
		orbit_angle = 15
		size = 10
		has_cycle = no
	}
	
	planet = {
		name = "NAME_Venus"
		class = "pc_toxic"
		orbit_distance = 25
		orbit_angle = 125
		size = 20
		has_cycle = no
	}
	
	planet = {
		name = "NAME_Earth"
		class = "pc_continental"
		orbit_distance = 25
		orbit_angle = 120
		size = 25
		starting_planet = yes
		has_cycle = no
		entity = "continental_planet_earth_entity"
		tile_blockers = none
		modifiers = none
		flags = { planet_earth }
		
		init_effect = {
			prevent_anomaly = yes
		}
		
		init_effect = {
			generate_start_buildings_and_blockers = yes
		}
		
		moon = {
			name = "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 = "NAME_Mars"
		class = "pc_barren"
		orbit_distance = 25
		orbit_angle = 60
		size = 13
		has_ring = no
		entity = "barren_planet_mars_entity"
		anomaly = "terraforming_candidate_category"
	}
	
	planet = {
		name = "NAME_1_Ceres"
		class = "pc_asteroid"
		orbit_distance = 30
		orbit_angle = -210
		size = 5
		has_ring = no
	}
	
	planet = {
		name = "NAME_2_Pallas"
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = -95
		size = 5
		has_ring = no
	}
	
	planet = {
		name = "NAME_3_Juno"
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = 285
		size = 5
		has_ring = no
	}
	
	planet = {
		name = "NAME_4_Vesta"
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = -80
		size = 5
		has_ring = no
	}
	
	planet = {
		name = "NAME_Jupiter"
		class = "pc_gas_giant"
		orbit_distance = 40
		orbit_angle = -160
		size = 35
		has_ring = no
		entity = "gas_giant_jupiter_entity"
		change_orbit = 6
		
		moon = {
			name = "NAME_Io"
			class = "pc_molten"
			size = 6
			orbit_distance = 10
			orbit_angle = 110
			has_ring = no
		}
		moon = {
			name = "NAME_Europa"
			class = "pc_frozen"
			size = 6
			orbit_distance = 2.5
			orbit_angle = 10
			has_ring = no
		}
		moon = {
			name = "NAME_Ganymede"
			class = "pc_frozen"
			size = 9
			orbit_distance = 2.5
			orbit_angle = 80
			has_ring = no
		}
		moon = {
			name = "NAME_Callisto"
			class = "pc_frozen"
			size = 7
			orbit_distance = 2.5
			orbit_angle = -155
			has_ring = no
		}
	}
	
	planet = {
		name = "NAME_Saturn"
		class = "pc_gas_giant"
		orbit_distance = 25
		orbit_angle = 170
		size = 30
		has_ring = yes
		entity = "gas_giant_05_entity"
		change_orbit = 7
		
		moon = {
			name = "NAME_Titan"
			class = "pc_frozen"
			size = 8
			orbit_distance = 12
			orbit_angle = 320
			has_ring = no
		}
	}
	
	planet = {
		name = "NAME_Uranus"
		class = "pc_gas_giant"
		orbit_distance = 25
		orbit_angle = 125
		size = 20
		has_ring = no
		entity = "gas_giant_03_entity"
	}
	
	planet = {
		name = "NAME_Neptune"
		class = "pc_gas_giant"
		orbit_distance = 25
		orbit_angle = -195
		size = 20
		has_ring = no
		entity = "gas_giant_02_entity"
		change_orbit = 4
		
		moon = {
			name = "NAME_Triton"
			class = "pc_frozen"
			size = 6
			orbit_distance = 7
			orbit_angle = 115
			has_ring = no
		}
	}
	
	neighbor_system = {
		distance = { min = 10 max = @distance }	
		initializer = "cycle_neighbor_t1"
	}
	neighbor_system = {
		distance = { min = 10 max = @distance }	
		initializer = "cycle_neighbor_t1_first_colony"
	}
}

# ring Neighbor Tier 1
cycle_neighbor_t1 = {
	name = "Farnard"
	class = sc_black_hole
	init_effect = {
		spawn_megastructure = {
			type = "think_tank_ruined"
			location = event_target:nexus_planet		
		}
	}
	init_effect = {
		every_neighbor_system = {
			set_star_flag = empire_cluster
			every_neighbor_system = {
				set_star_flag = empire_cluster
			}
		}
	}

	planet = {
		count = 1
		class = pc_black_hole
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 45
	
	planet = {
		count = 1
		orbit_distance = 20
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			orbit_distance = 5
		}
	}
	
	planet = {
		count = { min = 2 max = 3 }
		orbit_distance = 20
		init_effect = {
			save_event_target_as = nexus_planet
		}
	}
	
	neighbor_system = {
		distance = { min = 10 max = @distance }	
		initializer = "cycle_neighbor_t2_second_colony"
	}
}

# Neighbor Tier 1 First Colony
cycle_neighbor_t1_first_colony = {	
	name = "Elpham"
	class = sc_g
	init_effect = {
		spawn_megastructure = {
			type = "dyson_sphere_ruined"
		}
	init_effect = {
		every_neighbor_system = {
			set_star_flag = empire_cluster
			every_neighbor_system = {
				set_star_flag = empire_cluster
			}
		}
	}

	planet = {
		name = "Elpham"
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 45
	
	planet = {
		count = { min = 2 max = 3 }
		orbit_distance = 20
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			orbit_distance = 5
		}
	}
	
	
	planet = {
		count = { min = 4 max = 5 }
		orbit_distance = 25
		
		change_orbit = @base_moon_distance
		
		moon = {			
			count = { min = 0 max = 1 }
			orbit_distance = 5
		}
	}
	
	neighbor_system = {
		distance = { min = 10 max = @distance }	
		initializer = "cycle_neighbor_t2"
	}
}


# ring Neighbor Tier 2
cycle_neighbor_t2 = {
	name = "Procyon"
	class = sc_f
	asteroids_distance = 70

	init_effect = {
		every_neighbor_system = {
			set_star_flag = empire_cluster
			every_neighbor_system = {
				set_star_flag = empire_cluster
			}
		}
	}
	init_effect = {
		spawn_megastructure = {
			type = "spy_orb_ruined" 
			}	
		}
	planet = {
		name = "Procyon_A"
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	planet = {
		count = 1
		orbit_distance = 45
	}
	
	change_orbit = 25
	
	planet = {
		count = { min = 1 max = 3 }
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = { min = 0 max = 360 }
	}
	
	planet = {
		count = { min = 2 max = 5 }
		orbit_distance = 25
		
		change_orbit = @base_moon_distance
		
		moon = {		
			count = { min = 0 max = 1 }
			orbit_distance = 5
		}
	}
}

# ring Neighbor Tier 2 Second Colony
cycle_neighbor_t2_second_colony = {
	name = "Sirius"
	class = sc_a

	init_effect = {
		every_neighbor_system = {
			set_star_flag = empire_cluster
			every_neighbor_system = {
				set_star_flag = empire_cluster
			}
		}
	}

	planet = {
		name = "Sirius"
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 45
	
	planet = {
		class = "pc_ringworld_habitable"
		name = "NAME_Eternal_Bastion"
		orbit_angle = 330
		orbit_distance = 0
		tile_blockers = none
		modifiers = none
	}
	planet = {
		class = "pc_ringworld_seam"
		name = "NAME_Ring_Section"
		orbit_angle = 30
		orbit_distance = 0
	}
	planet = {
		class = "pc_ringworld_tech"
		name = "NAME_Ring_Section"
		orbit_angle = 30
		orbit_distance = 0
	}

	init_effect = {
		spawn_megastructure = {
			type = "ring_world_ruined"
			orbit_angle = 90
			orbit_distance = 45
			location = planet
		}
		spawn_megastructure = {
			type = "ring_world_ruined"
			orbit_angle = 180
			orbit_distance = 45
			location = planet
		}
		spawn_megastructure = {
			type = "ring_world_ruined"
			orbit_angle = 270
			orbit_distance = 45
			location = planet
		}
	}
}
