# Machine Age Initializers

@base_moon_distance = 10
@close_moon_distance = 5

arc_welders_construction_system = {
	class = "rl_standard_stars"
	flags = { arc_welders_construction_system }

	asteroid_belt = {
		type = rocky_asteroid_belt
		radius = 125
	}

	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
		modifiers = none
		init_effect = {
			prevent_anomaly = yes
			clear_deposits = yes
			add_deposit = d_energy_1
		}
	}

	planet = {
		orbit_distance = 25
		class = pc_barren
		change_orbit = @base_moon_distance
		modifiers = none
		init_effect = {
			prevent_anomaly = yes
			clear_deposits = yes
		}
	}

	planet = {
		orbit_distance = 20
		class = pc_molten
		change_orbit = @base_moon_distance
		modifiers = none
		init_effect = {
			prevent_anomaly = yes
			clear_deposits = yes
			add_deposit = d_minerals_3
			add_deposit = d_alloys_1
		}

		moon = {
			count = 2
			class = rl_barren_planets
			orbit_distance = @close_moon_distance
			modifiers = none
			init_effect = {
				prevent_anomaly = yes
				clear_deposits = yes
			}
		}
	}

	planet = {
		class = rl_unhabitable_planets
		orbit_distance = 25
		modifiers = none
		init_effect = {
			prevent_anomaly = yes
			clear_deposits = yes
		}

		change_orbit = @base_moon_distance

		moon = {
			count = 2
			class = rl_barren_planets
			orbit_distance = @close_moon_distance
			modifiers = none
			init_effect = {
				prevent_anomaly = yes
				clear_deposits = yes
			}
		}
	}

	planet = {
		class = rl_unhabitable_planets
		orbit_distance = 25
		has_ring = yes
		modifiers = none
		init_effect = {
			prevent_anomaly = yes
			clear_deposits = yes
		}
	}

	change_orbit = 30

	planet = {
		count = 8
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = { min = 20 max = 45 }
		size = 5
		has_ring = no
		modifiers = none
		init_effect = {
			prevent_anomaly = yes
			clear_deposits = yes
		}
	}

	change_orbit = 30

	planet = {
		count = 1
		class = pc_gas_giant
		orbit_distance = @close_moon_distance
		has_ring = yes
		modifiers = none
		init_effect = {
			prevent_anomaly = yes
			clear_deposits = yes
		}

		change_orbit = @base_moon_distance

		moon = {
			count = 4
			size = { min = 5 max = 10 }
			class = rl_barren_planets
			orbit_distance = @close_moon_distance
			modifiers = none
			init_effect = {
				prevent_anomaly = yes
				clear_deposits = yes
			}
		}
	}
}

# Ruined Arc Furnace Initializers

ruined_arc_furnace_system = {
	class = "rl_standard_stars"
	usage = misc_system_init
	flags = { ruined_arc_furnace_system galactic_landmark_system }

	max_instances = 1
	scaled_spawn_chance = 4

	usage_odds = {
		base = 0
		modifier = {
			host_has_dlc = "The Machine Age"
			add = @spawn_system_extreme
		}
	}

	asteroid_belt = {
		type = rocky_asteroid_belt
		radius = 125
	}

	planet = {
		count = 1
		class = star
		orbit_distance = 0
		orbit_angle = 1
		size = { min = 20 max = 30 }
		has_ring = no
		modifiers = none
		init_effect = {
			prevent_anomaly = yes
			clear_deposits = yes
			add_deposit = d_energy_1
		}
	}

	planet = {
		orbit_distance = 25
		class = pc_barren
		change_orbit = @base_moon_distance
		modifiers = none
		init_effect = {
			prevent_anomaly = yes
			clear_deposits = yes
		}
	}

	planet = {
		orbit_distance = 20
		class = pc_molten
		change_orbit = @base_moon_distance
		modifiers = none
		init_effect = {
			save_event_target_as = ruined_furnace_planet
			prevent_anomaly = yes
			clear_deposits = yes
			add_deposit = d_minerals_3
			add_deposit = d_alloys_1
		}

		moon = {
			count = 2
			class = rl_barren_planets
			orbit_distance = @close_moon_distance
			modifiers = none
			init_effect = {
				prevent_anomaly = yes
				clear_deposits = yes
			}
		}
	}

	planet = {
		class = rl_unhabitable_planets
		orbit_distance = 25
		modifiers = none
		init_effect = {
			prevent_anomaly = yes
			clear_deposits = yes
		}

		change_orbit = @base_moon_distance

		moon = {
			count = 2
			class = rl_barren_planets
			orbit_distance = @close_moon_distance
			modifiers = none
			init_effect = {
				prevent_anomaly = yes
				clear_deposits = yes
			}
		}
	}

	planet = {
		class = rl_unhabitable_planets
		orbit_distance = 25
		has_ring = yes
		modifiers = none
		init_effect = {
			prevent_anomaly = yes
			clear_deposits = yes
		}
	}

	change_orbit = 30

	planet = {
		count = 8
		class = "pc_asteroid"
		orbit_distance = 0
		orbit_angle = { min = 20 max = 45 }
		size = 5
		has_ring = no
		modifiers = none
		init_effect = {
			prevent_anomaly = yes
			clear_deposits = yes
		}
	}

	change_orbit = 30

	planet = {
		count = 1
		class = pc_gas_giant
		orbit_distance = @close_moon_distance
		has_ring = yes
		modifiers = none
		init_effect = {
			prevent_anomaly = yes
			clear_deposits = yes
		}

		change_orbit = @base_moon_distance

		moon = {
			count = 4
			size = { min = 5 max = 10 }
			class = rl_barren_planets
			orbit_distance = @close_moon_distance
			modifiers = none
			init_effect = {
				prevent_anomaly = yes
				clear_deposits = yes
			}
		}
	}
	init_effect = {
		spawn_megastructure = {
			type = "orbital_arc_furnace_destroyed"
			planet = event_target:ruined_furnace_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
					}
				}
			}
		}
		event_target:ruined_furnace_planet = {
			set_planet_entity = { entity = invisible_turret_entity }
		}
	}
}
