siberian_nationalist_independence = {
	set_temp_variable = { siberian_nationalist_country = this }
	every_core_state = {
		limit = {
			is_core_of = SOV
		}
		var:siberian_nationalist_country = { transfer_state = PREV }
	}
}

soviet_german_white_peace = {

	SOV = {

		if = {
			limit = {
				SOV_aleksandr_yegorov = {
					NOT = { has_character_flag = SOV_character_purged_flag }
				}
			}
			SOV_aleksandr_yegorov = { set_nationality = WRF }
		}

		if = {
			limit = {
				SOV_georgy_zhukov = {
					NOT = { has_character_flag = SOV_character_purged_flag }
				}
			}
			SOV_georgy_zhukov = { set_nationality = WRF }
		}

		WRF = {
			if = {
				limit = {
					has_character = SOV_aleksandr_yegorov
					SOV_aleksandr_yegorov = { can_be_country_leader = yes }
				}
				promote_character = SOV_aleksandr_yegorov
			}
			else = {
				promote_character = SOV_georgy_zhukov
			}
		}

		every_state = {
			limit = {
				is_owned_by = SOV
				NOT = {
					is_core_of = WRF
					state = 875
				}
			}
			transfer_state_to = GER
		}

		every_country = {
			limit = {
				is_in_faction_with = SOV
				SOV = { is_faction_leader = yes }
			}
			add_ideas = TRTNO_neutrality_idea
			white_peace = GER
			leave_faction = yes
		}

		white_peace = GER
		every_country = {
			limit = {
				has_war_with = SOV
			}
			white_peace = SOV
		}
	}

	FIN = {

		if = {
			limit = {
				NOT = {
					147 = { is_owned_by = PREV }
					146 = { is_owned_by = PREV }
				}
			}

			transfer_state = 147
			transfer_state = 146
		}
	}
}

collapse_the_soviet_union = {
	set_global_flag = collapse_of_ussr
			
	SOV = {

		retire_character = SOV_iosif_stalin

		if = {
			limit = {
				SOV_aleksandr_yegorov = {
					NOT = { has_character_flag = SOV_character_purged_flag }
				}
			}
			SOV_aleksandr_yegorov = {
				add_country_leader_role = {
					character = SOV_aleksandr_yegorov
					country_leader = {
						expire = "1965.1.1"
						ideology = stalinism
					}
					promote_leader = yes
				}
				promote_leader = yes
			}
		}
		else = {
			SOV_georgy_zhukov = {
				add_country_leader_role = {
					character = SOV_georgy_zhukov
					country_leader = {
						expire = "1965.1.1"
						ideology = stalinism
					}
					promote_leader = yes
				}
				promote_leader = yes
			}
		}

		WRF = {
			add_state_core = 401
			add_state_core = 251
			add_state_core = 249
			add_state_core = 833
			add_state_core = 987
			add_state_core = 975
			add_state_core = 972
			add_state_core = 880
			add_state_core = 973
			add_state_core = 262
			add_state_core = 974
			add_state_core = 397
			add_state_core = 976
			add_state_core = 400
			add_state_core = 978
			add_state_core = 977
			add_state_core = 398
			add_state_core = 988
			add_state_core = 984
			add_state_core = 651
			add_state_core = 582
			add_state_core = 652
			add_state_core = 985
			add_state_core = 399
			add_state_core = 986
			add_state_core = 999
			add_state_core = 994
			add_state_core = 995
			add_state_core = 990
			add_state_core = 989
			add_state_core = 996
			add_state_core = 997
			add_state_core = 998
			add_state_core = 1000
			add_state_core = 1004

			add_ideas = TRTNO_neutrality_idea
		}

		KAZ = {
			add_state_core = 407
			add_state_core = 406
			add_state_core = 823
			add_state_core = 584
			add_state_core = 585
			add_state_core = 742
			add_state_core = 405
			add_state_core = 732
			add_state_core = 830
			add_state_core = 831
			add_state_core = 832

			add_ideas = TRTNO_neutrality_idea
			set_cosmetic_tag = SOV_KAZ
		}

		if = {
			limit = {
				SOV_lazar_kaganovich = {
					NOT = { has_character_flag = SOV_character_purged_flag }
				}
			}
			SOV_lazar_kaganovich = { set_nationality = TYM }
		}
		TYM = {
			add_state_core = 572
			add_state_core = 573
			add_state_core = 403
			add_state_core = 653
			add_state_core = 571
			add_state_core = 581
			add_state_core = 825
			add_state_core = 580
			add_state_core = 579
			add_state_core = 577
			add_state_core = 1005
			add_state_core = 1001
			add_state_core = 1006
			add_state_core = 1007
			add_state_core = 1003
			add_state_core = 1002

			add_ideas = TRTNO_neutrality_idea
			if = {
				limit = {
					has_character = SOV_lazar_kaganovich
				}
				SOV_lazar_kaganovich = {
					add_country_leader_role = {
						character = SOV_lazar_kaganovich
						promote_leader = yes
						country_leader = {
							expire = "1953.1.1.1"
							ideology = stalinism
						}
					}
				}
				set_country_leader_portrait = {
					ideology = communism
					portrait = GFX_portrait_TYM_lazar_kaganovich
				}
			}
		}

		TOM = {
			add_state_core = 654
			add_state_core = 40
			add_state_core = 570
			add_state_core = 569
			add_state_core = 568
			add_state_core = 578
			add_state_core = 576
			add_state_core = 878
			add_state_core = 516
			add_state_core = 824
			add_state_core = 1008
			add_state_core = 1013
			add_state_core = 1012
			add_state_core = 1011
			add_state_core = 1010
			add_state_core = 1009

			if = {
				limit = {
					NOT = {
						TAN = { owns_state = 329 }
					}
				}
				add_state_core = 329
			}
			add_ideas = TRTNO_neutrality_idea
		}
		
		if = {
			limit = {
				SOV_genrikh_yagoda = {
					NOT = { has_character_flag = SOV_character_purged_flag }
				}
			}
			SOV_genrikh_yagoda = { set_nationality = FAR }
		}
		FAR = {
			add_state_core = 1026
			add_state_core = 1014
			add_state_core = 408
			add_state_core = 409
			add_state_core = 560
			add_state_core = 657
			add_state_core = 561
			add_state_core = 563
			add_state_core = 565
			add_state_core = 564
			add_state_core = 566
			add_state_core = 567
			add_state_core = 575
			add_state_core = 574
			add_state_core = 575
			add_state_core = 562
			add_state_core = 874
			add_state_core = 637
			add_state_core = 822
			add_state_core = 644
			add_state_core = 575
			add_state_core = 877
			add_state_core = 876
			add_state_core = 655
			add_state_core = 1015

			add_ideas = TRTNO_neutrality_idea
			if = {
				limit = {
					has_character = SOV_genrikh_yagoda
				}
				FAR = { set_cosmetic_tag = FAR_IRK }
				SOV_genrikh_yagoda = {
					add_country_leader_role = {
						character = SOV_genrikh_yagoda
						promote_leader = yes
						country_leader = {
							expire = "1965.1.1.1"
							ideology = leninism
						}
					}
				}
				set_country_leader_portrait = {
					ideology = communism
					portrait = GFX_portrait_SOV_genrikh_yagoda
				}
			}
		}
	}
}