namespace = star_printer

###########################
#####Print systemcraft#####
###########################

country_event = { #print regular
	id = star_printer.1000
	title = "star_printer.1000.name"
	desc = "star_printer.1000.desc"
	hide_window = no
	is_triggered_only = yes
	show_sound = event_ringworld_build_complete
	location = event_target:star_printer_location
	picture = GFX_evt_binary_stars

	immediate = {
		random_owned_megastructure = {
			limit = { is_megastructure_type = systemcraft_assembler_make_system NOT = { has_megastructure_flag = already_printed_a_star } }
			set_megastructure_flag = already_printed_a_star
			save_global_event_target_as = latest_star_printer
			planet = { save_global_event_target_as = star_printer_location }
			solar_system = {
				spawn_megastructure = {
					type = "systemcraft_assembler_5"
					planet = PREV.planet
					owner = root
				}
			}
			create_fleet = {
				name = "Stellar Systemcraft"
				settings = {
					spawn_debris = no 
					can_change_composition = no
					is_boss = yes
				}
				effect = {
					set_owner = prev
					create_ship = {
						name = "Stellar Systemcraft"
						random_existing_design = giga_systemcraft
						effect = {
							set_ship_flag = random
							add_modifier = {
								modifier = printed_celestial_warship
								days = -1
							}
						}
					}
					set_formation_scale = 10
					set_location = {
						target = event_target:latest_star_printer
						distance = 20
						angle = 0
					}
				}
			}
			remove_megastructure = this
		}
	}

	option = { #Good, good.
		name = "giga_printer.1000.a"
	}
}

country_event = { #print o class
	id = star_printer.1001
	title = "star_printer.1000.name"
	desc = "star_printer.1000.desc"
	hide_window = no
	is_triggered_only = yes
	show_sound = event_ringworld_build_complete
	location = event_target:star_printer_location
	picture = GFX_evt_binary_stars

	immediate = {
		random_owned_megastructure = {
			limit = { is_megastructure_type = systemcraft_assembler_make_o_system NOT = { has_megastructure_flag = already_printed_a_star } }
			set_megastructure_flag = already_printed_a_star
			save_global_event_target_as = latest_star_printer
			planet = { save_global_event_target_as = star_printer_location }
			solar_system = {
				spawn_megastructure = {
					type = "systemcraft_assembler_5"
					planet = PREV.planet
					owner = root
				}
			}
			create_fleet = {
				name = "Stellar Systemcraft"
				settings = {
					spawn_debris = no 
					can_change_composition = no
					is_boss = yes
				}
				effect = {
					set_owner = prev
					create_ship = {
						name = "Stellar Systemcraft"
						random_existing_design = giga_o_systemcraft
						effect = {
							set_ship_flag = random
							add_modifier = {
								modifier = printed_celestial_warship
								days = -1
							}
						}
					}
					set_formation_scale = 10
					set_location = {
						target = event_target:latest_star_printer
						distance = 20
						angle = 0
					}
				}
			}
			remove_megastructure = this
		}
	}

	option = { #Good, good.
		name = "giga_printer.1000.a"
	}
}

#Build stages
country_event = {
	id = star_printer.101
	title = star_printer.101.name
	desc = star_printer.101.desc
	picture = GFX_evt_binary_stars
	is_triggered_only = yes
	hide_window = no
	show_sound = event_dyson_sphere_build_start
	location = event_target:star_manip_system

	option = { #Good, good.
		name = "star_printer.101.a"
	}
}
country_event = {
	id = star_printer.102
	title = star_printer.102.name
	desc = star_printer.102.desc
	picture = GFX_evt_binary_stars
	is_triggered_only = yes
	hide_window = no
	show_sound = event_dyson_sphere_build_upgrade_panel
	location = event_target:star_manip_system

	option = { #Good, good.
		name = "star_printer.102.a"
	}
}
country_event = {
	id = star_printer.103
	title = star_printer.103.name
	desc = star_printer.103.desc
	picture = GFX_evt_binary_stars
	is_triggered_only = yes
	hide_window = no
	show_sound = event_dyson_sphere_build_upgrade_panel
	location = event_target:star_manip_system

	option = { #Good, good.
		name = "star_printer.103.a"
	}
}
country_event = {
	id = star_printer.104
	title = star_printer.104.name
	desc = star_printer.104.desc
	picture = GFX_evt_binary_stars
	is_triggered_only = yes
	hide_window = no
	show_sound = event_dyson_sphere_build_upgrade_panel
	location = event_target:star_manip_system

	option = { #Good, good.
		name = "star_printer.104.a"
	}
}
country_event = {
	id = star_printer.105
	title = star_printer.105.name
	desc = star_printer.105.desc
	picture = GFX_evt_binary_stars
	is_triggered_only = yes
	hide_window = no
	show_sound = event_dyson_sphere_build_upgrade_panel
	location = event_target:star_manip_system

	option = { #Good, good.
		name = "star_printer.105.a"
	}
}
country_event = {
	id = star_printer.106
	title = star_printer.106.name
	desc = star_printer.106.desc
	picture = GFX_evt_binary_stars
	is_triggered_only = yes
	hide_window = no
	show_sound = event_dyson_sphere_build_complete
	location = event_target:star_manip_system

	option = { #Good, good.
		name = "star_printer.106.a"
	}
}