namespace = painted_galaxy_extra_spawn

# checks if the starting system is missing the empire_home_system flag
# ie too many empires were created
# shows a warning to the player with the option to delete them
event = {
	id = painted_galaxy_extra_spawn.1
	is_triggered_only = yes
	hide_window = yes
	trigger = {
		is_maybe_painted_galaxy = yes
		any_country = {
			is_country_type = default
			capital_scope.solar_system = {
				NOR = {
					has_star_flag = empire_home_system
					# exceptions
					has_star_flag = chosen_system
					has_star_flag = starlit_sealed_system
					has_star_flag = overlord_empire_flag # imperial fiefdom liege and AI vassals
				}
			}
		}
	}
	immediate = {
		every_country = {
			limit = { is_ai = no }
			country_event = { id = painted_galaxy_extra_spawn.2 }
		}
	}
}

country_event = {
	id = painted_galaxy_extra_spawn.2
	title = painted_galaxy_extra_spawn.2.name
	desc = painted_galaxy_extra_spawn.2.desc
	picture = GFX_evt_unidentified_monster
	is_triggered_only = yes
	fire_only_once = yes
	option = {
		name = ACKNOWLEDGED
		custom_tooltip = approach_default
	}
	option = {
		name = BURN
		every_country = {
			limit = {
				is_country_type = default
				capital_scope.solar_system = {
					NOR = {
						has_star_flag = empire_home_system
						# exceptions
						has_star_flag = chosen_system
						has_star_flag = starlit_sealed_system
						has_star_flag = overlord_empire_flag # imperial fiefdom liege and AI vassals
					}
				}
			}
			every_owned_colony = {
				every_owned_pop_group = { kill_all_pop = yes }
				remove_all_buildings = yes
				destroy_colony = yes
			}
			every_controlled_fleet = { delete_fleet = this }
			destroy_country = yes
		}
	}
}
