add_namespace = stt

country_event = {
    id = stt.100
    hidden = yes 
    is_triggered_only = yes
    
    immediate = {

		if = {
			limit = { check_variable = { global.bombardment_intensity = 1 } NOT = { has_country_flag = has_target_TAG } has_country_flag = activate_bombardment_flag }

			random_state = {
				limit = { controller = { has_war_with = ROOT } is_fully_controlled_by = controller }

				PREV = {
					launch_nuke = {
						state = PREV.THIS
						use_nuke = no
						nuke_type = thermonuclear_bomb
					}
				}

				controller = {
					orbital_bombardment_effect = yes
				}

				if = {
					limit = { NOT = { is_core_of = ROOT } }

					set_temp_variable = {
						local_pop = state_population_k
					}
					if = {
						limit = {
							ROOT = {
								has_decision = orbital_bombardment_abduction_name
							}
						}
						ROOT = { add_manpower = PREV.state_population_k }
					}
					divide_temp_variable = {
						local_pop = -25
					}
					add_manpower = local_pop
				}
			}

			country_event = {
				id = stt.100
				hours = 4
				random_hours = 4
			}
		}

		else_if = {
			limit = { check_variable = { global.bombardment_intensity = 1 } has_country_flag = has_target_TAG }

			var:target_TAG_var = {
				random_controlled_state = {
					limit = { is_fully_controlled_by = controller controller = { has_war_with = ROOT } }
					PREV = {
						launch_nuke = {
							state = PREV.THIS
							use_nuke = no
							nuke_type = thermonuclear_bomb
						}
					}

					controller = {
						orbital_bombardment_effect = yes
					}

					if = {
						limit = { NOT = { is_core_of = ROOT } }

						set_temp_variable = {
							local_pop = state_population_k
						}
						if = {
							limit = {
								ROOT = {
									has_decision = orbital_bombardment_abduction_name
								}
							}
							ROOT = { add_manpower = PREV.state_population_k }
						}
						divide_temp_variable = {
							local_pop = -25
						}
						add_manpower = local_pop
					}
				}
			}
			

			country_event = {
				id = stt.100
				hours = 4
				random_hours = 4
			}
		}

		if = {
			limit = { check_variable = { global.bombardment_intensity = 2 } NOT = { has_country_flag = has_target_TAG } has_country_flag = activate_bombardment_flag }

			random_state = {
				limit = { controller = { has_war_with = ROOT } is_fully_controlled_by = controller }

				PREV = {
					launch_nuke = {
						state = PREV.THIS
						use_nuke = no
						nuke_type = thermonuclear_bomb
					}
				}

				controller = {
					orbital_bombardment_effect = yes
				}

				if = {
					limit = { NOT = { is_core_of = ROOT } }

					set_temp_variable = {
						local_pop = state_population_k
					}
					divide_temp_variable = {
						local_pop = -50
					}
					add_manpower = local_pop
					add_dynamic_modifier = {
						modifier = irradiated
						days = 60
					}
				}
			}

			random_state = {
				limit = { controller = { has_war_with = ROOT } is_fully_controlled_by = controller }

				PREV = {
					launch_nuke = {
						state = PREV.THIS
						use_nuke = no
						nuke_type = thermonuclear_bomb
					}
				}

				controller = {
					orbital_bombardment_effect = yes
				}

				if = {
					limit = { NOT = { is_core_of = ROOT } }

					set_temp_variable = {
						local_pop = state_population_k
					}
					divide_temp_variable = {
						local_pop = -50
					}
					add_manpower = local_pop
					add_dynamic_modifier = {
						modifier = irradiated
						days = 60
					}
				}
			}

			country_event = {
				id = stt.100
				hours = 4
				random_hours = 4
			}
		}

		else_if = {
			limit = { check_variable = { global.bombardment_intensity = 2 } has_country_flag = has_target_TAG }

			var:target_TAG_var = {
				random_controlled_state = {
					limit = { is_fully_controlled_by = controller controller = { has_war_with = ROOT } }
					PREV = {
						launch_nuke = {
							state = PREV.THIS
							use_nuke = no
							nuke_type = thermonuclear_bomb
						}
					}

					controller = {
						orbital_bombardment_effect = yes
					}

					if = {
						limit = { NOT = { is_core_of = ROOT } }

						set_temp_variable = {
							local_pop = state_population_k
						}
						divide_temp_variable = {
							local_pop = -50
						}
						add_manpower = local_pop
						add_dynamic_modifier = {
							modifier = irradiated
							days = 60
						}
					}
				}

				random_controlled_state = {
					limit = { is_fully_controlled_by = controller controller = { has_war_with = ROOT } }
					PREV = {
						launch_nuke = {
							state = PREV.THIS
							use_nuke = no
							nuke_type = thermonuclear_bomb
						}
					}

					controller = {
						orbital_bombardment_effect = yes
					}

					if = {
						limit = { NOT = { is_core_of = ROOT } }

						set_temp_variable = {
							local_pop = state_population_k
						}
						divide_temp_variable = {
							local_pop = -50
						}
						add_manpower = local_pop
						add_dynamic_modifier = {
							modifier = irradiated
							days = 60
						}
					}
				}
			}

			country_event = {
				id = stt.100
				hours = 4
				random_hours = 4
			}
		}

		if = {
			limit = { check_variable = { global.bombardment_intensity = 4 } NOT = { has_country_flag = has_target_TAG } has_country_flag = activate_bombardment_flag }

			random_state = {
				limit = { controller = { has_war_with = ROOT } is_fully_controlled_by = controller }

				controller = {
					orbital_bombardment_effect = yes
				}

				if = {
					limit = { NOT = { is_core_of = ROOT } }

					PREV.PREV = {
						if = {
							limit = {
								check_variable = { state_population_k > 10000 }
							}
							set_temp_variable = { local_pop = -2000000 }
						}
						else = {
							set_temp_variable = { local_pop = state_population_k }
							multiply_temp_variable = { local_pop = -100 }
						}
						add_manpower = local_pop
						add_dynamic_modifier = {
							modifier = irradiated
						}
						add_dynamic_modifier = {
							modifier = ruined_district
						}

						set_temp_variable = { damage_industrial_complex_temp = damaged_building_level@industrial_complex }
						set_temp_variable = { damage_arms_factory_temp = damaged_building_level@arms_factory }
						set_temp_variable = { damage_dockyard_temp = damaged_building_level@dockyard }
						set_temp_variable = { damage_stronghold_network_temp = damaged_building_level@stronghold_network }
						set_temp_variable = { damage_synthetic_refinery_temp = damaged_building_level@synthetic_refinery }
						set_temp_variable = { damage_fuel_silo_temp = damaged_building_level@fuel_silo }
						set_temp_variable = { damage_mega_gun_emplacement_temp = damaged_building_level@mega_gun_emplacement }
						set_temp_variable = { damage_rocket_site_temp = damaged_building_level@rocket_site }
						set_temp_variable = { damage_nuclear_reactor_temp = damaged_building_level@nuclear_reactor }
						set_temp_variable = { damage_nuclear_reactor_heavy_water_temp = damaged_building_level@nuclear_reactor_heavy_water }
						set_temp_variable = { damage_commercial_nuclear_reactor_temp = damaged_building_level@commercial_nuclear_reactor }
						if = {
							limit = { check_variable = { damage_dockyard_temp > 0 } }
							remove_building = {
								type = dockyard
								level = damage_dockyard_temp
							}
						}
						if = {
							limit = { check_variable = { damage_arms_factory_temp > 0 } }
							remove_building = {
								type = arms_factory
								level = damage_arms_factory_temp
							}
						}
						if = {
							limit = { check_variable = { damage_industrial_complex_temp > 0 } }
							remove_building = {
								type = industrial_complex
								level = damage_industrial_complex_temp
							}
						}
						if = {
							limit = { check_variable = { damage_stronghold_network_temp > 0 } }
							remove_building = {
								type = stronghold_network
								level = damage_stronghold_network_temp
							}
						}
						if = {
							limit = { check_variable = { damage_synthetic_refinery_temp > 0 } }
							remove_building = {
								type = synthetic_refinery
								level = damage_synthetic_refinery_temp
							}
						}
						if = {
							limit = { check_variable = { damage_fuel_silo_temp > 0 } }
							remove_building = {
								type = fuel_silo
								level = damage_fuel_silo_temp
							}
						}
						if = {
							limit = { check_variable = { damage_mega_gun_emplacement_temp > 0 } }
							remove_building = {
								type = mega_gun_emplacement
								level = damage_mega_gun_emplacement_temp
							}
						}
						if = {
							limit = { check_variable = { damage_nuclear_reactor_temp > 0 } }
							remove_building = {
								type = nuclear_reactor
								level = damage_nuclear_reactor_temp
							}
						}
						if = {
							limit = { check_variable = { damage_nuclear_reactor_heavy_water_temp > 0 } }
							remove_building = {
								type = nuclear_reactor_heavy_water
								level = damage_nuclear_reactor_heavy_water_temp
							}
						}
						if = {
							limit = { check_variable = { damage_commercial_nuclear_reactor_temp > 0 } }
							remove_building = {
								type = commercial_nuclear_reactor
								level = damage_commercial_nuclear_reactor_temp
							}
						}
					}
				}

				PREV = {
					launch_nuke = {
						state = PREV.THIS
						use_nuke = no
						nuke_type = thermonuclear_bomb
					}
				}
			}

			random_state = {
				limit = { controller = { has_war_with = ROOT } is_fully_controlled_by = controller }

				controller = {
					orbital_bombardment_effect = yes
				}

				if = {
					limit = { NOT = { is_core_of = ROOT } }

					PREV.PREV = {
						if = {
							limit = {
								check_variable = { state_population_k > 10000 }
							}
							set_temp_variable = { local_pop = -2000000 }
						}
						else = {
							set_temp_variable = { local_pop = state_population_k }
							multiply_temp_variable = { local_pop = -100 }
						}
						add_manpower = local_pop
						add_dynamic_modifier = {
							modifier = irradiated
						}
						add_dynamic_modifier = {
							modifier = ruined_district
						}

						set_temp_variable = { damage_industrial_complex_temp = damaged_building_level@industrial_complex }
						set_temp_variable = { damage_arms_factory_temp = damaged_building_level@arms_factory }
						set_temp_variable = { damage_dockyard_temp = damaged_building_level@dockyard }
						set_temp_variable = { damage_stronghold_network_temp = damaged_building_level@stronghold_network }
						set_temp_variable = { damage_synthetic_refinery_temp = damaged_building_level@synthetic_refinery }
						set_temp_variable = { damage_fuel_silo_temp = damaged_building_level@fuel_silo }
						set_temp_variable = { damage_mega_gun_emplacement_temp = damaged_building_level@mega_gun_emplacement }
						set_temp_variable = { damage_rocket_site_temp = damaged_building_level@rocket_site }
						set_temp_variable = { damage_nuclear_reactor_temp = damaged_building_level@nuclear_reactor }
						set_temp_variable = { damage_nuclear_reactor_heavy_water_temp = damaged_building_level@nuclear_reactor_heavy_water }
						set_temp_variable = { damage_commercial_nuclear_reactor_temp = damaged_building_level@commercial_nuclear_reactor }
						if = {
							limit = { check_variable = { damage_dockyard_temp > 0 } }
							remove_building = {
								type = dockyard
								level = damage_dockyard_temp
							}
						}
						if = {
							limit = { check_variable = { damage_arms_factory_temp > 0 } }
							remove_building = {
								type = arms_factory
								level = damage_arms_factory_temp
							}
						}
						if = {
							limit = { check_variable = { damage_industrial_complex_temp > 0 } }
							remove_building = {
								type = industrial_complex
								level = damage_industrial_complex_temp
							}
						}
						if = {
							limit = { check_variable = { damage_stronghold_network_temp > 0 } }
							remove_building = {
								type = stronghold_network
								level = damage_stronghold_network_temp
							}
						}
						if = {
							limit = { check_variable = { damage_synthetic_refinery_temp > 0 } }
							remove_building = {
								type = synthetic_refinery
								level = damage_synthetic_refinery_temp
							}
						}
						if = {
							limit = { check_variable = { damage_fuel_silo_temp > 0 } }
							remove_building = {
								type = fuel_silo
								level = damage_fuel_silo_temp
							}
						}
						if = {
							limit = { check_variable = { damage_mega_gun_emplacement_temp > 0 } }
							remove_building = {
								type = mega_gun_emplacement
								level = damage_mega_gun_emplacement_temp
							}
						}
						if = {
							limit = { check_variable = { damage_nuclear_reactor_temp > 0 } }
							remove_building = {
								type = nuclear_reactor
								level = damage_nuclear_reactor_temp
							}
						}
						if = {
							limit = { check_variable = { damage_nuclear_reactor_heavy_water_temp > 0 } }
							remove_building = {
								type = nuclear_reactor_heavy_water
								level = damage_nuclear_reactor_heavy_water_temp
							}
						}
						if = {
							limit = { check_variable = { damage_commercial_nuclear_reactor_temp > 0 } }
							remove_building = {
								type = commercial_nuclear_reactor
								level = damage_commercial_nuclear_reactor_temp
							}
						}
					}
				}

				PREV = {
					launch_nuke = {
						state = PREV.THIS
						use_nuke = no
						nuke_type = thermonuclear_bomb
					}
				}
			}

			random_state = {
				limit = { controller = { has_war_with = ROOT } is_fully_controlled_by = controller }

				controller = {
					orbital_bombardment_effect = yes
				}

				if = {
					limit = { NOT = { is_core_of = ROOT } }

					PREV.PREV = {
						if = {
							limit = {
								check_variable = { state_population_k > 10000 }
							}
							set_temp_variable = { local_pop = -2000000 }
						}
						else = {
							set_temp_variable = { local_pop = state_population_k }
							multiply_temp_variable = { local_pop = -100 }
						}
						add_manpower = local_pop
						add_dynamic_modifier = {
							modifier = irradiated
						}
						add_dynamic_modifier = {
							modifier = ruined_district
						}

						set_temp_variable = { damage_industrial_complex_temp = damaged_building_level@industrial_complex }
						set_temp_variable = { damage_arms_factory_temp = damaged_building_level@arms_factory }
						set_temp_variable = { damage_dockyard_temp = damaged_building_level@dockyard }
						set_temp_variable = { damage_stronghold_network_temp = damaged_building_level@stronghold_network }
						set_temp_variable = { damage_synthetic_refinery_temp = damaged_building_level@synthetic_refinery }
						set_temp_variable = { damage_fuel_silo_temp = damaged_building_level@fuel_silo }
						set_temp_variable = { damage_mega_gun_emplacement_temp = damaged_building_level@mega_gun_emplacement }
						set_temp_variable = { damage_rocket_site_temp = damaged_building_level@rocket_site }
						set_temp_variable = { damage_nuclear_reactor_temp = damaged_building_level@nuclear_reactor }
						set_temp_variable = { damage_nuclear_reactor_heavy_water_temp = damaged_building_level@nuclear_reactor_heavy_water }
						set_temp_variable = { damage_commercial_nuclear_reactor_temp = damaged_building_level@commercial_nuclear_reactor }
						if = {
							limit = { check_variable = { damage_dockyard_temp > 0 } }
							remove_building = {
								type = dockyard
								level = damage_dockyard_temp
							}
						}
						if = {
							limit = { check_variable = { damage_arms_factory_temp > 0 } }
							remove_building = {
								type = arms_factory
								level = damage_arms_factory_temp
							}
						}
						if = {
							limit = { check_variable = { damage_industrial_complex_temp > 0 } }
							remove_building = {
								type = industrial_complex
								level = damage_industrial_complex_temp
							}
						}
						if = {
							limit = { check_variable = { damage_stronghold_network_temp > 0 } }
							remove_building = {
								type = stronghold_network
								level = damage_stronghold_network_temp
							}
						}
						if = {
							limit = { check_variable = { damage_synthetic_refinery_temp > 0 } }
							remove_building = {
								type = synthetic_refinery
								level = damage_synthetic_refinery_temp
							}
						}
						if = {
							limit = { check_variable = { damage_fuel_silo_temp > 0 } }
							remove_building = {
								type = fuel_silo
								level = damage_fuel_silo_temp
							}
						}
						if = {
							limit = { check_variable = { damage_mega_gun_emplacement_temp > 0 } }
							remove_building = {
								type = mega_gun_emplacement
								level = damage_mega_gun_emplacement_temp
							}
						}
						if = {
							limit = { check_variable = { damage_nuclear_reactor_temp > 0 } }
							remove_building = {
								type = nuclear_reactor
								level = damage_nuclear_reactor_temp
							}
						}
						if = {
							limit = { check_variable = { damage_nuclear_reactor_heavy_water_temp > 0 } }
							remove_building = {
								type = nuclear_reactor_heavy_water
								level = damage_nuclear_reactor_heavy_water_temp
							}
						}
						if = {
							limit = { check_variable = { damage_commercial_nuclear_reactor_temp > 0 } }
							remove_building = {
								type = commercial_nuclear_reactor
								level = damage_commercial_nuclear_reactor_temp
							}
						}
					}
				}

				PREV = {
					launch_nuke = {
						state = PREV.THIS
						use_nuke = no
						nuke_type = thermonuclear_bomb
					}
				}

			}

			random_state = {
				limit = { controller = { has_war_with = ROOT } is_fully_controlled_by = controller }

				controller = {
					orbital_bombardment_effect = yes
				}

				if = {
					limit = { NOT = { is_core_of = ROOT } }

					PREV.PREV = {
						if = {
							limit = {
								check_variable = { state_population_k > 10000 }
							}
							set_temp_variable = { local_pop = -2000000 }
						}
						else = {
							set_temp_variable = { local_pop = state_population_k }
							multiply_temp_variable = { local_pop = -100 }
						}
						add_manpower = local_pop
						add_dynamic_modifier = {
							modifier = irradiated
						}
						add_dynamic_modifier = {
							modifier = ruined_district
						}

						set_temp_variable = { damage_industrial_complex_temp = damaged_building_level@industrial_complex }
						set_temp_variable = { damage_arms_factory_temp = damaged_building_level@arms_factory }
						set_temp_variable = { damage_dockyard_temp = damaged_building_level@dockyard }
						set_temp_variable = { damage_stronghold_network_temp = damaged_building_level@stronghold_network }
						set_temp_variable = { damage_synthetic_refinery_temp = damaged_building_level@synthetic_refinery }
						set_temp_variable = { damage_fuel_silo_temp = damaged_building_level@fuel_silo }
						set_temp_variable = { damage_mega_gun_emplacement_temp = damaged_building_level@mega_gun_emplacement }
						set_temp_variable = { damage_rocket_site_temp = damaged_building_level@rocket_site }
						set_temp_variable = { damage_nuclear_reactor_temp = damaged_building_level@nuclear_reactor }
						set_temp_variable = { damage_nuclear_reactor_heavy_water_temp = damaged_building_level@nuclear_reactor_heavy_water }
						set_temp_variable = { damage_commercial_nuclear_reactor_temp = damaged_building_level@commercial_nuclear_reactor }
						if = {
							limit = { check_variable = { damage_dockyard_temp > 0 } }
							remove_building = {
								type = dockyard
								level = damage_dockyard_temp
							}
						}
						if = {
							limit = { check_variable = { damage_arms_factory_temp > 0 } }
							remove_building = {
								type = arms_factory
								level = damage_arms_factory_temp
							}
						}
						if = {
							limit = { check_variable = { damage_industrial_complex_temp > 0 } }
							remove_building = {
								type = industrial_complex
								level = damage_industrial_complex_temp
							}
						}
						if = {
							limit = { check_variable = { damage_stronghold_network_temp > 0 } }
							remove_building = {
								type = stronghold_network
								level = damage_stronghold_network_temp
							}
						}
						if = {
							limit = { check_variable = { damage_synthetic_refinery_temp > 0 } }
							remove_building = {
								type = synthetic_refinery
								level = damage_synthetic_refinery_temp
							}
						}
						if = {
							limit = { check_variable = { damage_fuel_silo_temp > 0 } }
							remove_building = {
								type = fuel_silo
								level = damage_fuel_silo_temp
							}
						}
						if = {
							limit = { check_variable = { damage_mega_gun_emplacement_temp > 0 } }
							remove_building = {
								type = mega_gun_emplacement
								level = damage_mega_gun_emplacement_temp
							}
						}
						if = {
							limit = { check_variable = { damage_nuclear_reactor_temp > 0 } }
							remove_building = {
								type = nuclear_reactor
								level = damage_nuclear_reactor_temp
							}
						}
						if = {
							limit = { check_variable = { damage_nuclear_reactor_heavy_water_temp > 0 } }
							remove_building = {
								type = nuclear_reactor_heavy_water
								level = damage_nuclear_reactor_heavy_water_temp
							}
						}
						if = {
							limit = { check_variable = { damage_commercial_nuclear_reactor_temp > 0 } }
							remove_building = {
								type = commercial_nuclear_reactor
								level = damage_commercial_nuclear_reactor_temp
							}
						}
					}
				}

				PREV = {
					launch_nuke = {
						state = PREV.THIS
						use_nuke = no
						nuke_type = thermonuclear_bomb
					}
				}
			}

			country_event = {
				id = stt.100
				hours = 4
				random_hours = 4
			}
		}

		else_if = {
			limit = { check_variable = { global.bombardment_intensity = 4 } has_country_flag = has_target_TAG }

			var:target_TAG_var = {

				random_controlled_state = {
					limit = { is_fully_controlled_by = controller controller = { has_war_with = ROOT } }
					controller = {
						orbital_bombardment_effect = yes
					}

					if = {
						limit = { NOT = { is_core_of = ROOT } }

						PREV.PREV = {
							if = {
								limit = {
									check_variable = { state_population_k > 10000 }
								}
								set_temp_variable = { local_pop = -2000000 }
							}
							else = {
								set_temp_variable = { local_pop = state_population_k }
								multiply_temp_variable = { local_pop = -100 }
							}
							add_manpower = local_pop
							add_dynamic_modifier = {
								modifier = irradiated
							}
							add_dynamic_modifier = {
								modifier = ruined_district
							}

							set_temp_variable = { damage_industrial_complex_temp = damaged_building_level@industrial_complex }
							set_temp_variable = { damage_arms_factory_temp = damaged_building_level@arms_factory }
							set_temp_variable = { damage_dockyard_temp = damaged_building_level@dockyard }
							set_temp_variable = { damage_stronghold_network_temp = damaged_building_level@stronghold_network }
							set_temp_variable = { damage_synthetic_refinery_temp = damaged_building_level@synthetic_refinery }
							set_temp_variable = { damage_fuel_silo_temp = damaged_building_level@fuel_silo }
							set_temp_variable = { damage_mega_gun_emplacement_temp = damaged_building_level@mega_gun_emplacement }
							set_temp_variable = { damage_rocket_site_temp = damaged_building_level@rocket_site }
							set_temp_variable = { damage_nuclear_reactor_temp = damaged_building_level@nuclear_reactor }
							set_temp_variable = { damage_nuclear_reactor_heavy_water_temp = damaged_building_level@nuclear_reactor_heavy_water }
							set_temp_variable = { damage_commercial_nuclear_reactor_temp = damaged_building_level@commercial_nuclear_reactor }
							if = {
								limit = { check_variable = { damage_dockyard_temp > 0 } }
								remove_building = {
									type = dockyard
									level = damage_dockyard_temp
								}
							}
							if = {
								limit = { check_variable = { damage_arms_factory_temp > 0 } }
								remove_building = {
									type = arms_factory
									level = damage_arms_factory_temp
								}
							}
							if = {
								limit = { check_variable = { damage_industrial_complex_temp > 0 } }
								remove_building = {
									type = industrial_complex
									level = damage_industrial_complex_temp
								}
							}
							if = {
								limit = { check_variable = { damage_stronghold_network_temp > 0 } }
								remove_building = {
									type = stronghold_network
									level = damage_stronghold_network_temp
								}
							}
							if = {
								limit = { check_variable = { damage_synthetic_refinery_temp > 0 } }
								remove_building = {
									type = synthetic_refinery
									level = damage_synthetic_refinery_temp
								}
							}
							if = {
								limit = { check_variable = { damage_fuel_silo_temp > 0 } }
								remove_building = {
									type = fuel_silo
									level = damage_fuel_silo_temp
								}
							}
							if = {
								limit = { check_variable = { damage_mega_gun_emplacement_temp > 0 } }
								remove_building = {
									type = mega_gun_emplacement
									level = damage_mega_gun_emplacement_temp
								}
							}
							if = {
								limit = { check_variable = { damage_nuclear_reactor_temp > 0 } }
								remove_building = {
									type = nuclear_reactor
									level = damage_nuclear_reactor_temp
								}
							}
							if = {
								limit = { check_variable = { damage_nuclear_reactor_heavy_water_temp > 0 } }
								remove_building = {
									type = nuclear_reactor_heavy_water
									level = damage_nuclear_reactor_heavy_water_temp
								}
							}
							if = {
								limit = { check_variable = { damage_commercial_nuclear_reactor_temp > 0 } }
								remove_building = {
									type = commercial_nuclear_reactor
									level = damage_commercial_nuclear_reactor_temp
								}
							}
						}
					}

					PREV = {
						launch_nuke = {
							state = PREV.THIS
							use_nuke = no
							nuke_type = thermonuclear_bomb
						}
					}
				}

				random_controlled_state = {
					limit = { is_fully_controlled_by = controller controller = { has_war_with = ROOT } }
					controller = {
						orbital_bombardment_effect = yes
					}

					if = {
						limit = { NOT = { is_core_of = ROOT } }

						PREV.PREV = {
							if = {
								limit = {
									check_variable = { state_population_k > 10000 }
								}
								set_temp_variable = { local_pop = -2000000 }
							}
							else = {
								set_temp_variable = { local_pop = state_population_k }
								multiply_temp_variable = { local_pop = -100 }
							}
							add_manpower = local_pop
							add_dynamic_modifier = {
								modifier = irradiated
							}
							add_dynamic_modifier = {
								modifier = ruined_district
							}

							set_temp_variable = { damage_industrial_complex_temp = damaged_building_level@industrial_complex }
							set_temp_variable = { damage_arms_factory_temp = damaged_building_level@arms_factory }
							set_temp_variable = { damage_dockyard_temp = damaged_building_level@dockyard }
							set_temp_variable = { damage_stronghold_network_temp = damaged_building_level@stronghold_network }
							set_temp_variable = { damage_synthetic_refinery_temp = damaged_building_level@synthetic_refinery }
							set_temp_variable = { damage_fuel_silo_temp = damaged_building_level@fuel_silo }
							set_temp_variable = { damage_mega_gun_emplacement_temp = damaged_building_level@mega_gun_emplacement }
							set_temp_variable = { damage_rocket_site_temp = damaged_building_level@rocket_site }
							set_temp_variable = { damage_nuclear_reactor_temp = damaged_building_level@nuclear_reactor }
							set_temp_variable = { damage_nuclear_reactor_heavy_water_temp = damaged_building_level@nuclear_reactor_heavy_water }
							set_temp_variable = { damage_commercial_nuclear_reactor_temp = damaged_building_level@commercial_nuclear_reactor }
							if = {
								limit = { check_variable = { damage_dockyard_temp > 0 } }
								remove_building = {
									type = dockyard
									level = damage_dockyard_temp
								}
							}
							if = {
								limit = { check_variable = { damage_arms_factory_temp > 0 } }
								remove_building = {
									type = arms_factory
									level = damage_arms_factory_temp
								}
							}
							if = {
								limit = { check_variable = { damage_industrial_complex_temp > 0 } }
								remove_building = {
									type = industrial_complex
									level = damage_industrial_complex_temp
								}
							}
							if = {
								limit = { check_variable = { damage_stronghold_network_temp > 0 } }
								remove_building = {
									type = stronghold_network
									level = damage_stronghold_network_temp
								}
							}
							if = {
								limit = { check_variable = { damage_synthetic_refinery_temp > 0 } }
								remove_building = {
									type = synthetic_refinery
									level = damage_synthetic_refinery_temp
								}
							}
							if = {
								limit = { check_variable = { damage_fuel_silo_temp > 0 } }
								remove_building = {
									type = fuel_silo
									level = damage_fuel_silo_temp
								}
							}
							if = {
								limit = { check_variable = { damage_mega_gun_emplacement_temp > 0 } }
								remove_building = {
									type = mega_gun_emplacement
									level = damage_mega_gun_emplacement_temp
								}
							}
							if = {
								limit = { check_variable = { damage_nuclear_reactor_temp > 0 } }
								remove_building = {
									type = nuclear_reactor
									level = damage_nuclear_reactor_temp
								}
							}
							if = {
								limit = { check_variable = { damage_nuclear_reactor_heavy_water_temp > 0 } }
								remove_building = {
									type = nuclear_reactor_heavy_water
									level = damage_nuclear_reactor_heavy_water_temp
								}
							}
							if = {
								limit = { check_variable = { damage_commercial_nuclear_reactor_temp > 0 } }
								remove_building = {
									type = commercial_nuclear_reactor
									level = damage_commercial_nuclear_reactor_temp
								}
							}
						}
					}

					PREV = {
						launch_nuke = {
							state = PREV.THIS
							use_nuke = no
							nuke_type = thermonuclear_bomb
						}
					}
				}

				random_controlled_state = {
					limit = { is_fully_controlled_by = controller controller = { has_war_with = ROOT } }
					controller = {
						orbital_bombardment_effect = yes
					}

					if = {
						limit = { NOT = { is_core_of = ROOT } }

						PREV.PREV = {
							if = {
								limit = {
									check_variable = { state_population_k > 10000 }
								}
								set_temp_variable = { local_pop = -2000000 }
							}
							else = {
								set_temp_variable = { local_pop = state_population_k }
								multiply_temp_variable = { local_pop = -100 }
							}
							add_manpower = local_pop
							add_dynamic_modifier = {
								modifier = irradiated
							}
							add_dynamic_modifier = {
								modifier = ruined_district
							}

							set_temp_variable = { damage_industrial_complex_temp = damaged_building_level@industrial_complex }
							set_temp_variable = { damage_arms_factory_temp = damaged_building_level@arms_factory }
							set_temp_variable = { damage_dockyard_temp = damaged_building_level@dockyard }
							set_temp_variable = { damage_stronghold_network_temp = damaged_building_level@stronghold_network }
							set_temp_variable = { damage_synthetic_refinery_temp = damaged_building_level@synthetic_refinery }
							set_temp_variable = { damage_fuel_silo_temp = damaged_building_level@fuel_silo }
							set_temp_variable = { damage_mega_gun_emplacement_temp = damaged_building_level@mega_gun_emplacement }
							set_temp_variable = { damage_rocket_site_temp = damaged_building_level@rocket_site }
							set_temp_variable = { damage_nuclear_reactor_temp = damaged_building_level@nuclear_reactor }
							set_temp_variable = { damage_nuclear_reactor_heavy_water_temp = damaged_building_level@nuclear_reactor_heavy_water }
							set_temp_variable = { damage_commercial_nuclear_reactor_temp = damaged_building_level@commercial_nuclear_reactor }
							if = {
								limit = { check_variable = { damage_dockyard_temp > 0 } }
								remove_building = {
									type = dockyard
									level = damage_dockyard_temp
								}
							}
							if = {
								limit = { check_variable = { damage_arms_factory_temp > 0 } }
								remove_building = {
									type = arms_factory
									level = damage_arms_factory_temp
								}
							}
							if = {
								limit = { check_variable = { damage_industrial_complex_temp > 0 } }
								remove_building = {
									type = industrial_complex
									level = damage_industrial_complex_temp
								}
							}
							if = {
								limit = { check_variable = { damage_stronghold_network_temp > 0 } }
								remove_building = {
									type = stronghold_network
									level = damage_stronghold_network_temp
								}
							}
							if = {
								limit = { check_variable = { damage_synthetic_refinery_temp > 0 } }
								remove_building = {
									type = synthetic_refinery
									level = damage_synthetic_refinery_temp
								}
							}
							if = {
								limit = { check_variable = { damage_fuel_silo_temp > 0 } }
								remove_building = {
									type = fuel_silo
									level = damage_fuel_silo_temp
								}
							}
							if = {
								limit = { check_variable = { damage_mega_gun_emplacement_temp > 0 } }
								remove_building = {
									type = mega_gun_emplacement
									level = damage_mega_gun_emplacement_temp
								}
							}
							if = {
								limit = { check_variable = { damage_nuclear_reactor_temp > 0 } }
								remove_building = {
									type = nuclear_reactor
									level = damage_nuclear_reactor_temp
								}
							}
							if = {
								limit = { check_variable = { damage_nuclear_reactor_heavy_water_temp > 0 } }
								remove_building = {
									type = nuclear_reactor_heavy_water
									level = damage_nuclear_reactor_heavy_water_temp
								}
							}
							if = {
								limit = { check_variable = { damage_commercial_nuclear_reactor_temp > 0 } }
								remove_building = {
									type = commercial_nuclear_reactor
									level = damage_commercial_nuclear_reactor_temp
								}
							}
						}
					}

					PREV = {
						launch_nuke = {
							state = PREV.THIS
							use_nuke = no
							nuke_type = thermonuclear_bomb
						}
					}
				}

				random_controlled_state = {
					limit = { is_fully_controlled_by = controller controller = { has_war_with = ROOT } }
					controller = {
						orbital_bombardment_effect = yes
					}

					if = {
						limit = { NOT = { is_core_of = ROOT } }

						PREV.PREV = {
							if = {
								limit = {
									check_variable = { state_population_k > 10000 }
								}
								set_temp_variable = { local_pop = -2000000 }
							}
							else = {
								set_temp_variable = { local_pop = state_population_k }
								multiply_temp_variable = { local_pop = -100 }
							}
							add_manpower = local_pop
							add_dynamic_modifier = {
								modifier = irradiated
							}
							add_dynamic_modifier = {
								modifier = ruined_district
							}

							set_temp_variable = { damage_industrial_complex_temp = damaged_building_level@industrial_complex }
							set_temp_variable = { damage_arms_factory_temp = damaged_building_level@arms_factory }
							set_temp_variable = { damage_dockyard_temp = damaged_building_level@dockyard }
							set_temp_variable = { damage_stronghold_network_temp = damaged_building_level@stronghold_network }
							set_temp_variable = { damage_synthetic_refinery_temp = damaged_building_level@synthetic_refinery }
							set_temp_variable = { damage_fuel_silo_temp = damaged_building_level@fuel_silo }
							set_temp_variable = { damage_mega_gun_emplacement_temp = damaged_building_level@mega_gun_emplacement }
							set_temp_variable = { damage_rocket_site_temp = damaged_building_level@rocket_site }
							set_temp_variable = { damage_nuclear_reactor_temp = damaged_building_level@nuclear_reactor }
							set_temp_variable = { damage_nuclear_reactor_heavy_water_temp = damaged_building_level@nuclear_reactor_heavy_water }
							set_temp_variable = { damage_commercial_nuclear_reactor_temp = damaged_building_level@commercial_nuclear_reactor }
							if = {
								limit = { check_variable = { damage_dockyard_temp > 0 } }
								remove_building = {
									type = dockyard
									level = damage_dockyard_temp
								}
							}
							if = {
								limit = { check_variable = { damage_arms_factory_temp > 0 } }
								remove_building = {
									type = arms_factory
									level = damage_arms_factory_temp
								}
							}
							if = {
								limit = { check_variable = { damage_industrial_complex_temp > 0 } }
								remove_building = {
									type = industrial_complex
									level = damage_industrial_complex_temp
								}
							}
							if = {
								limit = { check_variable = { damage_stronghold_network_temp > 0 } }
								remove_building = {
									type = stronghold_network
									level = damage_stronghold_network_temp
								}
							}
							if = {
								limit = { check_variable = { damage_synthetic_refinery_temp > 0 } }
								remove_building = {
									type = synthetic_refinery
									level = damage_synthetic_refinery_temp
								}
							}
							if = {
								limit = { check_variable = { damage_fuel_silo_temp > 0 } }
								remove_building = {
									type = fuel_silo
									level = damage_fuel_silo_temp
								}
							}
							if = {
								limit = { check_variable = { damage_mega_gun_emplacement_temp > 0 } }
								remove_building = {
									type = mega_gun_emplacement
									level = damage_mega_gun_emplacement_temp
								}
							}
							if = {
								limit = { check_variable = { damage_nuclear_reactor_temp > 0 } }
								remove_building = {
									type = nuclear_reactor
									level = damage_nuclear_reactor_temp
								}
							}
							if = {
								limit = { check_variable = { damage_nuclear_reactor_heavy_water_temp > 0 } }
								remove_building = {
									type = nuclear_reactor_heavy_water
									level = damage_nuclear_reactor_heavy_water_temp
								}
							}
							if = {
								limit = { check_variable = { damage_commercial_nuclear_reactor_temp > 0 } }
								remove_building = {
									type = commercial_nuclear_reactor
									level = damage_commercial_nuclear_reactor_temp
								}
							}
						}
					}

					PREV = {
						launch_nuke = {
							state = PREV.THIS
							use_nuke = no
							nuke_type = thermonuclear_bomb
						}
					}
				}
			}

			country_event = {
				id = stt.100
				hours = 4
				random_hours = 4
			}
		}
	}
}