namespace = stellarm
country_event = { #It splits lol
	id = stellar_manip.711
	title = "giga_mega.711.name"
	desc = "giga_mega.711.desc"
	picture = GFX_evt_supernova
	show_sound = event_super_explosion
	is_triggered_only = yes
	option = { name = "giga_mega.711.a" }

	trigger = {
		fromfrom = {
			
				
				is_ship_size = giga_o_systemcraft #adds this line so the o class system can be destroyed properly
			
		}
	}

	immediate = {
		subtract_variable = {
			which = giga_current_systemcraft
			value = 1
		}
		fromfrom = {
			solar_system = {
				save_event_target_as = giga_debris_system
				create_ambient_object = {
					type = systemcraft_death_explosion_effect
					location = ROOT.fromfrom
					duration = 30
					use_3d_location = yes
					entity_offset = 0
					scale = 1
				}
				create_fleet = {
					name = "Systemcraft Remains"
					settings = {
						spawn_debris = no
						can_change_composition = yes
						is_boss = yes
					}
					effect = {
						set_owner = ROOT
						while = {
							count = 4
							create_ship = {
								name = "Behemoth Planetcraft"
								graphical_culture = ROOT
								random_existing_design = giga_planet_behemoth
								effect = {
									set_ship_flag = giga_planet
									reduce_hp = 3000000
								}
							}
						}
						while = {
							count = 5
							create_ship = { 
								name = "Attack Moon" 
								random_existing_design = giga_massive_planet
								effect = {
									reduce_hp = 150000
								}
							}
						}
						set_formation_scale = 12
						set_location = {
							target = ROOT.fromfrom
							distance = 0
							angle = 0
						}
					}
				}
			}
			event_target:giga_temp_planet = { remove_planet = yes }
		}
	}
}