# Utopia Initializers

@base_moon_distance = 10

# Ruined Dyson Sphere
dyson_sphere_init_01 = {
	class = "rl_standard_stars"
	usage = misc_system_init

	flags = { ruined_dyson_system galactic_landmark_system }

	usage_odds = {
		base = @spawn_system_extreme
	}

	max_instances = 1
	scaled_spawn_chance = 2

	planet = {
		class = star
		orbit_distance = 0

		init_effect = {
			create_ambient_object = {
				type = "large_debris_object"
				entity_offset_height = { min = -0 max = -20 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 25
					angle = random
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				entity_offset_height = { min = -0 max = -20 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 22
					angle = random
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				entity_offset_height = { min = -0 max = -20 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 31
					angle = random
				}
			}
			create_ambient_object = {
				type = "medium_debris_01_object"
				entity_offset_height = { min = -0 max = -20 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 27
					angle = random
				}
			}
			create_ambient_object = {
				type = "medium_debris_02_object"
				entity_offset_height = { min = -0 max = -20 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 23
					angle = random
				}
			}
			create_ambient_object = {
				type = "medium_debris_01_object"
				entity_offset_height = { min = -0 max = -20 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 26
					angle = random
				}
			}
			create_ambient_object = {
				type = "medium_debris_02_object"
				entity_offset_height = { min = -0 max = -20 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 28
					angle = random
				}
			}
			create_ambient_object = {
				type = "small_debris_object"
				entity_offset_height = { min = -0 max = -20 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 22
					angle = random
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 35
					angle = 70
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 50
					angle = 100
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 65
					angle = 125
				}
			}
			create_ambient_object = {
				type = "medium_debris_01_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 47
					angle = 100
				}
			}
			create_ambient_object = {
				type = "medium_debris_02_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 51
					angle = 80
				}
			}
			create_ambient_object = {
				type = "medium_debris_01_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 40
					angle = 127
				}
			}
			create_ambient_object = {
				type = "medium_debris_02_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 55
					angle = 76
				}
			}
			create_ambient_object = {
				type = "small_debris_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 50
					angle = 120
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 35
					angle = 270
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 50
					angle = 300
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 65
					angle = 325
				}
			}
			create_ambient_object = {
				type = "medium_debris_01_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 47
					angle = 300
				}
			}
			create_ambient_object = {
				type = "medium_debris_02_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 51
					angle = 280
				}
			}
			create_ambient_object = {
				type = "medium_debris_01_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 40
					angle = 327
				}
			}
			create_ambient_object = {
				type = "medium_debris_02_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 55
					angle = 276
				}
			}
			create_ambient_object = {
				type = "small_debris_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 50
					angle = 320
				}
			}
		}
	}

	change_orbit = 45

	planet = {
		class = rl_unhabitable_planets
		count = { min = 2 max = 4 }
		orbit_distance = 25
		orbit_angle = { min = 90 max = 270 }
	}

	init_effect = {
		spawn_megastructure = { type = "dyson_sphere_ruined" }

		create_ambient_object = {
			type = "large_debris_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "large_debris_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "large_debris_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "medium_debris_01_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "medium_debris_02_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "medium_debris_01_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "medium_debris_02_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "small_debris_object"
			location = solar_system
		}
	}
}

# Ruined Science Nexus
science_nexus_init_01 = {
	class = sc_black_hole
	usage = misc_system_init

	flags = { ruined_nexus_system galactic_landmark_system }

	usage_odds = {
		base = @spawn_system_extreme
	}

	max_instances = 1
	scaled_spawn_chance = 4

	planet = {
		class = star
		orbit_distance = 0
	}

	change_orbit = 90

	planet = {
		class = "pc_broken"
		size = { min = 10 max = 15 }

		init_effect = { prevent_anomaly = yes }
	}

	change_orbit = 30

	planet = {
		class = "pc_gas_giant"
		orbit_angle = { min = 90 max = 270 }
		size = 40

		init_effect = {
			save_event_target_as = nexus_planet
		}
	}

	change_orbit = 40

	planet = {
		class = "pc_barren_cold"
		orbit_angle = { min = 90 max = 270 }
		size = { min = 10 max = 15 }
	}

	init_effect = {
		spawn_megastructure = {
			type = "think_tank_ruined"
			planet = event_target:nexus_planet

			init_effect = {
				create_ambient_object = {
					type = "large_debris_object"
					location = this
				}
				last_created_ambient_object = {
					set_location = {
						target = prev
						distance = 20
						angle = 20
					}
				}
				create_ambient_object = {
					type = "large_debris_object"
					location = this
				}
				last_created_ambient_object = {
					set_location = {
						target = prev
						distance = 20
						angle = 150
					}
				}
				create_ambient_object = {
					type = "medium_debris_01_object"
					location = this
				}
				last_created_ambient_object = {
					set_location = {
						target = prev
						distance = 35
						angle = 90
					}
				}
				create_ambient_object = {
					type = "medium_debris_02_object"
					location = this
				}
				last_created_ambient_object = {
					set_location = {
						target = prev
						distance = 3
						angle = 270
					}
				}
			}
		}
	}
}

# Ruined Sentry Array
sentry_array_init_01 = {
	class = "rl_standard_stars"
	usage = misc_system_init

	flags = { ruined_sentry_system galactic_landmark_system }

	usage_odds = {
		base = @spawn_system_extreme
	}

	max_instances = 1
	scaled_spawn_chance = 4

	planet = {
		class = star
		orbit_distance = 0
	}

	change_orbit = 45

	planet = {
		class = "pc_nuked"
		size = 16

		init_effect = {
			add_deposit = d_metal_boneyard
		}
	}

	change_orbit = 25

	planet = {
		class = "pc_barren"
		size = { min = 10 max = 15 }

		init_effect = {
			create_ambient_object = {
				type = "abandoned_starbase_01_object"
				location = this
			}
			create_ambient_object = {
				type = "medium_debris_01_object"
				location = this
			}
		}
	}

	change_orbit = 25

	planet = {
		class = "pc_gas_giant"
		orbit_angle = { min = 90 max = 270 }
		size = 40

		init_effect = {
			create_ambient_object = {
				type = "abandoned_starbase_01_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 10
					angle = 270
				}
			}
			create_ambient_object = {
				type = "abandoned_starbase_01_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 10
					angle = 180
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				location = this
			}
		}

		moon = {
			class = "pc_barren"
			size = 6
			orbit_distance = 20
			orbit_angle = { min = 90 max = 270 }
			has_ring = no

			init_effect = {
				create_ambient_object = {
					type = "abandoned_starbase_01_object"
					location = this
				}
				create_ambient_object = {
					type = "medium_debris_01_object"
					location = this
				}
			}
		}
	}

	change_orbit = 25

	planet = {
		class = "pc_gas_giant"
		orbit_angle = { min = 90 max = 270 }
		size = 30

		init_effect = {
			create_ambient_object = {
				type = "abandoned_starbase_01_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 7
					angle = 270
				}
			}
			create_ambient_object = {
				type = "abandoned_starbase_01_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 7
					angle = 180
				}
			}
			create_ambient_object = {
				type = "abandoned_starbase_01_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 7
					angle = 0
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 15
					angle = 0
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 15
					angle = 180
				}
			}
		}

		moon = {
			class = "pc_barren_cold"
			size = 6
			orbit_distance = 20
			orbit_angle = { min = 90 max = 270 }
			has_ring = no
		}
		moon = {
			class = "pc_frozen"
			size = 6
			orbit_distance = 6
			orbit_angle = { min = 90 max = 270 }
			has_ring = no
		}
		moon = {
			class = "pc_barren"
			size = 6
			orbit_distance = 6
			orbit_angle = { min = 90 max = 270 }
			has_ring = no

			init_effect = {
				save_event_target_as = sentry_planet
			}
		}
	}

	change_orbit = 25

	planet = {
		class = "pc_gas_giant"
		orbit_angle = { min = 90 max = 270 }
		size = 35

		init_effect = {
			create_ambient_object = {
				type = "abandoned_starbase_01_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 10
					angle = 270
				}
			}
			create_ambient_object = {
				type = "abandoned_starbase_01_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 10
					angle = 180
				}
			}
			create_ambient_object = {
				type = "abandoned_starbase_01_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 10
					angle = 0
				}
			}
			create_ambient_object = {
				type = "abandoned_starbase_01_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 10
					angle = 90
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 15
					angle = 180
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 15
					angle = 0
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 15
					angle = 270
				}
			}
		}

		moon = {
			class = "pc_frozen"
			size = 6
			orbit_distance = 20
			orbit_angle = { min = 90 max = 270 }
			has_ring = no
		}
		moon = {
			class = "pc_frozen"
			size = 6
			orbit_distance = 6
			orbit_angle = { min = 90 max = 270 }
			has_ring = no

			init_effect = {
				create_ambient_object = {
					type = "abandoned_starbase_01_object"
					location = this
				}
				create_ambient_object = {
					type = "medium_debris_01_object"
					location = this
				}
			}
		}
	}

	change_orbit = 25

	planet = {
		class = "pc_frozen"
		size = { min = 10 max = 15 }

		init_effect = {
			create_ambient_object = {
				type = "abandoned_starbase_01_object"
				location = this
			}
			create_ambient_object = {
				type = "medium_debris_02_object"
				location = this
			}
		}
	}

	init_effect = {
		spawn_megastructure = {
			type = "spy_orb_ruined"
			planet = event_target:sentry_planet
		}

		create_ambient_object = {
			type = "large_debris_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "large_debris_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "large_debris_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "medium_debris_01_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "medium_debris_02_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "medium_debris_01_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "medium_debris_02_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "small_debris_object"
			location = solar_system
		}
	}
}

# Ruined Ring World
ring_world_init_01 = {
	class = "rl_standard_stars"
	usage = misc_system_init

	flags = { ruined_ring_system galactic_landmark_system }

	usage_odds = {
		base = @spawn_system_extreme
	}

	max_instances = 1
	scaled_spawn_chance = 3

	planet = {
		class = star
		orbit_distance = 0

		init_effect = {
			IF = {
				limit = { has_distar = yes }
				random_list = {
					50 = {
						add_anomaly = {
							category = DISTAR_CLONE_CAT
						}
					}
					50 = {
						#nothing
					}
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				entity_offset_height = { min = -0 max = -25 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 45
					angle = random
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				entity_offset_height = { min = -0 max = -25 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 45
					angle = random
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				entity_offset_height = { min = -0 max = -25 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 45
					angle = random
				}
			}
			create_ambient_object = {
				type = "large_debris_object"
				entity_offset_height = { min = -0 max = -25 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 45
					angle = random
				}
			}
			create_ambient_object = {
				type = "medium_debris_01_object"
				entity_offset_height = { min = -0 max = -25 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 45
					angle = random
				}
			}
			create_ambient_object = {
				type = "medium_debris_02_object"
				entity_offset_height = { min = -0 max = -25 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 45
					angle = random
				}
			}
			create_ambient_object = {
				type = "medium_debris_01_object"
				entity_offset_height = { min = -0 max = -25 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 45
					angle = random
				}
			}
			create_ambient_object = {
				type = "medium_debris_02_object"
				entity_offset_height = { min = -0 max = -25 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 45
					angle = random
				}
			}
			create_ambient_object = {
				type = "small_debris_object"
				entity_offset_height = { min = -0 max = -25 }
				location = this
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					distance = 45
					angle = random
				}
			}
		}
	}

	change_orbit = 45

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

		create_ambient_object = {
			type = "large_debris_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "large_debris_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "large_debris_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "medium_debris_01_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "medium_debris_02_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "medium_debris_01_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "medium_debris_02_object"
			location = solar_system
		}
		create_ambient_object = {
			type = "small_debris_object"
			location = solar_system
		}
	}
}

