#########################################
#										
#  Randomly Generated Starting Systems  #
#										
#########################################

@distance = 50
@planet_min_size = 10
@planet_max_size = 25
@base_moon_distance = 10
@moon_min_size = 6
@moon_max_size = 10

### STARTING SYSTEMS

# Empire Initializer I
random_empire_init_01 = {
	class = "rl_standard_stars"
	asteroids_distance = 50
	
	usage = empire_init
	
	flags = { empire_home_system }

	init_effect = {
		every_neighbor_system = {
			set_star_flag = empire_cluster
			every_neighbor_system = {
				set_star_flag = empire_cluster
			}
		}
		
		generate_home_system_resources = yes
	}
	
	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 50
	
	planet = {
		count = { min = 1 max = 3 }
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = { min = 40 max = 100 }
	}
	
	planet = {
		count = { min = 0 max = 2 }
		orbit_distance = 20
		class = random_non_colonizable
		orbit_angle = { min = 90 max = 270 }
		
		change_orbit = @base_moon_distance

		moon = {
			count = { min = 0 max = 1 }
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	planet = {
		count = 1
		orbit_distance = 20
		home_planet = yes
		class = ideal_planet_class
		orbit_angle = { min = 90 max = 270 }
		size = 25
		tile_blockers = none
		modifiers = none

		init_effect = {
			prevent_anomaly = yes
		}
		
		init_effect = {
			generate_start_buildings_and_blockers = 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
		}
	}
	
	planet = {
		count = { min = 2 max = 4 }
		orbit_distance = 20
		class = random_non_colonizable
		orbit_angle = { min = 90 max = 270 }
		
		change_orbit = @base_moon_distance

		moon = {
			count = { min = 0 max = 1 }
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	planet = {
		count = { min = 1 max = 2 }
		orbit_distance = 20
		class = pc_gas_giant
		orbit_angle = { min = 90 max = 270 }
		
		change_orbit = @base_moon_distance

		moon = {
			count = { min = 0 max = 3 }
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	neighbor_system = {
		distance = { min = 10 max = @distance }
		initializer = "neighbor_t1"
	}
	neighbor_system = {
		distance = { min = 10 max = @distance }	
		initializer = "neighbor_t1_first_colony"
	}
}

# Empire Initializer II
random_empire_init_02 = {
	class = "rl_standard_stars"
	asteroids_distance = 115
	
	usage = empire_init
	
	flags = { empire_home_system }

	init_effect = {
		every_neighbor_system = {
			set_star_flag = empire_cluster
			every_neighbor_system = {
				set_star_flag = empire_cluster
			}
		}
		
		generate_home_system_resources = yes
	}
		
	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 50
	
	planet = {
		count = 1
		home_planet = yes
		class = ideal_planet_class
		orbit_distance = 0
		orbit_angle = { min = 90 max = 270 }
		size = 25
		tile_blockers = none
		modifiers = none

		init_effect = {
			prevent_anomaly = yes
		}
		
		init_effect = {
			generate_start_buildings_and_blockers = 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
		}
	}
	
	planet = {
		count = 2
		orbit_distance = 20
		class = random_non_colonizable
		orbit_angle = { min = 90 max = 270 }
		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 = 25
	
	planet = {
		count = { min = 2 max = 3 }
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = { min = 40 max = 110 }
	}
	
	planet = {
		count = { min = 2 max = 4 }
		orbit_distance = 25
		class = random_non_colonizable
		orbit_angle = { min = 90 max = 270 }
		
		change_orbit = @base_moon_distance

		moon = {
			count = { min = 0 max = 1 }
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	planet = {
		count = { min = 1 max = 2 }
		orbit_distance = 20
		class = pc_gas_giant
		orbit_angle = { min = 90 max = 270 }
		
		change_orbit = @base_moon_distance

		moon = {
			count = { min = 0 max = 3 }
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	planet = {
		count = { min = 0 max = 2 }
		orbit_distance = 20
		class = random_non_colonizable
		orbit_angle = { min = 90 max = 270 }
	}
	
	neighbor_system = {
		distance = { min = 10 max = @distance }	
		initializer = "neighbor_t1"
	}
	neighbor_system = {
		distance = { min = 10 max = @distance }	
		initializer = "neighbor_t1_first_colony"
	}
}

# Empire Initializer III
random_empire_init_03 = {
	class = "rl_standard_stars"
	asteroids_distance = 85
	
	usage = empire_init
	
	flags = { empire_home_system }

	init_effect = {
		every_neighbor_system = {
			set_star_flag = empire_cluster
			every_neighbor_system = {
				set_star_flag = empire_cluster
			}
		}
		
		generate_home_system_resources = yes
	}
		
	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 40
	
	planet = {
		count = 1
		orbit_distance = 20
		class = random_non_colonizable
		orbit_angle = { min = 90 max = 270 }
		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 = 25
	
	planet = {
		count = { min = 1 max = 2 }
		class = random_asteroid
		orbit_distance = 0
		orbit_angle = { min = 120 max = 300 }
	}
	
	planet = {
		count = 1
		orbit_distance = 25
		class = random_non_colonizable
		orbit_angle = { min = 90 max = 270 }
		change_orbit = @base_moon_distance

		moon = {
			count = { min = 0 max = 1 }
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	planet = {
		count = 1
		orbit_distance = 25
		class = pc_gas_giant
		orbit_angle = { min = 90 max = 270 }
		size = 25
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = 1
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 4
		}
		
		moon = {
			count = 1
			home_planet = yes
			class = ideal_planet_class
			orbit_distance = 10
			orbit_angle = { min = 90 max = 270 }
			size = 25
			tile_blockers = none
			modifiers = none

			init_effect = {
				prevent_anomaly = yes
			}
		
			init_effect = {
				generate_start_buildings_and_blockers = yes		
			}
		}
	}
	
	planet = {
		count = { min = 1 max = 3 }
		orbit_distance = 25
		class = random_non_colonizable
		orbit_angle = { min = 90 max = 270 }
	}
	
	planet = {
		count = { min = 1 max = 2 }
		orbit_distance = 20
		class = pc_gas_giant
		orbit_angle = { min = 90 max = 270 }
		
		change_orbit = @base_moon_distance

		moon = {
			count = { min = 0 max = 3 }
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	planet = {
		count = { min = 0 max = 1 }
		orbit_distance = 20
		class = random_non_colonizable
		orbit_angle = { min = 90 max = 270 }
	}
	
	neighbor_system = {
		distance = { min = 10 max = @distance }		
		initializer = "neighbor_t1"
	}
	neighbor_system = {
		distance = { min = 10 max = @distance }		
		initializer = "neighbor_t1_first_colony"
	}
}

# Empire Initializer IV
random_empire_init_04 = {
	class = "rl_standard_stars"
	
	usage = empire_init
	
	flags = { empire_home_system }

	init_effect = {
		every_neighbor_system = {
			set_star_flag = empire_cluster
			every_neighbor_system = {
				set_star_flag = empire_cluster
			}
		}
		
		generate_home_system_resources = yes
	}
		
	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 35
	
	planet = {
		count = { min = 1 max = 3 }
		orbit_distance = 15
		class = random_non_colonizable
		orbit_angle = { min = 90 max = 270 }
	}
	
	planet = {
		count = 1
		orbit_distance = 20
		home_planet = yes
		class = ideal_planet_class
		orbit_angle = { min = 90 max = 270 }
		size = 25
		tile_blockers = none
		modifiers = none

		init_effect = {
			prevent_anomaly = yes
		}
		
		init_effect = {
			generate_start_buildings_and_blockers = 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
		}
	}
	
	planet = {
		count = { min = 1 max = 3 }
		orbit_distance = 25
		class = random_non_colonizable
		orbit_angle = { min = 90 max = 270 }
	}
	
	planet = {
		count = { min = 1 max = 2 }
		orbit_distance = 20
		class = pc_gas_giant
		orbit_angle = { min = 90 max = 270 }
		
		change_orbit = @base_moon_distance

		moon = {
			count = { min = 1 max = 3 }
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	planet = {
		count = { min = 0 max = 1 }
		orbit_distance = 20
		class = random_non_colonizable
		orbit_angle = { min = 90 max = 270 }
	}
	
	neighbor_system = {
		distance = { min = 10 max = @distance }		
		initializer = "neighbor_t1"
	}
	neighbor_system = {
		distance = { min = 10 max = @distance }		
		initializer = "neighbor_t1_first_colony"
	}
}

### NEIGHBORING SYSTEMS

# Neighbor Tier 1
neighbor_t1 = {
	class = "rl_standard_stars"

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

	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 = 0 max = 2 }
		orbit_distance = 20
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			orbit_distance = 5
		}
	}
	
	planet = {
		count = { min = 2 max = 5 }
		orbit_distance = 20
	}
	
	neighbor_system = {
		distance = { min = 10 max = @distance }	
		initializer = "neighbor_t2_second_colony"
	}
}

# Neighbor Tier 1 First Colony
neighbor_t1_first_colony = {	
	class = "rl_standard_stars"

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

	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 = 0 max = 2 }
		orbit_distance = 20
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			orbit_distance = 5
		}
	}
	
	planet = {
		count = 1
		orbit_distance = 25
		class = ideal_planet_class
		tile_blockers = none
		modifiers = none
		anomaly = none
		orbit_angle = { min = 90 max = 270 }
		size = { min = 12 max = 18 }
		
		init_effect = {
			set_planet_flag = prescripted_ideal		# used by code, do not remove
		}
		init_effect = {
			random_tile = {
				limit = { has_blocker = no has_building = no }
				set_blocker = random
			}
		}
		init_effect = {
			random_tile = {
				limit = { has_blocker = no has_building = no }
				set_blocker = random
			}
		}
		init_effect = {
			random_tile = {
				limit = { has_blocker = no has_building = no }
				set_blocker = random
			}
		}
		init_effect = {
			random_tile = {
				limit = { has_blocker = no has_building = no }
				set_blocker = random
			}
		}
		init_effect = {
			random_tile = {
				limit = { has_blocker = no has_building = no }
				set_blocker = random
			}
		}	
	}
	
	planet = {
		count = { min = 2 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 = "neighbor_t2"
	}
}

# Neighbor Tier 2
neighbor_t2 = {
	class = "rl_standard_stars"
	asteroids_distance = 70

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

	planet = {
		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 = 15 max = 110 }
	}
	
	planet = {
		count = { min = 2 max = 5 }
		orbit_distance = 25
		
		change_orbit = @base_moon_distance
		
		moon = {		
			count = { min = 0 max = 1 }
			orbit_distance = 5
		}
	}
}

# Neighbor Tier 2 Second Colony
neighbor_t2_second_colony = {
	class = "rl_standard_stars"

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

	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
	}
	
	change_orbit = 25
	
	planet = {
		count = 2
		orbit_angle = { min = 90 max = 270 }
		orbit_distance = 20
	}
	
	planet = {
		count = 1
		orbit_distance = 25
		class = ideal_planet_class
		orbit_angle = { min = 90 max = 270 }
		size = { min = 14 max = 24 }
		
		change_orbit = @base_moon_distance
		
		init_effect = {
			set_planet_flag = prescripted_ideal		# used by code, do not remove
		}		

		moon = {
			count = { min = 0 max = 1 }
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	planet = {
		count = 2
		orbit_angle = { min = 90 max = 270 }
		orbit_distance = 20
		
		change_orbit = @base_moon_distance
		
		moon = {
			count = { min = 0 max = 1 }
			class = random_non_colonizable
			orbit_angle = { min = 90 max = 270 }
			orbit_distance = 5
		}
	}
	
	planet = {
		count = { min = 0 max = 2 }
		orbit_angle = { min = 90 max = 270 }
		orbit_distance = 20
	}
}