
##################
#
# Utopia Events
#
##################

#ID 1 - 1999#

namespace = utopia

#Diplomatic Event: A neighbor is building a ring world#
country_event = {
id = utopia.1
	title = "utopia.1.name"
	desc = {
		trigger = {
			switch = {
				trigger = has_ethic
				ethic_fanatic_xenophobe = { text = utopia.1.desc.v1 }
				ethic_fanatic_xenophile = { text = utopia.1.desc.v2 }
				ethic_fanatic_materialist = { text = utopia.1.desc.v2 }
				ethic_fanatic_spiritualist = { text = utopia.1.desc.v4 }
				ethic_fanatic_authoritarian = { text = utopia.1.desc.v1 }
				ethic_fanatic_egalitarian = { text = utopia.1.desc.v2 }
				ethic_fanatic_militarist = { text = utopia.1.desc.v1 }
				ethic_fanatic_pacifist = { text = utopia.1.desc.v2 }
			}
		}
	}
	picture = GFX_evt_ringworld
	show_sound = event_conversation
	location = event_target:ring_world.capital_scope

	trigger = {
		is_country_type = default
		AND = {
			any_neighbor_country = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = ring_world_1
						is_megastructure_type = ring_world_2
					}
					is_upgrading = yes
				}
				is_country_type = default
				has_communications = root
				NOR = {
					has_country_flag = ringworld_diplomatic_event
					is_at_war_with = ROOT
					is_subject = yes
					is_same_value = root
				}
			}
			is_fanatic = yes

			NOR = {
				has_country_flag = ringworld_diplomatic_event
				is_homicidal = yes
			}
		}
	}
	mean_time_to_happen = { days = 3600 }

	immediate = {
		random_neighbor_country = {
			limit = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = ring_world_1
						is_megastructure_type = ring_world_2
					}
					is_upgrading = yes
				}
				NOR = {
					has_country_flag = ringworld_diplomatic_event
					is_at_war_with = ROOT
					is_subject = yes
					is_same_value = root
				}
				is_country_type = default
				has_communications = root
			}
			random_owned_megastructure = {
				limit = {
					OR = {
						is_megastructure_type = ring_world_1
						is_megastructure_type = ring_world_2
					}
					is_upgrading = yes
				}
			save_event_target_as = ring_world
			}
			save_event_target_as = ringworld_builder
			event_target:ringworld_builder = {
				set_country_flag = ringworld_diplomatic_event
			}
		}
		set_country_flag = ringworld_diplomatic_event
	}

	option = {
		name = utopia.1.a
		ai_chance = {
			factor = 90
		}
		event_target:ringworld_builder = { country_event = { id = utopia.2 days = 5 } }
	}

	option = {
		name = utopia.1.b
		ai_chance = {
			factor = 10
		}

		add_modifier = {
			modifier = megastructure_demands_rejected
			days = 7200
		}
	}
}

country_event = {
	id = utopia.2
	title = "utopia.2.name"
	desc = {
		trigger = {
			hidden:from = {
				switch = {
					trigger = has_ethic
					ethic_fanatic_xenophobe = { text = utopia.2.desc.v1 }
					ethic_fanatic_xenophile = { text = utopia.2.desc.v2 }
					ethic_fanatic_materialist = { text = utopia.2.desc.v2 }
					ethic_fanatic_spiritualist = { text = utopia.2.desc.v4 }
					ethic_fanatic_authoritarian = { text = utopia.2.desc.v1 }
					ethic_fanatic_egalitarian = { text = utopia.2.desc.v2 }
					ethic_fanatic_militarist = { text = utopia.2.desc.v1 }
					ethic_fanatic_pacifist = { text = utopia.2.desc.v2 }
					ethic_gestalt_consciousness = { text = utopia.2.desc.v2 }
				}
			}
		}
	}

	picture = GFX_evt_ringworld
	show_sound = event_conversation
	location = from.capital_scope

	is_triggered_only = yes

# Halts the ring world construction
	option = {
		name = utopia.2.a
		custom_tooltip = utopia.2.a.tooltip
		trigger = {
			from = {
				is_fanatic_xenophile = no
				is_fanatic_materialist = no
				is_fanatic_pacifist = no
				is_fanatic_egalitarian = no
			}
		}
		ai_chance = {
			factor = 10
		}
		hidden_effect = {
			from = { country_event = { id = utopia.3 days = 5 } }
			from = { country_event = { id = utopia.5 days = 20 } }
		}
		from = { add_opinion_modifier = { who = root modifier = opinion_ringworld_terms_accepted } }

		every_owned_megastructure = {
			limit = {
				OR = {
					is_megastructure_type = ring_world_1
					is_megastructure_type = ring_world_2
				}
				is_upgrading = yes
			}
			set_halted = 20
		}
		hidden_effect = { country_event = { id = utopia.6 days = 20 } }
	}

	option = {
		name = utopia.2.c
		trigger = {
			from = {
				OR = {
					is_fanatic_xenophile = yes
					is_fanatic_materialist = yes
					is_fanatic_pacifist = yes
					is_fanatic_egalitarian = yes
				}
			}
		}

		ai_chance = {
			factor = 10
		}
		hidden_effect = {
			from = { country_event = { id = utopia.3 days = 5 } }
			from = { country_event = { id = utopia.5 days = 20 } }
			country_event = { id = utopia.6 days = 20 }
		}
		from = { add_opinion_modifier = { who = root modifier = opinion_ringworld_terms_accepted } }
	}

	option = {
		name = utopia.2.b
		custom_tooltip = utopia.2.b.tooltip
		default_hide_option = yes
		ai_chance = {
			factor = 90
			modifier = {
				factor = 0
				OR = {
					#is_country_type = default
					is_friendly_to = from
					is_cordial_to = from
					is_protective_to = from
					is_loyal_to = from
					relative_power = {
						who = from
						category = all
					value = pathetic
					}
					relative_power = {
						who = from
						category = all
					value = inferior
					}
				}
			}
		}
		hidden_effect = {
			from = { country_event = { id = utopia.4 days = 5 } }
		}
		from = { add_opinion_modifier = { who = root modifier = opinion_ringworld_terms_denied }}
	}
}

country_event = {
	id = utopia.3
	title = "utopia.3.name"
	desc = {
		trigger = {
			switch = {
				trigger = has_ethic
				ethic_fanatic_xenophobe = { text = utopia.3.desc.v1 }
				ethic_fanatic_xenophile = { text = utopia.3.desc.v2 }
				ethic_fanatic_materialist = { text = utopia.3.desc.v2 }
				ethic_fanatic_spiritualist = { text = utopia.3.desc.v4 }
				ethic_fanatic_authoritarian = { text = utopia.3.desc.v1 }
				ethic_fanatic_egalitarian = { text = utopia.3.desc.v2 }
				ethic_fanatic_militarist = { text = utopia.3.desc.v1 }
				ethic_fanatic_pacifist = { text = utopia.3.desc.v2 }
			}
		}
	}
	picture = GFX_evt_ringworld
	show_sound = event_conversation
	location = event_target:ring_world

	is_triggered_only = yes

	option = {
		name = utopia.3.a
		#custom_tooltip = utopia.3.a.tooltip
		tooltip = {
			from = {
			add_opinion_modifier = { who = root modifier = opinion_ringworld_terms_accepted }
			}
		}
	}
}

country_event = {
	id = utopia.4
	title = "utopia.4.name"
	desc = "utopia.4.desc"
	picture = GFX_evt_ringworld
	show_sound = event_conversation
	location = event_target:ring_world

	is_triggered_only = yes

	option = {
		name = utopia.4.a
		tooltip = {
			from = {
			add_opinion_modifier = { who = root modifier = opinion_ringworld_terms_denied }
			}
		}
	}
}

# Ringworld project commencing: ringworld builder neighbor
country_event = {
	id = utopia.5
	title = "utopia.5.name"
	desc = {
		trigger = {
			switch = {
				trigger = has_ethic
				ethic_fanatic_xenophobe = { text = utopia.5.desc.v1 }
				ethic_fanatic_xenophile = { text = utopia.5.desc.v2 }
				ethic_fanatic_materialist = { text = utopia.5.desc.v2 }
				ethic_fanatic_spiritualist = { text = utopia.5.desc.v4 }
				ethic_fanatic_authoritarian = { text = utopia.5.desc.v1 }
				ethic_fanatic_egalitarian = { text = utopia.5.desc.v2 }
				ethic_fanatic_militarist = { text = utopia.5.desc.v1 }
				ethic_fanatic_pacifist = { text = utopia.5.desc.v2 }
			}
		}
	}
	picture = GFX_evt_ringworld
	show_sound = event_conversation
	location = event_target:ring_world

	is_triggered_only = yes

	option = {
		name = OK
		trigger = {
			is_fanatic_xenophile = no
			is_fanatic_materialist = no
			is_fanatic_pacifist = no
			is_fanatic_egalitarian = no
		}
		#custom_tooltip = utopia.3.a.tooltip
	}
# gives a science reward to those with the appropriate ethics
	option = {
		name = utopia.5.b
		trigger = {
			OR = {
				is_fanatic_xenophile = yes
				is_fanatic_materialist = yes
				is_fanatic_pacifist = yes
				is_fanatic_egalitarian = yes
			}
		}
		add_monthly_resource_mult = {
			resource = engineering_research
			value = @tier2researchreward
			min = @tier2researchmin
			max = @tier2researchmax
		}
	}
}

# Mission complete
country_event = {
	id = utopia.6
	title = "utopia.6.name"
	desc = {
		trigger = {
			hidden:fromfrom = {
				switch = {
					trigger = has_ethic
					ethic_fanatic_xenophobe = { text = utopia.6.desc.v1 }
					ethic_fanatic_xenophile = { text = utopia.6.desc.v2 }
					ethic_fanatic_materialist = { text = utopia.6.desc.v2 }
					ethic_fanatic_spiritualist = { text = utopia.6.desc.v4 }
					ethic_fanatic_authoritarian = { text = utopia.6.desc.v1 }
					ethic_fanatic_egalitarian = { text = utopia.6.desc.v2 }
					ethic_fanatic_militarist = { text = utopia.6.desc.v1 }
					ethic_fanatic_pacifist = { text = utopia.6.desc.v2 }
				}
			}
		}
	}
	picture = GFX_evt_ringworld
	show_sound = event_conversation
	location = event_target:ring_world

	is_triggered_only = yes

	option = {
		name = OK
		trigger = {
			fromfrom = {
				is_fanatic_xenophile = no
				is_fanatic_materialist = no
				is_fanatic_pacifist = no
				is_fanatic_egalitarian = no
			}
		}
	}

	option = {
		name = utopia.5.b
		trigger = {
			fromfrom = {
				OR = {
					is_fanatic_xenophile = yes
					is_fanatic_materialist = yes
					is_fanatic_pacifist = yes
					is_fanatic_egalitarian = yes
				}
			}
		}

		from = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier2researchreward
				min = @tier2researchmin
				max = @tier2researchmax
			}
		}
	}
}

##Ring World Incident Events
country_event = {
	id = utopia.20
	hide_window = yes

	mean_time_to_happen = { days = 3600 }

	trigger = {
		NOT = { has_country_flag = event_utopia_20 }
		any_owned_megastructure = {
			is_megastructure_type = ring_world_2
			is_upgrading = yes
			upgrade_days_left > 200
		}
	}

	immediate = {
		random_owned_megastructure = {
			limit = {
				is_megastructure_type = ring_world_2
				is_upgrading = yes
			}
			save_event_target_as = ring_world
		}
		set_country_flag = event_utopia_20
		random_list = {
			30 = {
				country_event = { id = utopia.21 }
			}
			30 = {
				country_event = { id = utopia.22 }
			}
			30 = {
				modifier = {
					factor = 0
					OR = {
						is_machine_empire = yes
						owner_species = { has_trait = trait_mechanical }
					}
				}
				country_event = { id = utopia.27 }
			}
		}
	}
}

# Boosting the build speed
country_event = {
	id = utopia.21
	title = "utopia.21.name"
	desc = "utopia.21.desc"
	picture = GFX_evt_ringworld
	show_sound = event_construction
	location = event_target:ring_world

	is_triggered_only = yes

	immediate = {
		event_target:ring_world = {
			add_modifier = {
				modifier = "ms_build_speed_mult"
				days = -1
			}
		}
	}
	option = {
		tooltip = {
			add_modifier = {
				modifier = "ms_build_speed_mult"
				days = -1
			}
		}
		name = OK
	}
}

# Halt construction for mineral reward
country_event = {
	id = utopia.22
	title = "utopia.22.name"
	desc = "utopia.22.desc"
	picture = GFX_evt_ringworld
	show_sound = event_construction
	location = event_target:ring_world

	is_triggered_only = yes

	option = {
		name = utopia.22.a
		allow = {
			any_owned_megastructure = {
				is_megastructure_type = ring_world_2
				is_upgrading = yes
			}
		}
		event_target:ring_world = {
			set_halted = 20
			add_modifier = {
				modifier = "ring_world_halted"
			}
		}
		add_resource = { minerals = 500 }
	}

	option = {
		name = utopia.22.b
	}
}


# Halting construction to deal with original inhabitants


country_event = {
	id = utopia.27
	title = "utopia.27.name"
	desc = "utopia.27.desc"
	picture = GFX_evt_ringworld
	show_sound = event_construction
	location = event_target:ring_world

	is_triggered_only = yes

	immediate = {
		event_target:ring_world = {
			add_modifier = {
				modifier = "lower_build_speed_mult"
				days = 30
			}
		}
	}

	option = {
		name = utopia.27.a
		tooltip = {
			add_modifier = {
				modifier = "lower_build_speed_mult"
				days = 30
			}
		}
		country_event = { id = utopia.28 days = 30 } #same as number of days delayed
	}
}

country_event = {
	id = utopia.28
	title = "utopia.28.name"
	desc = "utopia.28.desc"
	picture = GFX_evt_ringworld
	show_sound = event_construction
	location = event_target:ring_world

	is_triggered_only = yes

	option = {
		name = utopia.28.a
		country_event = { id = utopia.23 days = 20 }
	}
}


country_event = {
	id = utopia.23
	title = "utopia.23.name"
	desc = "utopia.23.desc"
	picture = GFX_evt_ringworld
	show_sound = event_construction
	location = event_target:ring_world

	is_triggered_only = yes

	option = {
		name = utopia.23.a
		event_target:ring_world = {
			set_halted = 30
			hidden_effect = {
				add_modifier = {
				modifier = "ring_world_halted"
				}
			}
		}
		country_event = { id = utopia.26 days = 30 }
	}

	option = {
		name = utopia.23.b
		country_event = { id = utopia.25 days = 30 }
	}
}

country_event = {
	id = utopia.25
	title = "utopia.25.name"
	desc = "utopia.25.desc"
	picture = GFX_evt_ringworld
	show_sound = event_construction
	location = event_target:ring_world

	is_triggered_only = yes

	immediate = {
		event_target:ring_world = {
		set_halted = 20
		}
	}

	option = {
		name = utopia.25.a
	}
}

country_event = {
	id = utopia.26
	title = "utopia.26.name"
	desc = "utopia.26.desc"
	picture = GFX_evt_ringworld
	show_sound = event_construction
	location = event_target:ring_world

	is_triggered_only = yes

	option = {
		name = utopia.26.a
	}
}


# Diplomatic Event: Dyson Sphere

country_event = {
	id = utopia.29
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		is_country_type = default
		NOR = {
			has_country_flag = dysonsphere_diplomatic_event
			is_subject = yes
		}

		FROM = {
			is_megastructure_type = dyson_sphere_0
		}

		any_neighbor_country = {
			is_country_type = default
			has_communications = root
			opinion = {
				who = ROOT
				value > -100
			}
			their_opinion = {
				who = ROOT
				value > -100
			}
			OR = {
				has_intel_level = {
					who = root
					category = economy
					level >= 1
				}
				has_intel_level = {
					who = root
					category = technology
					level >= 1
				}
			}
			NOR = {
				has_country_flag = dysonsphere_diplomatic_event
				is_at_war_with = root
				is_subject = yes
				is_overlord_to = root
				is_same_value = root
				has_global_flag = dyson_diplo_event_global
				is_gestalt = yes
				is_homicidal = yes
			}
		}
	}

	immediate = {
		fromfrom = { save_event_target_as = dyson_system }
		save_event_target_as = dysonsphere_builder
		set_country_flag = dysonsphere_diplomatic_event
		random_neighbor_country = {
			limit = {
				is_country_type = default
				has_communications = root
				opinion = {
					who = ROOT
					value > -100
				}
				their_opinion = {
					who = ROOT
					value > -100
				}
				OR = {
					has_intel_level = {
						who = root
						category = economy
						level >= 1
					}
					has_intel_level = {
						who = root
						category = technology
						level >= 1
					}
				}
				NOR = {
					has_country_flag = dysonsphere_diplomatic_event
					is_at_war_with = root
					is_subject = yes
					is_overlord_to = root
					is_same_value = root
					is_gestalt = yes
					is_homicidal = yes
				}
			}
			set_country_flag = dysonsphere_diplomatic_event
			save_event_target_as = dyson_sphere_neighbor
		}
		random_list = {
			35 = { event_target:dyson_sphere_neighbor = { country_event = { id =
			utopia.30 days = 10 random = 7 } } }
			65 = { }
		}
		set_global_flag = dyson_diplo_event_global
	}
}

country_event = {
	id = utopia.30
	title = "utopia.30.name"
	desc = "utopia.30.desc.v1"
	picture = GFX_evt_dyson_sphere
	show_sound = event_conversation
	location = event_target:dyson_sphere

	is_triggered_only = yes

# Demand apology
	option = {
		name = utopia.30.a
		ai_chance = {
			factor = 90
			modifier = {
				factor = 20
				OR = {
					#is_country_type = default
					relative_power = {
						who = event_target:dysonsphere_builder
						category = all
						value = pathetic
					}
					relative_power = {
						who = event_target:dysonsphere_builder
						category = all
						value = inferior
					}
				}
			}
		}
		event_target:dysonsphere_builder = { country_event = { id = utopia.31 days = 6 } }
	}
# Demand energy
	option = {
		name = utopia.30.b
		#custom_tooltip = utopia.30.b.tooltip

		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				OR = {
					#is_country_type = default
					relative_power = {
						who = event_target:dysonsphere_builder
						category = all
						value = pathetic
					}
					relative_power = {
						who = event_target:dysonsphere_builder
						category = all
						value = inferior
					}
				}
			}
			modifier = {
				factor = 90
				income < 0
			}
		}

		if = {
			limit = {
				is_fanatic_materialist = yes
			}
			add_modifier = {
				modifier = unity_increase_utopia_30
				days = 1800
			}
		}

		hidden_effect = { event_target:dysonsphere_builder = { country_event = { id = utopia.32 days = 1 } } }
	}
# Ignore the demands of your people.
	option = {
		name = utopia.30.c
		ai_chance = {
			factor = 10
		}
		add_modifier = {
			modifier = unity_reduction_utopia_30
			days = 1800
		}
	}
}

# Apology Request
country_event = {
	id = utopia.31
	#title = "utopia.31.name"
	desc = utopia.31.desc
	#picture = GFX_evt_dyson_sphere
	#show_sound = event_conversation
	location = from.capital_scope

	title = TRANSMISSION

	diplomatic = yes

	picture_event_data = {
		portrait = from
		room = from.ruler
	}

	is_triggered_only = yes

# Apologize
	option = {
		name = utopia.31.a

		ai_chance = {
			factor = 10
		}
		hidden_effect = {
			from = { country_event = { id = utopia.33 days = 7 } }
		}
	}
# Apologize and offer credits
	option = {
		name = utopia.31.b

		trigger = {
			resource_stockpile_compare = { resource = energy value >= 1000 }
		}

		ai_chance = {
			factor = 10
		}
		hidden_effect = {
			from = { country_event = { id = utopia.35 days = 7 } }
		}

		add_resource = { energy = -1000 }
	}
# Don't Apologize
	option = {
		name = utopia.31.c
		#custom_tooltip = utopia.2.b.tooltip
		default_hide_option = yes
		ai_chance = {
			factor = 90
			modifier = {
				factor = 0
				OR = {
					#is_country_type = default
					is_friendly_to = event_target:dyson_sphere_neighbor
					is_cordial_to = event_target:dyson_sphere_neighbor
					is_protective_to = event_target:dyson_sphere_neighbor
					is_loyal_to = event_target:dyson_sphere_neighbor
					relative_power = {
						who = event_target:dyson_sphere_neighbor
						category = all
						value = pathetic
					}
					relative_power = {
						who = event_target:dyson_sphere_neighbor
						category = all
						value = inferior
					}
				}
			}
		}
		hidden_effect = {
			from = { country_event = { id = utopia.34 days = 5 } }
		}
	}
}

# Credit Request
country_event = {
	id = utopia.32
	#title = "utopia.32.name"
	desc = "utopia.32.desc"
	#picture = GFX_evt_dyson_sphere
	#show_sound = event_conversation
	location = from.capital_scope

	is_triggered_only = yes

	title = TRANSMISSION

	diplomatic = yes

	picture_event_data = {
		portrait = from
		room = from.ruler
	}

# Give Credits
	option = {
		name = utopia.32.a

		trigger = {
			resource_stockpile_compare = { resource = energy value >= 1000 }
		}

		ai_chance = {
			factor = 5
		}
		hidden_effect = {
			from = { country_event = { id = utopia.35 days = 5 } }
		}
		add_resource = { energy = -1000 }
	}

# Apologize but don't give credits
	option = {
		name = utopia.32.b

		ai_chance = {
			factor = 15
		}

		hidden_effect = {
			from = { country_event = { id = utopia.36 days = 5 } }
		}
	}
# Refuse to apologize/give credits
	option = {
		name = utopia.32.c
		ai_chance = {
			factor = 90
			modifier = {
				factor = 0
				OR = {
					#is_country_type = default
					is_friendly_to = event_target:dyson_sphere_neighbor
					is_cordial_to = event_target:dyson_sphere_neighbor
					is_protective_to = event_target:dyson_sphere_neighbor
					is_loyal_to = event_target:dyson_sphere_neighbor
					relative_power = {
						who = event_target:dyson_sphere_neighbor
						category = all
						value = pathetic
					}
					relative_power = {
						who = event_target:dyson_sphere_neighbor
						category = all
						value = inferior
					}
				}
			}
		}
		hidden_effect = {
			from = { country_event = { id = utopia.34 days = 5 } }
		}
	}
}

# Dyson Sphere builder's apology
country_event = {
	id = utopia.33
	title = "utopia.33.name"
	desc = "utopia.33.desc"
	picture = GFX_evt_dyson_sphere
	show_sound = event_conversation
	location = from.capital_scope

	is_triggered_only = yes

	# apology accepted

	option = {
		name = utopia.33.a

		ai_chance = {
			factor = 10
		}
		hidden_effect = {
			event_target:dysonsphere_builder = { country_event = { id = utopia.38 days = 5 } }
		}
	}
# apology not accepted
	option = {
		name = utopia.33.b

		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				OR = {
					#is_country_type = default
					is_friendly_to = event_target:dysonsphere_builder
					is_cordial_to = event_target:dysonsphere_builder
					is_protective_to = event_target:dysonsphere_builder
					is_loyal_to = event_target:dysonsphere_builder
					relative_power = {
						who = event_target:dysonsphere_builder
						category = all
						value = pathetic
					}
					relative_power = {
						who = event_target:dysonsphere_builder
						category = all
						value = inferior
					}
				}
			}
		}

		add_opinion_modifier = { who = event_target:dysonsphere_builder modifier = opinion_dysonsphere_terms_denied }

		tooltip = { event_target:dysonsphere_builder = { add_opinion_modifier = { who = root modifier = opinion_dysonsphere_apology_rejected } } }

		hidden_effect = {
			event_target:dysonsphere_builder = { country_event = { id = utopia.37 days = 5 } }
		}
	}
}

# Dyson Sphere builder refuses to give money or apologize
country_event = {
	id = utopia.34
	title = "utopia.34.name"
	desc = "utopia.34.desc"
	#picture = GFX_evt_dyson_sphere
	#show_sound = event_conversation
	location = from.capital_scope

	is_triggered_only = yes

	#title = TRANSMISSION

	diplomatic = yes

	picture_event_data = {
		portrait = from
		room = from.ruler
	}


# Take the high road
	option = {
		name = utopia.34.a

		ai_chance = {
			factor = 60
		}
		add_opinion_modifier = { who = event_target:dysonsphere_builder modifier = opinion_dysonsphere_terms_denied }

		hidden_effect = {
			event_target:dysonsphere_builder = { country_event = { id = utopia.40 days = 5 } }
		}
	}
# Insult
	option = {
		name = utopia.34.b
		custom_tooltip = utopia.34.b.tooltip
		ai_chance = {
			factor = 40
			modifier = {
				factor = 0
				OR = {
					#is_country_type = default
					is_friendly_to = event_target:dysonsphere_builder
					is_cordial_to = event_target:dysonsphere_builder
					is_protective_to = event_target:dysonsphere_builder
					is_loyal_to = event_target:dysonsphere_builder
					relative_power = {
						who = event_target:dysonsphere_builder
						category = all
						value = pathetic
					}
					relative_power = {
						who = event_target:dysonsphere_builder
						category = all
						value = inferior
					}
				}
			}
		}

		add_opinion_modifier = { who = event_target:dysonsphere_builder modifier = opinion_dysonsphere_terms_denied }

		tooltip = { event_target:dysonsphere_builder = { add_opinion_modifier = { who = root modifier = opinion_dysonsphere_insult } } }

		hidden_effect = {
			event_target:dysonsphere_builder = { country_event = { id = utopia.39 days = 5 } }
		}
	}
}

# Dyson Sphere builder gives credits
country_event = {
	id = utopia.35
	title = "utopia.35.name"
	desc = "utopia.35.desc"
	picture = GFX_evt_dyson_sphere
	show_sound = event_conversation
	location = from.capital_scope

	immediate = { event_target:dyson_sphere_neighbor = {
			add_resource = { energy = 1000 }
		}
	}

	is_triggered_only = yes

# Accept the apology
	option = {
		name = utopia.35.a
		ai_chance = {
			factor = 70
		}
		hidden_effect = {
			event_target:dysonsphere_builder = { country_event = { id = utopia.38 days = 5 } }
		}
	}

# Show displeasure
	option = {
		name = utopia.35.b
		ai_chance = {
			factor = 30
			modifier = {
				factor = 0
				OR = {
					#is_country_type = default
					is_friendly_to = event_target:dysonsphere_builder
					is_cordial_to = event_target:dysonsphere_builder
					is_protective_to = event_target:dysonsphere_builder
					is_loyal_to = event_target:dysonsphere_builder
					relative_power = {
						who = event_target:dysonsphere_builder
						category = all
						value = pathetic
					}
					relative_power = {
						who = event_target:dysonsphere_builder
						category = all
						value = inferior
					}
				}
			}
		}

		add_opinion_modifier = { who = event_target:dysonsphere_builder modifier = opinion_dysonsphere_terms_denied }

		tooltip = { event_target:dysonsphere_builder = { add_opinion_modifier = { who = root modifier = opinion_dysonsphere_apology_rejected } } }

		hidden_effect = {
			event_target:dysonsphere_builder = { country_event = { id = utopia.37 days = 5 } }
		}
	}
}

# Dyson Sphere builder apologizes but doesn't give credits
country_event = {
	id = utopia.36
	title = "utopia.35.name"
	desc = "utopia.36.desc"
	picture = GFX_evt_ringworld
	show_sound = event_conversation
	location = from.capital_scope

	is_triggered_only = yes

# Accept the apology
	option = {
		name = utopia.36.a

		ai_chance = {
			factor = 10
		}
		hidden_effect = {
			event_target:dysonsphere_builder = { country_event = { id = utopia.38 days = 5 } }
		}
	}
# Show displeasure
	option = {
		name = utopia.36.b

		ai_chance = {
			factor = 90
			modifier = {
				factor = 0
				OR = {
					#is_country_type = default
					is_friendly_to = event_target:dysonsphere_builder
					is_cordial_to = event_target:dysonsphere_builder
					is_protective_to = event_target:dysonsphere_builder
					is_loyal_to = event_target:dysonsphere_builder
					relative_power = {
						who = event_target:dysonsphere_builder
						category = all
						value = pathetic
					}
					relative_power = {
						who = event_target:dysonsphere_builder
						category = all
						value = inferior
					}
				}
			}
		}
		add_opinion_modifier = { who = event_target:dysonsphere_builder modifier = opinion_dysonsphere_terms_denied }

		tooltip = { event_target:dysonsphere_builder = { add_opinion_modifier = { who = root modifier = opinion_dysonsphere_apology_rejected } } }

		hidden_effect = {
			event_target:dysonsphere_builder = { country_event = { id = utopia.37 days = 5 } }
		}
	}
}

country_event = {
	id = utopia.37
	title = "utopia.35.name"
	desc = "utopia.37.desc"
	picture = GFX_evt_dyson_sphere
	show_sound = event_conversation
	location = from.capital_scope

	is_triggered_only = yes

	immediate = {
		event_target:dysonsphere_builder = { add_opinion_modifier = { who = event_target:dyson_sphere_neighbor modifier = opinion_dysonsphere_apology_rejected } }
	}

	option = {
		name = utopia.37.a
	}

	option = {
		name = utopia.37.b
	}
}

country_event = {
	id = utopia.38
	title = "utopia.35.name"
	desc = "utopia.38.desc"
	picture = GFX_evt_dyson_sphere
	show_sound = event_conversation
	location = from.capital_scope

	is_triggered_only = yes

	option = {
		name = utopia.38.a
	}
}

country_event = {
	id = utopia.39
	#title = "utopia.35.name"
	desc = "utopia.39.desc"
	#picture = GFX_evt_dyson_sphere
	#show_sound = event_conversation
	location = from.capital_scope

	is_triggered_only = yes

	title = TRANSMISSION

	diplomatic = yes

	picture_event_data = {
		portrait = from
		room = from.ruler
	}

	immediate = {
		event_target:dysonsphere_builder = { add_opinion_modifier = { who = event_target:dyson_sphere_neighbor modifier = opinion_dysonsphere_insult } }
	}

	option = {
		name = utopia.39.a
	}

	option = {
		name = utopia.39.b
	}

	option = {
		name = utopia.39.c
	}
}

country_event = {
	id = utopia.40
	title = "utopia.35.name"
	desc = "utopia.40.desc"
	picture = GFX_evt_dyson_sphere
	show_sound = event_conversation
	location = from.capital_scope

	is_triggered_only = yes

	option = {
		name = utopia.40.a
		tooltip = {
			event_target:dyson_sphere_neighbor = { add_opinion_modifier = { who = root modifier = opinion_dysonsphere_terms_denied } }
		}
	}

	option = {
		name = utopia.40.b
		tooltip = {
			event_target:dyson_sphere_neighbor = { add_opinion_modifier = { who = root modifier = opinion_dysonsphere_terms_denied } }
		}
	}
}

# Think Tank Events

event = {
	id = utopia.50
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		any_country = {
			is_country_type = default
			any_owned_megastructure = {
				OR = {
					is_megastructure_type = think_tank_3
					is_megastructure_type = think_tank_restored
				}
			}
			NOR = {
				has_country_flag = think_tank_event
				has_ethic = ethic_gestalt_consciousness
				owner_species = { has_trait = trait_mechanical }
			}
		}
	}

	immediate = {
		random_country = {
			limit = {
				is_country_type = default
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = think_tank_3
						is_megastructure_type = think_tank_restored
					}
				}
				NOR = {
					has_country_flag = think_tank_event
					has_ethic = ethic_gestalt_consciousness
					owner_species = { has_trait = trait_mechanical }
				}
			}
			random_owned_megastructure = {
				limit = {
					OR = {
						is_megastructure_type = think_tank_3
						is_megastructure_type = think_tank_restored
					}
				}
				save_event_target_as = think_tank_2
			}
			random_list = {
				# Nothing
				90 = { }
				# Fountain of Youth
				30 = {
					country_event = { id = utopia.51 days = 60 random = 60 }
				}
				# Abducted Leader
				30 = {
					country_event = { id = utopia.62 days = 60 random = 60 }
					modifier = {
						factor = 0
						any_owned_leader = {
							leader_class = scientist
							is_leader_tier = leader_tier_default
							is_councilor = yes
							is_ruler = no
							NOR = {
								has_leader_flag = leader_death_events_blocked
							}
						}
					}
				}
				# Neural Bank
				30 = {
					country_event = { id = utopia.64 days = 60 random = 60 }
					modifier = {
						factor = 0
						NOT = {
							any_owned_leader = {
								leader_class = scientist
								is_leader_tier = leader_tier_default
								NOR = {
									has_leader_flag = leader_death_events_blocked
								}
							}
						}
					}
				}
			}
		}
	}
}

# Fountain of Youth Event Chain
country_event = {
	id = utopia.51
	title = "utopia.51.name"
	desc = "utopia.51.desc"
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = event_target:think_tank_2

	is_triggered_only = yes

	trigger = {
		any_country = {
			is_country_type = default
			has_communications = root
			species = {
				NOR = {
					has_trait = trait_mechanical
					has_trait = trait_machine_unit
				}
			}
			NOR = {
				has_country_flag = fountain_of_youth
				has_country_flag = synthetic_empire
				is_same_value = root
				has_global_flag = utopia_51
			}
			any_owned_planet = {
				controller = { is_same_value = prevprev }
			}
		}
	}

	immediate = {
		set_country_flag = think_tank_event
		set_country_flag = fountain_of_youth
		save_global_event_target_as = fountain_of_youth_country
		random_country = {
			limit = {
				is_country_type = default
				has_communications = root
				species = {
					NOR = {
						has_trait = trait_mechanical
						has_trait = trait_machine_unit
					}
				}
				NOR = {
					has_country_flag = synthetic_empire
					has_country_flag = fountain_of_youth
					is_same_value = root
					has_global_flag = utopia_51
				}

				any_owned_planet = {
					controller = { is_same_value = prevprev }
				}
			}
			save_global_event_target_as = target_country
			random_owned_planet = {
				limit = {
					controller = { is_same_value = prevprev }
				}
				save_global_event_target_as = missing_pops_planet
				solar_system = {
					save_global_event_target_as = ointment_name
				}
			}
		}
	}

	option = {
		name = utopia.51.a

		trigger = {
			resource_stockpile_compare = { resource = energy value >= 1000 }
		}

		add_resource = { energy = -1000 }
		hidden_effect = {
			set_global_flag = utopia_51
		}

		hidden_effect = { country_event = { id = utopia.54 days = 60 random = 20 } }
	}
	option = {
		name = utopia.51.b
		trigger = {
			resource_stockpile_compare = { resource = energy value >= 1000 }
		}
		hidden_effect = {
			if = {
				limit = {
					any_owned_leader = {
						leader_class = scientist
					}
				}
				country_event = { id = utopia.59 days = 60 random = 20 }
			}
			else_if = {
				limit = {
					NOT = {
						any_owned_leader = { leader_class = scientist }
					}
				}
				country_event = { id = utopia.60 days = 60 random = 20 }
			}
		}
	}

	option = {
		name = utopia.51.c
		trigger = {
			resource_stockpile_compare = { resource = energy value < 1000 }
		}
		hidden_effect = {
			if = {
				limit = {
					any_owned_leader = {
						leader_class = scientist
					}
				}
				country_event = { id = utopia.59 days = 60 random = 20 }
			}
			else_if = {
				limit = {
					NOT = {
						any_owned_leader = { leader_class = scientist }
					}
				}
				country_event = { id = utopia.60 days = 60 random = 20 }
			}
		}
	}
}

country_event = {
	id = utopia.54
	title = "utopia.54.name"
	desc = "utopia.54.desc"
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = event_target:think_tank_2

	is_triggered_only = yes


	option = {
		name = utopia.54.a
		hidden_effect = { country_event = { id = utopia.58 days = 60 random = 20 } }
	}

	option = {
		name = utopia.54.b
		trigger = {
			resource_stockpile_compare = { resource = energy value >= 500 }
		}
		add_resource = { energy = -500 }
		hidden_effect = { country_event = { id = utopia.55 days = 60 random = 20 } }
	}

	option = {
		name = utopia.54.c
		trigger = {
			resource_stockpile_compare = { resource = energy value < 500 }
		}
	}
}

country_event = {
	id = utopia.55
	title = "utopia.55.name"
	desc = "utopia.55.desc"
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = from

	is_triggered_only = yes

	option = {
		name = utopia.55.a
		hidden_effect = { country_event = { id = utopia.56 days = 10 } }
	}

	option = {
		name = utopia.55.b
		custom_tooltip = utopia.55.b.tooltip
		hidden_effect = {
			country_event = { id = utopia.57 days = 60 random = 20 }
			set_country_flag = miracle_cream
			event_target:target_country = {
				country_event = { id = utopia.100 days = 80 }
			}
		}
	}
}

country_event = {
	id = utopia.56
	title = "utopia.56.name"
	desc = "utopia.56.desc"
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = from

	is_triggered_only = yes

	option = {
		name = utopia.56.a
	}

	option = {
		name = utopia.56.b
		add_monthly_resource_mult = {
			resource = society_research
			value = @tier1researchreward
			min = @tier1researchmin
			max = @tier1researchmax
		}
	}

	option = {
		name = utopia.56.c
	}
}

country_event = {
	id = utopia.57
	title = "utopia.57.name"
	desc = "utopia.57.desc"
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = event_target:think_tank_2

	is_triggered_only = yes

	specimen = miracle_cream

	immediate = {
		add_modifier = {
			modifier = "energy_utopia_57"
			days = 1800
		}
	}

	option = {
		name = utopia.57.a
		tooltip = {
			add_modifier = {
				modifier = "energy_utopia_57"
				days = 1800
			}
		}
	}
}

# target_empire notices pops are missing
country_event = {
	id = utopia.100
	title = "utopia.100.name"
	desc = "utopia.100.desc"
	picture = GFX_evt_alien_propaganda
	show_sound = event_administrative_work
	location = event_target:missing_pops_planet
	trackable = yes

	is_triggered_only = yes

	immediate = {
		country_event = { id = utopia.102 days = 200 }
		event_target:missing_pops_planet = {
			add_modifier = {
				modifier = pop_disappearances
				days = 7200
			}
		}
	}

	option = {
		name = utopia.100.a
		event_target:missing_pops_planet = {
			enable_special_project = {
				name = "disappearing_pops_project"
				location = this
				owner = root
			}
		}
	}

	option = {
		name = utopia.100.b
	}
}

# Update on missing pops
country_event = {
	id = utopia.101
	title = "utopia.101.name"
	desc = "utopia.101.desc"
	picture = GFX_evt_smugglers_in_bar
	show_sound = event_administrative_work
	location = event_target:missing_pops_planet

	is_triggered_only = yes

	immediate = {
		event_target:missing_pops_planet = {
			remove_modifier = pop_disappearances
		}
	}

	option = {
		name = utopia.101.a
	}
}

# News of anti-aging cream spread throughout the target empire
country_event = {
	id = utopia.102
	title = utopia.102.name
	desc = utopia.102.desc
	picture = GFX_evt_genetic_modification
	show_sound = event_administrative_work
	location = event_target:missing_pops_planet
	trackable = yes

	is_triggered_only = yes

	immediate = {
		random_owned_leader = {
			limit = {
				is_head_of_research = yes
			}
			save_event_target_as = worried_scientist
		}
	}

	option = {
		name = utopia.102.a
		event_target:missing_pops_planet = {
			enable_special_project = {
				name = "mystery_cream_project"
				location = this
				owner = root
			}
		}
	}
	option = {
		name = utopia.102.b
	}
}

# Anti-aging cream fraud discovery
country_event = {
	id = utopia.103
	title = utopia.103.name
	desc = utopia.103.desc
	picture = GFX_evt_genetic_modification
	show_sound = event_administrative_work
	location = event_target:missing_pops_planet
	trackable = yes

	is_triggered_only = yes

	immediate = {
		add_modifier = {
			modifier = ageless
			days = -1
		}
	}

	option = {
		name = utopia.103.a
		tooltip = {
			add_modifier = {
				modifier = ageless
				days = -1
			}
		}
		event_target:missing_pops_planet = {
			enable_special_project = {
				name = "cream_origin_project"
				location = this
				owner = root
			}
		}
	}

	option = {
		name = utopia.103.b
		tooltip = {
			add_modifier = {
				modifier = ageless
				days = -1
			}
		}
	}
}
# Target country uncovers identity of pop-napping country
country_event = {
	id = utopia.104
	title = utopia.104.name
	desc = utopia.104.desc
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = event_target:fountain_of_youth_country

	is_triggered_only = yes

	option = {
		name = utopia.104.a
		custom_tooltip = "utopia.104.a.tooltip"
		hidden_effect = {
			event_target:fountain_of_youth_country = {
				country_event = { id = utopia.105 days = 4 }
			}
		}
	}

	option = {
		name = utopia.104.c
		custom_tooltip = utopia.104.c.tooltip
	}

	option = {
		name = utopia.104.d
	}
}

# Pop-napping country finds out they've been busted
country_event = {
	id = utopia.105
	title = utopia.105.name
	desc = utopia.105.desc
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = event_target:missing_pops_planet

	is_triggered_only = yes

	option = {
		name = utopia.105.a
		hidden_effect = {
			event_target:target_country = {
				country_event = { id = utopia.106 days = 20 }
			}
		}
		if = {
			limit = { has_modifier = energy_utopia_57 }
			remove_modifier = energy_utopia_57
		}
	}

	option = {
		name = utopia.105.b
		event_target:target_country = {
			add_opinion_modifier = {
				who = root
				modifier = opinion_stole_our_glands
			}
		}
		hidden_effect = {
			country_event = { id = utopia.108 days = 20 }
			event_target:target_country = {
				country_event = { id = utopia.107 days = 1 }
			}
		}
	}

	option = {
		name = utopia.105.c
		custom_tooltip = utopia.105.c.tooltip
		event_target:target_country = {
			add_opinion_modifier = {
				who = root
				modifier = opinion_stole_our_glands
			}
		}
		hidden_effect = {
			country_event = { id = utopia.108 days = 20 }
			event_target:target_country = {
				country_event = { id = utopia.107 days = 20 }
				set_country_flag = request_ignored
			}
		}
	}
}
# Target country is notified that pop-nappers agreed to their demands
country_event = {
	id = utopia.106
	title = utopia.106.name
	desc = utopia.106.desc
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = capital_scope

	is_triggered_only = yes

	option = {
		name = utopia.106.a
	}
}
# Target country is notified that pop-nappers didn't agree to their demands
country_event = {
	id = utopia.107
	title = utopia.107.name
	desc = {
		trigger = {
			NOT = {
				has_country_flag = request_ignored
			}
		}
		text = utopia.107.desc.a
	}
	desc = {
		trigger = {
			has_country_flag = request_ignored
		}
		text = utopia.107.desc.b
	}
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = capital_scope

	is_triggered_only = yes

	option = {
		name = utopia.107.a
	}
}
# Refusal reaction
country_event = {
	id = utopia.108
	title = utopia.108.name
	desc = utopia.108.desc
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = capital_scope

	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				has_modifier = energy_utopia_57
			}
			remove_modifier = energy_utopia_57
		}
	}

	option = {
		name = utopia.108.a
		if = {
			limit = {
				has_modifier = energy_utopia_57
			}
			tooltip = {
				remove_modifier = energy_utopia_57
			}
		}
	}
}

country_event = {
	id = utopia.58
	title = "utopia.58.name"
	desc = "utopia.58.desc"
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = event_target:think_tank_2

	is_triggered_only = yes

	option = {
		name = utopia.58.a
	}
}

country_event = {
	id = utopia.59
	title = "utopia.59.name"
	desc = "utopia.59.desc"
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = event_target:think_tank_2

	is_triggered_only = yes

	trigger = {
		any_owned_leader = {
			leader_class = scientist
		}
	}
	immediate = {
		if = {
			limit = {
				any_owned_leader = {
					is_head_of_research = yes
				}
			}
			random_owned_leader = {
				limit = {
					is_head_of_research = yes
				}
				save_event_target_as = volunteer_leader
			}
		}
		else_if = {
			limit = {
				any_owned_leader = {
					leader_class = scientist
					NOT = { has_leader_flag = leader_death_events_blocked }
				}
			}
			random_owned_leader = {
				limit = {
					leader_class = scientist
					NOT = { has_leader_flag = leader_death_events_blocked }
				}
				save_event_target_as = volunteer_leader
			}
		}
	}

	option = {
		name = utopia.59.a
		custom_tooltip = utopia.59.a.tooltip
		event_target:volunteer_leader = {
			kill_leader = { class = scientist show_notification = no }
		}
		#add_modifier = {
		#	modifier = research_utopia_60
		#	days = -1
		#}

		event_target:think_tank_2 = {
			#limit = {
			#	is_megastructure_type = think_tank_3
			#}
			upgrade_megastructure_to = think_tank_4
		}

		#hidden_effect = { country_event = { id = utopia.61 days = 1800 random = 100 } }
	}

	option = {
		name = utopia.59.b
	}

	option = {
		name = utopia.59.c
	}
}

country_event = {
	id = utopia.60
	title = "utopia.60.name"
	desc = "utopia.60.desc"
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = event_target:think_tank_2

	is_triggered_only = yes

	option = {
		name = utopia.60.a
		trigger = {
			resource_stockpile_compare = { resource = energy value < 1000 }
		}
	}

	option = {
		name = utopia.60.b
		trigger = {
			resource_stockpile_compare = { resource = energy value >= 1000 }
		}
		add_modifier = {
			modifier = research_utopia_60
			days = -1
		}
		#hidden_effect = { country_event = { id = utopia.61 days = 1800 random = 100 } }
	}

	option = {
		name = utopia.60.c
		trigger = {
			resource_stockpile_compare = { resource = energy value >= 1000 }
		}
	}
}

#country_event = {
#	id = utopia.61
#	title = "utopia.61.name"
#	desc = "utopia.61.desc"
#	picture = GFX_evt_think_tank
#	show_sound = event_administrative_work
#	location = event_target:think_tank_2
#
#	immediate = {
#		remove_modifier = research_utopia_60
#	}
#	is_triggered_only = yes
#
#	option = {
#		name = UNFORTUNATE
#
#		tooltip = {
#			remove_modifier = research_utopia_60
#		}
#	}
#}

# Abducted Scientist
country_event = {
	id = utopia.62
	title = "utopia.62.name"
	desc = "utopia.62.desc"
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = event_target:think_tank_2

	is_triggered_only = yes

	trigger = {
		any_owned_leader = {
			leader_class = scientist
			is_leader_tier = leader_tier_default
			is_councilor = yes
			is_ruler = no
			NOR = {
				has_leader_flag = leader_death_events_blocked
			}
		}
	}

	immediate = {
		random_owned_leader = {
			limit = {
				leader_class = scientist
				is_leader_tier = leader_tier_default
				is_councilor = yes
				is_ruler = no
				NOR = {
					has_leader_flag = leader_death_events_blocked
				}
			}
			save_event_target_as = abducted_leader
			exile_leader_as = exiled_physics_leader
			add_experience = 400
			if = {
				limit = {
					NOR = {
					has_trait = leader_trait_spark_of_genius
					has_trait = leader_trait_spark_of_genius_2
					}
				}
				add_trait = {
					trait = leader_trait_spark_of_genius
				}
			}
			if = {
				limit = {
					NOR = {
						has_trait = leader_trait_maniacal
						has_trait = leader_trait_maniacal_2
						has_trait = leader_trait_maniacal_3
					}
				}
				add_trait = {
					trait = leader_trait_maniacal
				}
			}
		}
		set_country_flag = think_tank_event
	}
	option = {
		name = utopia.62.a
		hidden_effect = { country_event = { id = utopia.63 days = 360 random = 20 } }
	}
}

country_event = {
	id = utopia.63
	title = "utopia.63.name"
	desc = "utopia.63.desc"
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = event_target:think_tank_2

	is_triggered_only = yes

	immediate = {

		create_fleet = {
			name = "NAME_Other_Science_Ship"
			effect = {
				set_owner = root
				if = {
					limit = {
						has_first_contact_dlc = yes
					}
					create_ship_design = {
						design = "NAME_From_Beyond_Ship_Cloak"
					}
				}
				else = {
					create_ship_design = {
						design = "NAME_From_Beyond_Ship"
					}
				}
				create_ship = {
					name = "NAME_From_Beyond"
					design = last_created_design
					graphical_culture = "extra_dimensional_01"
					prefix = no
					upgradable = no
					effect = {
						set_ship_flag = special_science_ship
					}
				}
				set_location = from.capital_scope
				save_event_target_as = deleted_ship
			}
		}
		event_target:deleted_ship = {
			set_leader = exiled_physics_leader
			leader = {unassign_leader = this}
			delete_fleet = this
		}
	}

	option = {
		name = utopia.63.a
	}
}

# Neural Bank Event
country_event = {
	id = utopia.64
	title = "utopia.59.name"
	desc = "utopia.64.desc"
	picture = GFX_evt_think_tank
	show_sound = event_administrative_work
	location = event_target:think_tank_2

	is_triggered_only = yes

	trigger = {
		any_owned_leader = {
			leader_class = scientist
			is_leader_tier = leader_tier_default
			is_ruler = no
			NOR = {
				has_leader_flag = leader_death_events_blocked
			}
		}
	}
	immediate = {
		if = {
			limit = {
				any_owned_leader = {
					leader_class = scientist
					is_leader_tier = leader_tier_default
					is_councilor = yes
					is_ruler = no
					NOR = {
						has_leader_flag = leader_death_events_blocked
					}
				}
			}
			random_owned_leader = {
				limit = {
					leader_class = scientist
					is_leader_tier = leader_tier_default
					is_councilor = yes
					is_ruler = no
					NOR = {
						has_leader_flag = leader_death_events_blocked
					}
				}
				save_event_target_as = volunteer_leader
			}
		}
		else_if = {
			limit = {
				any_owned_leader = {
					leader_class = scientist
					is_leader_tier = leader_tier_default
					is_ruler = no
					NOR = {
						has_leader_flag = leader_death_events_blocked
					}
				}
			}
			random_owned_leader = {
				limit = {
					leader_class = scientist
					is_leader_tier = leader_tier_default
					is_ruler = no
					NOR = {
						has_leader_flag = leader_death_events_blocked
					}
				}
				save_event_target_as = volunteer_leader
			}
		}
		set_country_flag = think_tank_event
	}

	option = {
		name = utopia.59.a
		custom_tooltip = utopia.59.a.tooltip
		event_target:volunteer_leader = {
			kill_leader = { class = scientist show_notification = no }
		}
		#add_modifier = {
		#	modifier = research_utopia_60
		#	days = -1
		#}
		event_target:think_tank_2 = {
			#limit = {
			#	is_megastructure_type = think_tank_3
			#}
			upgrade_megastructure_to = think_tank_4
		}
		#hidden_effect = { country_event = { id = utopia.61 days = 1800 random = 100 } }
	}

	option = {
		name = utopia.59.b
	}

	option = {
		name = utopia.59.c
	}
}

# Science Nexus (Think Tank) Notification Events

# Science Nexus Site Built

country_event = {
	id = utopia.80
	title = utopia.80.name
	desc = utopia.80.desc
	picture = GFX_evt_think_tank
	show_sound = event_think_tank_build_start
	location = FROMFROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = think_tank_0 }
	}

	option = {
		name = utopia.80.a
	}
}

# Science Nexus Site Built Notification (HIDDEN)
country_event = {
	id = utopia.81
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = think_tank_1 }
	}

	immediate = {
		FROMFROM = { save_event_target_as = think_tank_system }
		every_relation = {
			limit = {
				is_ai = no
				has_communications = root
				OR = {
					has_intel_level = {
						who = root
						category = economy
						level >= 1
					}
					has_intel_level = {
						who = root
						category = technology
						level >= 1
					}
				}
			}
			country_event = { id = utopia.82 }
		}
		if = {
			limit = {
				NOT = { has_country_flag = started_first_think_tank }
			}
			set_country_flag = started_first_think_tank
		}
		else_if = {
			limit = {
				has_country_flag = started_first_think_tank
			}
			set_country_flag = started_first_think_tank_2
		}
	}
}


# Neighbor begins building Science Nexus
country_event = {
	id = utopia.82
	title = utopia.82.name
	desc = {
		text = utopia.82.desc.a
		trigger = {
			FROM = {
				has_country_flag = started_first_think_tank
				NOT = { has_country_flag = started_first_think_tank_2 }
			}
		}
	}
	desc = {
		text = utopia.82.desc.b
		trigger = {
			FROM = {
				has_country_flag = started_first_think_tank_2
			}
		}
	}
	picture = GFX_evt_think_tank
	show_sound = event_mega_structure_other_empire_build_start
	location = event_target:think_tank_system

	is_triggered_only = yes

	option = {
		name = utopia.82.a
	}
	option = {
		name = utopia.82.b
	}

	option = {
		name = utopia.82.c
	}
}

# Science Nexus Hub built
country_event = {
	id = utopia.83
	title = utopia.83.name
	desc = utopia.83.desc
	picture = GFX_evt_think_tank
	show_sound = event_think_tank_build_upgrade
	location = FROMFROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = think_tank_1 }
	}

	option = {
		name = utopia.83.a
	}
}

 # Science Nexus Wings First Stage Completed
country_event = {
	id = utopia.85
	title = utopia.85.name
	desc = utopia.85.desc
	picture = GFX_evt_think_tank
	show_sound = event_think_tank_build_upgrade
	location = FROMFROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = think_tank_2 }
	}

	option = {
		name = utopia.85.a
	}
}

# Science Nexus completed
country_event = {
	id = utopia.84
	title = utopia.84.name
	desc = {
		text = utopia.84.desc.a
		trigger = {
			NOT = { has_country_flag = finished_think_tank }
		}
	}
	desc = {
		text = utopia.84.desc.b
		trigger = {
			has_country_flag = finished_think_tank
		}
	}
	picture = GFX_evt_think_tank
	show_sound = event_think_tank_build_complete
	location = FROMFROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = think_tank_3 }
	}

	immediate = {
		every_relation = {
			limit = {
				is_ai = no
				has_communications = root
				OR = {
					has_intel_level = {
						who = root
						category = economy
						level >= 1
					}
					has_intel_level = {
						who = root
						category = technology
						level >= 1
					}
				}
			}
			country_event = { id = utopia.86 }
		}
	}

	after = {
		hidden_effect = { country_event = { id = utopia.87 days = 5 } }
	}

	option = {
		name = utopia.84.a
	}
}

# Science Nexus Flag Event (HIDDEN)
country_event = {
	id = utopia.87
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		set_country_flag = finished_think_tank
	}
}

# Neighbor notification
country_event = {
	id = utopia.86
	title = utopia.86.name
	desc = utopia.86.desc
	picture = GFX_evt_think_tank
	show_sound = event_mega_structure_other_empire_build_complete
	location = FROMFROMFROM

	is_triggered_only = yes

	option = {
		name = OK
	}
}

# Sentry Array Site, 1, 2, 3, 4

# ID 4000 - 5999
# Sentry Array Site Built
country_event = {
	id = utopia.4100
	title = utopia.4100.name
	desc = utopia.4100.desc
	picture = GFX_evt_spy_orb
	show_sound = event_spy_orb_build_start
	location = FROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = spy_orb_0 }
	}

	option = {
		name = utopia.4100.a
		custom_tooltip = utopia.4100.a.tooltip
	}
}

# Sentry Array Hub Built Notification (HIDDEN)
country_event = {
	id = utopia.4101
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = spy_orb_1 }
	}

	immediate = {
		FROMFROM = { save_event_target_as = spy_system }
		every_relation = {
			limit = {
				is_ai = no
				has_communications = root
				OR = {
					has_intel_level = {
						who = root
						category = economy
						level >= 1
					}
					has_intel_level = {
						who = root
						category = technology
						level >= 1
					}
				}
			}
			country_event = { id = utopia.4102 }
		}
		if = {
			limit = {
				NOT = { has_country_flag = started_first_spy_orb }
			}
			set_country_flag = started_first_spy_orb
		}
		else_if = {
			limit = {
				has_country_flag = started_first_spy_orb
			}
			set_country_flag = started_first_spy_orb_2
		}
	}
}

# Neighbor begins building Sentry Array
country_event = {
	id = utopia.4102
	title = utopia.4102.name
	desc = utopia.4102.desc
	picture = GFX_evt_spy_orb
	show_sound = event_mega_structure_other_empire_build_start
	location = event_target:spy_system

	is_triggered_only = yes

	option = {
		name = OK
	}
}

# Sentry Array Hub built
country_event = {
	id = utopia.4103
	title = utopia.4103.name
	desc = utopia.4103.desc
	picture = GFX_evt_spy_orb
	show_sound = event_spy_orb_build_upgrade
	location = FROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = spy_orb_1 }
	}

	option = {
		name = OK
		custom_tooltip = utopia.4103.a.tooltip
	}
}

# Sentry Array completed
country_event = {
	id = utopia.4104
	title = utopia.4104.name
	desc = utopia.4104.desc
	picture = GFX_evt_spy_orb
	show_sound = event_spy_orb_build_complete
	location = FROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = spy_orb_4 }
	}

	immediate = {
		set_country_flag = built_sentry_array
		every_relation = {
			limit = {
				is_ai = no
				has_communications = root
				OR = {
					has_intel_level = {
						who = root
						category = economy
						level >= 1
					}
					has_intel_level = {
						who = root
						category = technology
						level >= 1
					}
				}
			}
			country_event = { id = utopia.4110 }
		}
	}

	option = {
		name = utopia.4104.a
		custom_tooltip = utopia.4104.a.tooltip
	}
}

# Neighbor notification
country_event = {
	id = utopia.4110
	title = utopia.4110.name
	desc = utopia.4110.desc
	picture = GFX_evt_spy_orb
	show_sound = event_mega_structure_other_empire_build_complete
	location = FROMFROMFROM

	is_triggered_only = yes

	option = {
		name = OK
	}
}


# ID 4000 - 5999
# Dyson Sphere Site Built
country_event = {
	id = utopia.4000
	title = utopia.4000.name
	desc = utopia.4000.desc
	picture = GFX_evt_dyson_sphere
	show_sound = event_dyson_sphere_build_start
	location = FROMFROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = dyson_sphere_0 }
	}

	option = {
		name = utopia.4000.a
	}
}

# Dyson Sphere Frame Built Notification (HIDDEN)
country_event = {
	id = utopia.4001
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = dyson_sphere_1 }
	}

	immediate = {
		FROMFROM = { save_event_target_as = dyson_system }
		every_relation = {
			limit = {
				is_ai = no
				has_communications = root
				OR = {
					has_intel_level = {
						who = root
						category = economy
						level >= 1
					}
					has_intel_level = {
						who = root
						category = technology
						level >= 1
					}
				}
			}
			country_event = { id = utopia.4002 }
		}
		if = {
			limit = {
				NOT = { has_country_flag = started_first_dyson_sphere }
			}
			set_country_flag = started_first_dyson_sphere
		}
		else_if = {
			limit = {
				has_country_flag = started_first_dyson_sphere
			}
			set_country_flag = started_first_dyson_sphere_2
		}
	}
}

# Neighbor begins building Dyson Sphere
country_event = {
	id = utopia.4002
	title = utopia.4002.name
	desc = {
		text = utopia.4002.desc.a
		trigger = {
			FROM = {
				has_country_flag = started_first_dyson_sphere
				NOT = { has_country_flag = started_first_dyson_sphere_2 }
			}
		}
	}
	desc = {
		text = utopia.4002.desc.b
		trigger = {
			FROM = {
				has_country_flag = started_first_dyson_sphere_2
			}
		}
	}
	picture = GFX_evt_dyson_sphere
	show_sound = event_mega_structure_other_empire_build_start
	location = event_target:dyson_system

	is_triggered_only = yes

	option = { # has built own Dyson Sphere
		trigger = {
			any_owned_megastructure = {
				OR = {
					is_megastructure_type = dyson_sphere_0
					is_megastructure_type = dyson_sphere_1
					is_megastructure_type = dyson_sphere_2
					is_megastructure_type = dyson_sphere_3
					is_megastructure_type = dyson_sphere_4
					is_megastructure_type = dyson_sphere_5
				}
			}
		}
		name = utopia.4002.a
	}
	option = { # has no Dyson Sphere
		trigger = {
			NOT = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = dyson_sphere_0
						is_megastructure_type = dyson_sphere_1
						is_megastructure_type = dyson_sphere_2
						is_megastructure_type = dyson_sphere_3
						is_megastructure_type = dyson_sphere_4
						is_megastructure_type = dyson_sphere_5
					}
				}
			}
		}
		name = utopia.4002.b
	}
}

# Dyson Sphere Frame built
country_event = {
	id = utopia.4003
	title = utopia.4003.name
	desc = utopia.4003.desc
	picture = GFX_evt_dyson_sphere
	show_sound = event_dyson_sphere_build_upgrade_frame
	location = FROMFROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = dyson_sphere_1 }
	}

	option = {
		name = utopia.4003.a
	}
}

# Dyson Sphere partially completed
country_event = {
	id = utopia.4004
	title = utopia.4004.name
	desc = utopia.4004.desc
	picture = GFX_evt_dyson_sphere
	show_sound = event_dyson_sphere_build_upgrade_panel
	location = FROMFROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = dyson_sphere_2 }
	}

	option = {
		name = utopia.4004.a
	}
}

# Dyson Sphere completed
country_event = {
	id = utopia.4005
	title = utopia.4005.name
	desc = utopia.4005.desc
	picture = GFX_evt_dyson_sphere
	show_sound = event_dyson_sphere_build_complete
	location = FROMFROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = dyson_sphere_5 }
	}

	immediate = {
		set_country_flag = finished_dyson_sphere
		#every_relation = {
		#	limit = {
		#		is_ai = no
		#		has_communications = root
		#	}
		#	country_event = { id = utopia.4010 }
		#}
	}

	option = {
		name = utopia.4005.a
	}
}

# Alert Messages for intermediate steps
country_event = {
	id = utopia.4006
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		from = {
			OR = {
				is_megastructure_type = ring_world_1
				is_megastructure_type = ring_world_3_intermediate
				is_megastructure_type = dyson_sphere_0
				is_megastructure_type = dyson_sphere_3
				is_megastructure_type = dyson_sphere_4
				is_megastructure_type = spy_orb_0
				is_megastructure_type = spy_orb_2
				is_megastructure_type = spy_orb_3
				is_megastructure_type = think_tank_0
				is_megastructure_type = matter_decompressor_0
				is_megastructure_type = strategic_coordination_center_0
				is_megastructure_type = mega_art_installation_0
				is_megastructure_type = interstellar_assembly_0
			}
		}
	}

	immediate = {
		create_message = {
			type = MEGASTRUCTURE_UPGRADED
			localization = MESSAGE_MEGASTRUCTURE_UPGRADED
			days = 30
			target = from # the Go To
			variable = {
				type = name
				localization = MEGASTRUCTURE
				scope = from
			}
			variable = {
				type = name
				localization = SYSTEM
				scope = fromfrom
			}
		}
	}
}

# Alert Messages for initial step
country_event = {
	id = utopia.4007
	hide_window = yes
	is_triggered_only = yes

	#title = utopia.4010.name
	#desc = utopia.4010.desc
	#picture = GFX_evt_dyson_sphere
	#show_sound = event_mega_structure_other_empire_build_complete
	#location = FROMFROM

	trigger = {
		from = {
			OR = {
				#is_megastructure_type = gateway_0
				is_megastructure_type = matter_decompressor_0
				is_megastructure_type = strategic_coordination_center_0
				is_megastructure_type = mega_art_installation_0
				is_megastructure_type = interstellar_assembly_0
				is_megastructure_type = mega_shipyard_0
				is_megastructure_type = orbital_ring
			}
		}
	}

	immediate = {
		create_message = {
			type = MEGASTRUCTURE_BUILT
			localization = MESSAGE_MEGASTRUCTURE_BUILT
			days = 30
			target = from # the Go To
			variable = {
				type = name
				localization = MEGASTRUCTURE
				scope = from
			}
			variable = {
				type = name
				localization = SYSTEM
				scope = fromfrom
			}
		}
	}
}

### RING WORLD

# Initial Ring World Built
country_event = {
	id = utopia.2000
	title = "utopia.2000.name"
	desc = "utopia.2000.desc"
	picture = GFX_evt_unknown_ships
	show_sound = event_ringworld_build_start
	location = FROMFROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = ring_world_1 }
	}

	option = {
		name = "utopia.2000.a"
	}
}

# Building Skeletal Frame Notification (HIDDEN)
country_event = {
	id = utopia.2001
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = ring_world_1 }
	}

	immediate = {
		FROMFROM = { save_event_target_as = ringworld_system }
		every_country = {
			limit = {
				is_ai = no
				NOT = { is_same_value = ROOT }
				OR = {
					has_intel_level = {
						who = root
						category = economy
						level >= 1
					}
					has_intel_level = {
						who = root
						category = technology
						level >= 1
					}
				}
			}
			country_event = { id = utopia.2002 }
		}
	}

	after = {
		if = {
			limit = {
				NOT = { has_country_flag = started_first_ring_world }
			}
			set_country_flag = started_first_ring_world
			break = yes
		}
		if = {
			limit = {
				has_country_flag = started_first_ring_world
			}
			set_country_flag = started_first_ring_world_2
		}
	}
}

# Building Skeletal Frame Notification
country_event = {
	id = utopia.2002
	title = "utopia.2002.name"
	desc = {
		text = utopia.2002.desc.a
		trigger = {
			FROM = {
				has_country_flag = started_first_ring_world
				NOT = { has_country_flag = started_first_ring_world_2 }
			}
		}
	}
	desc = {
		text = utopia.2002.desc.b
		trigger = {
			FROM = {
				has_country_flag = started_first_ring_world_2
			}
		}
	}
	picture = GFX_evt_ringworld
	show_sound = event_mega_structure_other_empire_build_start
	location = event_target:ringworld_system

	is_triggered_only = yes

	option = { # has built own Ring World
		trigger = {
			OR = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = ring_world_1
						is_megastructure_type = ring_world_2
					}
				}
				has_country_flag = finished_ringworld
			}
		}
		name = "utopia.2002.a"
	}
	option = { # has no Ring World
		trigger = {
			NOT = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = ring_world_1
						is_megastructure_type = ring_world_2
					}
				}
			}
			NOT = { has_country_flag = finished_ringworld }
		}
		name = "utopia.2002.b"
	}
}

# Skeletal Frame Built
country_event = {
	id = utopia.2003
	title = "utopia.2003.name"
	desc = "utopia.2003.desc"
	picture = GFX_evt_ringworld
	show_sound = event_ringworld_build_upgrade
	location = FROMFROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = ring_world_2_intermediate }
	}

	option = {
		name = "utopia.2003.a"
	}
}

# Ring World Completed
country_event = {
	id = utopia.2004
	title = "utopia.2004.name"
	desc = {
		text = utopia.2004.desc.a
		trigger = {
			NOT = { has_country_flag = finished_ringworld }
		}
	}
	desc = {
		text = utopia.2004.desc.b
		trigger = {
			has_country_flag = finished_ringworld
		}
	}
	picture = GFX_evt_ringworld
	show_sound = event_ringworld_build_complete
	location = FROMFROM

	is_triggered_only = yes

	trigger = {
		FROM = { is_megastructure_type = ring_world_3_intermediate }
		FROMFROM = {
			NOT = {
				any_system_megastructure = { is_megastructure_type = ring_world_2 }
			}
		}
	}

	immediate = {
		set_country_flag = built_ringworld
		FROMFROM = { save_event_target_as = completed_ringworld_system }
		every_country = {
			limit = {
				is_ai = no
				NOT = { is_same_value = ROOT }
				OR = {
					has_intel_level = {
						who = root
						category = economy
						level >= 1
					}
					has_intel_level = {
						who = root
						category = technology
						level >= 1
					}
				}
			}
			hidden_effect = { country_event = { id = utopia.2005 } }
		}
	}

	after = {
		hidden_effect = { country_event = { id = utopia.2006 days = 5 } }
	}

	option = {
		name = "utopia.2004.a"
	}
}

# Ring World Completed (Others)
country_event = {
	id = utopia.2005
	title = "utopia.2005.name"
	desc = {
		text = utopia.2005.desc.a
		trigger = {
			NOT = { FROM = { has_country_flag = finished_ringworld } }
		}
	}
	desc = {
		text = utopia.2005.desc.b
		trigger = {
			FROM = { has_country_flag = finished_ringworld }
		}
	}
	picture = GFX_evt_ringworld
	show_sound = event_mega_structure_other_empire_build_complete
	location = event_target:completed_ringworld_system

	is_triggered_only = yes

	option = { # has built own Ring World
		trigger = {
			OR = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = ring_world_1
						is_megastructure_type = ring_world_2
					}
				}
				has_country_flag = finished_ringworld
			}
		}
		name = "utopia.2005.a"
	}
	option = { # has no Ring World
		trigger = {
			any_owned_megastructure = {
				NOT = {
					OR = {
						is_megastructure_type = ring_world_1
						is_megastructure_type = ring_world_2
					}
				}
			}
			NOT = { has_country_flag = finished_ringworld }
		}
		name = "utopia.2005.b"
	}
}

# Ring World Flag Event (HIDDEN)
country_event = {
	id = utopia.2006
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		set_country_flag = finished_ringworld
	}
}

### Ruined Megastructures

# Ruined Dyson Sphere
ship_event = {
	id = utopia.2010
	title = "utopia.2010.name"
	desc = {
		trigger = {
			NOT = { owner = { has_technology = tech_mega_engineering } }
		}
		text = utopia.2010.a.desc
	}
	desc = {
		trigger = {
			owner = { has_technology = tech_mega_engineering }
		}
		text = utopia.2010.b.desc
	}
	picture = GFX_evt_space_debris
	show_sound = event_radio_chatter
	location = FROM

	is_triggered_only = yes

	trigger = {
		FROM = {
			has_star_flag = ruined_dyson_system
			any_system_megastructure = { is_megastructure_type = dyson_sphere_ruined }
		}
	}

	immediate = {
		FROM = { save_event_target_as = dyson_system }
	}

	option = {
		name = "utopia.2010.a"
		trigger = {
			owner = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = dyson_sphere_1
						is_megastructure_type = dyson_sphere_2
						is_megastructure_type = dyson_sphere_3
						is_megastructure_type = dyson_sphere_4
						is_megastructure_type = dyson_sphere_5
					}
				}
			}
		}
	}
	option = {
		name = FASCINATING
		trigger = {
			NOT = {
				owner = {
					any_owned_megastructure = {
						OR = {
							is_megastructure_type = dyson_sphere_1
							is_megastructure_type = dyson_sphere_2
							is_megastructure_type = dyson_sphere_3
							is_megastructure_type = dyson_sphere_4
							is_megastructure_type = dyson_sphere_5
						}
					}
				}
			}
		}
		hidden_effect = {
			owner = { country_event = { id = story.5 days = 30 } }
		}
	}
}

# Ruined Dyson Sphere Restored
country_event = {
	id = utopia.2011
	title = "utopia.2011.name"
	desc = "utopia.2011.desc"
	picture = GFX_evt_dyson_sphere
	show_sound = event_dyson_sphere_build_complete
	location = FROM

	is_triggered_only = yes

	option = {
		name = EXCELLENT
	}
}

# Ruined Science Nexus
ship_event = {
	id = utopia.2012
	title = "utopia.2012.name"
	desc = "utopia.2012.desc"
	picture = GFX_evt_space_debris
	show_sound = event_radio_chatter
	location = FROM

	is_triggered_only = yes

	trigger = {
		FROM = {
			has_star_flag = ruined_nexus_system
			any_system_megastructure = { is_megastructure_type = think_tank_ruined }
		}
	}

	immediate = {
		FROM = { save_event_target_as = nexus_system }
	}

	option = {
		name = "utopia.2012.a"
		trigger = {
			owner = {
				OR = {
					has_megastructure = think_tank_1
					has_megastructure = think_tank_2
					has_megastructure = think_tank_3
					has_megastructure = think_tank_4
				}
			}
		}
	}
	option = {
		name = FASCINATING
		trigger = {
			NOT = {
				owner = {
					OR = {
						has_megastructure = think_tank_1
						has_megastructure = think_tank_2
						has_megastructure = think_tank_3
						has_megastructure = think_tank_4
					}
				}
			}
		}
		hidden_effect = {
			owner = { country_event = { id = story.5 days = 30 } }
		}
	}
}

# Ruined Science Nexus Restored
country_event = {
	id = utopia.2013
	title = "utopia.2013.name"
	desc = "utopia.2013.desc"
	picture = GFX_evt_think_tank
	show_sound = event_think_tank_build_complete
	location = FROM

	is_triggered_only = yes

	option = {
		name = EXCELLENT
	}
}

# Ruined Sentry Array
ship_event = {
	id = utopia.2014
	title = "utopia.2014.name"
	desc = "utopia.2014.desc"
	picture = GFX_evt_space_debris
	show_sound = event_radio_chatter
	location = FROM

	is_triggered_only = yes

	trigger = {
		FROM = {
			has_star_flag = ruined_sentry_system
			any_system_megastructure = { is_megastructure_type = spy_orb_ruined }
		}
	}

	immediate = {
		FROM = { save_event_target_as = sentry_system }
	}

	option = {
		name = "utopia.2014.a"
		trigger = {
			owner = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = spy_orb_1
						is_megastructure_type = spy_orb_2
						is_megastructure_type = spy_orb_3
						is_megastructure_type = spy_orb_4
					}
				}
			}
		}
	}
	option = {
		name = FASCINATING
		trigger = {
			NOT = {
				owner = {
					any_owned_megastructure = {
						OR = {
							is_megastructure_type = spy_orb_1
							is_megastructure_type = spy_orb_2
							is_megastructure_type = spy_orb_3
							is_megastructure_type = spy_orb_4
						}
					}
				}
			}
		}
		hidden_effect = {
			owner = { country_event = { id = story.5 days = 30 } }
		}
	}
}

# Ruined Sentry Array Restored
country_event = {
	id = utopia.2015
	title = "utopia.2015.name"
	desc = "utopia.2015.desc"
	picture = GFX_evt_spy_orb
	show_sound = event_spy_orb_build_complete
	location = FROM

	is_triggered_only = yes

	option = {
		name = EXCELLENT
	}
}

# Ruined Ring World
ship_event = {
	id = utopia.2016
	title = "utopia.2016.name"
	desc = "utopia.2016.desc"
	picture = GFX_evt_space_debris
	show_sound = event_radio_chatter
	location = FROM

	is_triggered_only = yes

	trigger = {
		FROM = {
			has_star_flag = ruined_ring_system
			any_system_megastructure = { is_megastructure_type = ring_world_ruined }
		}
	}

	immediate = {
		FROM = { save_event_target_as = ring_system }
	}

	option = {
		name = "utopia.2016.a"
		trigger = {
			owner = { has_country_flag = finished_ringworld }
		}
	}
	option = {
		name = AMAZING
		trigger = {
			owner = { NOT = { has_country_flag = finished_ringworld } }
		}
		hidden_effect = {
			owner = { country_event = { id = story.5 days = 30 } }
		}
	}
}

# Ruined Ring World Restored
country_event = {
	id = utopia.2017
	title = "utopia.2017.name"
	desc = "utopia.2017.desc"
	picture = GFX_evt_ringworld
	show_sound = event_ringworld_build_complete
	location = FROM

	is_triggered_only = yes

	option = {
		name = EXCELLENT
	}
}

# # Habitat Complete Notification
# See megastructures.10
# country_event = {
# 	id = utopia.61
# 	title = "utopia.61.name"
# 	desc = {
# 		trigger = {
# 			NOT = { has_country_flag = already_built_habitat }
# 		}
# 		text = "utopia.61.desc.a"
# 	}

# 	desc = {
# 		trigger = {
# 			has_country_flag = already_built_habitat
# 		}
# 		text = "utopia.61.desc.b"
# 	}
# 	show_sound = event_mystic_reveal
# 	picture = GFX_evt_colony_settlement
# 	is_triggered_only = yes
# 	location = event_target:habitat_planet

# 	option = {
# 		name = EXCELLENT
# 		hidden_effect = { set_country_flag = already_built_habitat }
# 	}
# }

##########################
#
# Megacorp Megastructure
#
##########################

namespace = mega

# Mega Art installation Notification
country_event = {
	id = mega.9000
	title = "mega.9000.name"
	desc = mega.9000.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_mega_art_installation
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
		hidden_effect = { set_country_flag = built_mega_art }
	}
}

country_event = {
	id = mega.9001
	title = "mega.9001.name"
	desc = mega.9001.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_mega_art_installation
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
	}
}

country_event = {
	id = mega.9002
	title = "mega.9002.name"
	desc = {
		trigger = { is_xenophile = yes }
		text = mega.9002.phile.desc
	}
	desc = {
		trigger = {
			OR = {
				is_xenophobe = yes
				is_homicidal = yes
			}
		}
		text = mega.9002.phobe.desc
	}
	desc = {
		trigger = {
			NOR = {
				is_xenophobe = yes
				is_homicidal = yes
				is_xenophile = yes
			}
		}
		text = mega.9002.desc
	}
	desc = mega.9002.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_mega_art_installation
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
	}
}

# Strategic coordination center installation
country_event = {
	id = mega.9003
	title = "mega.9003.name"
	desc = {
		trigger = { is_slaver = yes }
		text = mega.9003.slave.desc
	}
	desc = {
		trigger = {
			OR = {
				is_militarist = yes
				is_homicidal = yes
			}
		}
		text = mega.9003.mil.desc
	}
	desc = {
		trigger = {
			NOR = {
				is_slaver = yes
				is_homicidal = yes
				is_militarist = yes
			}
		}
		text = mega.9003.desc
	}

	desc = mega.9003.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_strategic_coordination_center
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
		hidden_effect = { set_country_flag = built_SCC }
	}
}

country_event = {
	id = mega.9004
	title = "mega.9004.name"
	desc = mega.9004.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_strategic_coordination_center
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
	}
}

country_event = {
	id = mega.9005
	title = "mega.9005.name"
	desc = mega.9005.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_strategic_coordination_center
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT

	}
}

# Interstellar Assembly Notification
country_event = {
	id = mega.9006
	title = "mega.9006.name"
	desc = mega.9006.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_interstellar_assembly
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT

	}
}

country_event = {
	id = mega.9007
	title = "mega.9007.name"
	desc = mega.9007.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_interstellar_assembly
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
		hidden_effect = { set_country_flag = built_quantum_cat }
	}
}

country_event = {
	id = mega.9008
	title = "mega.9008.name"
	desc = mega.9008.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_interstellar_assembly
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT

	}
}

country_event = {
	id = mega.9009
	title = "mega.9009.name"
	desc = mega.9009.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_interstellar_assembly
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
	}
}

# Matter decompresser Notification
country_event = {
	id = mega.9010
	title = "mega.9010.name"
	desc = mega.9010.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_matter_decompressor
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
	}
}


country_event = {
	id = mega.9011
	title = "mega.9011.name"
	desc = mega.9011.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_matter_decompressor
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
	}
}

country_event = {
	id = mega.9012
	title = "mega.9012.name"
	desc = mega.9012.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_matter_decompressor
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
	}
}

country_event = {
	id = mega.9013
	title = "mega.9013.name"
	desc = mega.9013.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_matter_decompressor
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
	}
}

### Ruined Megastructures

# Ruined Matter Decompressor
ship_event = {
	id = mega.9100
	title = "mega.9100.name"
	desc = {
		trigger = {
			NOT = { owner = { has_technology = tech_mega_engineering } }
		}
		text = mega.9100.a.desc
	}
	desc = {
		trigger = {
			owner = { has_technology = tech_mega_engineering }
		}
		text = mega.9100.b.desc
	}
	picture = GFX_evt_space_debris
	show_sound = event_radio_chatter
	location = FROM

	is_triggered_only = yes

	trigger = {
		FROM = {
			has_star_flag = ruined_matter_decompressor_system
			any_system_megastructure = { is_megastructure_type = matter_decompressor_ruined }
		}
	}

	immediate = {
		FROM = { save_event_target_as = matter_decompressor_system }
	}

	option = {
		name = "mega.9100.a"
		trigger = {
			owner = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = matter_decompressor_0
						is_megastructure_type = matter_decompressor_1
						is_megastructure_type = matter_decompressor_2
						is_megastructure_type = matter_decompressor_3
						is_megastructure_type = matter_decompressor_4
					}
				}
			}
		}
	}
	option = {
		name = FASCINATING
		trigger = {
			NOT = {
				owner = {
					any_owned_megastructure = {
						OR = {
							is_megastructure_type = matter_decompressor_0
							is_megastructure_type = matter_decompressor_1
							is_megastructure_type = matter_decompressor_2
							is_megastructure_type = matter_decompressor_3
							is_megastructure_type = matter_decompressor_4
						}
					}
				}
			}
		}
		hidden_effect = {
			owner = { country_event = { id = story.5 days = 30 } }
		}
	}
}

# Ruined Matter Decompressor Restored
country_event = {
	id = mega.9101
	title = "mega.9101.name"
	desc = "mega.1000.desc"
	picture = GFX_evt_matter_decompressor
	show_sound = event_dyson_sphere_build_complete
	location = FROM

	is_triggered_only = yes

	option = {
		name = mega.1000.a.mater
	}
}

# Ruined Strategic Coordination Center
ship_event = {
	id = mega.9110
	title = "mega.9110.name"
	desc = {
		trigger = {
			NOT = { owner = { has_technology = tech_mega_engineering } }
		}
		text = mega.9110.a.desc
	}
	desc = {
		trigger = {
			owner = { has_technology = tech_mega_engineering }
		}
		text = mega.9110.b.desc
	}
	picture = GFX_evt_space_debris
	show_sound = event_radio_chatter
	location = FROM

	is_triggered_only = yes

	trigger = {
		FROM = {
			has_star_flag = ruined_strategic_coordination_center_system
			any_system_megastructure = { is_megastructure_type = strategic_coordination_center_ruined }
		}
	}

	immediate = {
		FROM = { save_event_target_as = strategic_coordination_center_system }
	}

	option = {
		name = "mega.9110.a"
		trigger = {
			owner = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = strategic_coordination_center_0
						is_megastructure_type = strategic_coordination_center_1
						is_megastructure_type = strategic_coordination_center_2
						is_megastructure_type = strategic_coordination_center_3
					}
				}
			}
		}
	}
	option = {
		name = FASCINATING
		trigger = {
			NOT = {
				owner = {
					any_owned_megastructure = {
						OR = {
							is_megastructure_type = strategic_coordination_center_0
							is_megastructure_type = strategic_coordination_center_1
							is_megastructure_type = strategic_coordination_center_2
							is_megastructure_type = strategic_coordination_center_3
						}
					}
				}
			}
		}
		hidden_effect = {
			owner = { country_event = { id = story.5 days = 30 } }
		}
	}
}

# Ruined Strategic Coordination Center Restored
country_event = {
	id = mega.9111
	title = "mega.9111.name"
	desc = "mega.9111.desc"
	picture = GFX_evt_strategic_coordination_center
	show_sound = event_dyson_sphere_build_complete
	location = FROM

	is_triggered_only = yes

	option = {
		name = EXCELLENT
	}
}

#Ruined Mega Art Installation
ship_event = {
	id = mega.9120
	title = "mega.9120.name"
	desc = {
		trigger = {
			NOT = { owner = { has_technology = tech_mega_engineering } }
		}
		text = mega.9120.a.desc
	}
	desc = {
		trigger = {
			owner = { has_technology = tech_mega_engineering }
		}
		text = mega.9120.b.desc
	}
	picture = GFX_evt_space_debris
	show_sound = event_radio_chatter
	location = FROM

	is_triggered_only = yes

	trigger = {
		FROM = {
			has_star_flag = ruined_mega_art_installation_system
			any_system_megastructure = { is_megastructure_type = mega_art_installation_restored }
		}
	}

	immediate = {
		FROM = { save_event_target_as = mega_art_installation_system }
	}

	option = {
		name = "mega.9120.a"
		trigger = {
			owner = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = mega_art_installation_0
						is_megastructure_type = mega_art_installation_1
						is_megastructure_type = mega_art_installation_2
						is_megastructure_type = mega_art_installation_3
					}
				}
			}
		}
	}
	option = {
		name = FASCINATING
		trigger = {
			NOT = {
				owner = {
					any_owned_megastructure = {
						OR = {
							is_megastructure_type = mega_art_installation_0
							is_megastructure_type = mega_art_installation_1
							is_megastructure_type = mega_art_installation_2
							is_megastructure_type = mega_art_installation_3
						}
					}
				}
			}
		}
		hidden_effect = {
			owner = { country_event = { id = story.5 days = 30 } }
		}
	}
}

# Ruined Mega Art Installation Restored
country_event = {
	id = mega.9121
	title = "mega.9121.name"
	desc = "mega.9121.desc"
	picture = GFX_evt_mega_art_installation
	show_sound = event_dyson_sphere_build_complete
	location = FROM

	is_triggered_only = yes

	option = {
		name = EXCELLENT
	}
}

#Ruined Interstellar Assembly
ship_event = {
	id = mega.9130
	title = "mega.9130.name"
	desc = {
		trigger = {
			NOT = { owner = { has_technology = tech_mega_engineering } }
		}
		text = mega.9130.a.desc
	}
	desc = {
		trigger = {
			owner = { has_technology = tech_mega_engineering }
		}
		text = mega.9130.b.desc
	}
	picture = GFX_evt_space_debris
	show_sound = event_radio_chatter
	location = FROM

	is_triggered_only = yes

	trigger = {
		FROM = {
			has_star_flag = ruined_interstellar_assembly_system
			any_system_megastructure = { is_megastructure_type = interstellar_assembly_ruined }
		}
	}

	immediate = {
		FROM = { save_event_target_as = interstellar_assembly_system }
	}

	option = {
		name = "mega.9130.a"
		trigger = {
			owner = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = interstellar_assembly_0
						is_megastructure_type = interstellar_assembly_1
						is_megastructure_type = interstellar_assembly_2
						is_megastructure_type = interstellar_assembly_3
						is_megastructure_type = interstellar_assembly_4
					}
				}
			}
		}
	}
	option = {
		name = FASCINATING
		trigger = {
			NOT = {
				owner = {
					any_owned_megastructure = {
						OR = {
							is_megastructure_type = interstellar_assembly_0
							is_megastructure_type = interstellar_assembly_1
							is_megastructure_type = interstellar_assembly_2
							is_megastructure_type = interstellar_assembly_3
							is_megastructure_type = interstellar_assembly_4
						}
					}
				}
			}
		}
		hidden_effect = {
			owner = { country_event = { id = story.5 days = 30 } }
		}
	}
}

#Ruined Interstellar Assembly Restored
country_event = {
	id = mega.9131
	title = "mega.9131.name"
	desc = "mega.9131.desc"
	picture = GFX_evt_interstellar_assembly
	show_sound = event_dyson_sphere_build_complete
	location = FROM

	is_triggered_only = yes

	option = {
		name = EXCELLENT
	}
}

##############################
#
# Federations Megastructure
#
##############################

namespace = feda

# Matter decompresser Notification
country_event = {
	id = feda.1
	title = "feda.1.name"
	desc = feda.1.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_megashipyard
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
	}
}


country_event = {
	id = feda.2
	title = "feda.2.name"
	desc = feda.2.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_megashipyard
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
	}
}

country_event = {
	id = feda.3
	title = "feda.3.name"
	desc = feda.3.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_megashipyard
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
	}
}

#country_event = {
#	id = feda.4
#	title = "feda.4.name"
#	desc = feda.4.desc
#	show_sound = event_mystic_reveal
#	picture = GFX_evt_megashipyard
#	is_triggered_only = yes
#	location = FROM
#
#	option = {
#		name = EXCELLENT
#	}
#}


### Ruined Megastructures

# Ruined Mega Shipyard
ship_event = {
	id = feda.5
	title = "feda.5.name"
	desc = {
		trigger = {
			NOT = { owner = { has_technology = tech_mega_engineering } }
		}
		text = feda.5.a.desc
	}
	desc = {
		trigger = {
			owner = { has_technology = tech_mega_engineering }
		}
		text = feda.5.b.desc
	}
	picture = GFX_evt_space_debris
	show_sound = event_radio_chatter
	location = FROM

	is_triggered_only = yes

	trigger = {
		FROM = {
			has_star_flag = ruined_mega_shipyard_system
			any_system_megastructure = { is_megastructure_type = mega_shipyard_ruined }
		}
	}

	immediate = {
		FROM = { save_event_target_as = mega_shipyard_system }
	}

	option = {
		name = "feda.5.a"
		trigger = {
			owner = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = mega_shipyard_0
						is_megastructure_type = mega_shipyard_1
						is_megastructure_type = mega_shipyard_2
						is_megastructure_type = mega_shipyard_3
					}
				}
			}
		}
	}
	option = {
		name = FASCINATING
		trigger = {
			NOT = {
				owner = {
					any_owned_megastructure = {
						OR = {
							is_megastructure_type = mega_shipyard_0
							is_megastructure_type = mega_shipyard_1
							is_megastructure_type = mega_shipyard_2
							is_megastructure_type = mega_shipyard_3
						}
					}
				}
			}
		}
		hidden_effect = {
			owner = { country_event = { id = story.5 days = 30 } }
		}
	}
}

# Ruined Mega Shipyard Restored
country_event = {
	id = feda.6
	title = "feda.6.name"
	desc = "feda.6.desc"
	picture = GFX_evt_megashipyard
	show_sound = event_dyson_sphere_build_complete
	location = FROM

	is_triggered_only = yes

	option = {
		name = EXCELLENT
	}
}


##############################
#
# Overlord Megastructures
#
##############################

namespace = over

# Quantum Catapult Notification
country_event = {
	id = over.1
	title = "over.1.name"
	desc = over.1.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_quantum_catapult
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
	}
}

country_event = {
	id = over.5
	title = "over.5.name"
	desc = over.5.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_quantum_catapult
	is_triggered_only = yes
	location = FROM

	option = {
		name = EXCELLENT
	}
}

country_event = {
	id = over.10
	title = "over.10.name"
	desc = over.10.desc
	show_sound = event_mystic_reveal
	picture = GFX_evt_quantum_catapult_build
	is_triggered_only = yes
	location = FROM

	option = {
		name = over.10.a
	}
}

### Ruined Megastructures

# Ruined Quantum Catapult
ship_event = {
	id = over.20
	title = "over.20.name"
	desc = {
		trigger = {
			NOT = { owner = { has_technology = tech_mega_engineering } }
		}
		text = over.20.a.desc
	}
	desc = {
		trigger = {
			owner = { has_technology = tech_mega_engineering }
		}
		text = over.20.b.desc
	}
	picture = GFX_evt_space_debris
	show_sound = event_radio_chatter
	location = FROM

	is_triggered_only = yes

	trigger = {
		FROM = {
			has_star_flag = ruined_catapult_system
			any_system_megastructure = { is_megastructure_type = quantum_catapult_ruined }
		}
	}

	immediate = {
		FROM = { save_event_target_as = quantum_catapult_system }
	}

	option = {
		name = "over.20.a"
		trigger = {
			owner = {
				any_owned_megastructure = {
					OR = {
						is_megastructure_type = quantum_catapult_0
						is_megastructure_type = quantum_catapult_1
						is_megastructure_type = quantum_catapult_2
						is_megastructure_type = quantum_catapult_3
					}
				}
			}
		}
	}
	option = {
		name = FASCINATING
		trigger = {
			NOT = {
				owner = {
					any_owned_megastructure = {
						OR = {
							is_megastructure_type = quantum_catapult_0
							is_megastructure_type = quantum_catapult_1
							is_megastructure_type = quantum_catapult_2
							is_megastructure_type = quantum_catapult_3
						}
					}
				}
			}
		}
		hidden_effect = {
			owner = { country_event = { id = story.5 days = 30 } }
		}
	}
}

# Ruined Quantum Catapult Restored
country_event = {
	id = over.25
	title = "over.25.name"
	desc = {
		trigger = {
			has_origin = origin_star_slingshot
			NOT = { has_technology = tech_quantum_catapult }
		}
		text = over.25.a.desc
	}
	desc = "over.25.desc"
	picture = GFX_evt_quantum_catapult_build
	show_sound = evn_ove_quantum_catapult_construction
	location = FROM

	is_triggered_only = yes

	option = {
		name = EXCELLENT
	}

	immediate = {
		FROM = { save_event_target_as = quantum_catapult_system }
		if = {
			limit = {
				has_origin = origin_star_slingshot
				has_tech_option = tech_quantum_catapult
			}
			add_tech_progress = {
				tech = tech_quantum_catapult
				progress = 0.99
			}
		}
		else_if = {
			limit = {
				has_origin = origin_star_slingshot
				NOT = { has_technology = tech_quantum_catapult }
			}
			give_technology = {
				tech = tech_quantum_catapult
			}
		}
	}
}

#Ambush modifier after yeet
fleet_event = {
	id = over.30
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				owner = {
					has_origin = origin_star_slingshot
				}
			}
			if = {
				limit = {
					owner = {
						has_modifier = quantum_catapult_insight_2_modifier
					}
				}
				add_modifier = {
					modifier = quantic_ambush_specialists_astral
					days = 240
				}
			}
			else = {
				add_modifier = {
					modifier = quantic_ambush_specialists
					days = 120
				}
			}
		}
		else = {
			if = {
				limit = {
					owner = {
						has_modifier = quantum_catapult_insight_2_modifier
					}
				}
				add_modifier = {
					modifier = quantic_ambush_astral
					days = 240
				}
			}
			else = {
				add_modifier = {
					modifier = quantic_ambush
					days = 120
				}
			}
		}
	}
}

#  Yuht Create Jabbardeeni Cache Site
country_event = {
	id = over.50
	title = "over.50.name"
	desc = "over.50.desc"
	picture = GFX_evt_federation_fleet
	location = event_target:yuhtaan

	is_triggered_only = yes

	immediate = {
		random_system = {
			limit = { has_star_flag = yuhtaan }
			save_event_target_as = yuhtaan
			random_system_planet = {
				limit = { has_planet_flag = jabbardeeni_cache }
				save_event_target_as = jabbardeeni_cache
			}
		}
	}

	option = {
		name = "over.50.a"
		event_target:jabbardeeni_cache = {
			enable_special_project = {
				name = "YUHT_JABBARDEENI_CACHE"
				location = event_target:jabbardeeni_cache
				owner = ROOT
			}
		}
	}
}

# Yuht Jabbardeeni Cache
country_event = {
	id = over.60
	title = "over.60.name"
	desc = "over.60.desc"
	picture = GFX_evt_crashed_station
	show_sound = event_dyson_sphere_build_complete
	location = FROM

	is_triggered_only = yes

	option = {
		name = ACKNOWLEDGED

		add_monthly_resource_mult = {
			resource = physics_research
			value = @tier3researchreward
			min = @tier3researchmin
			max = @tier3researchmax
		}

		if = {
			limit = {
				NOR = {
					has_technology = tech_hyper_relays
					has_tech_option = tech_hyper_relays
				}
			}
			add_research_option = tech_hyper_relays
		}
		else_if = {
			limit = {
				NOT = { has_technology = tech_hyper_drive_2 }
			}
			add_research_option = tech_hyper_drive_2
			add_tech_progress = {
				tech = tech_hyper_drive_2
				progress = 0.20
			}
		}
		else_if = {
			limit = {
				NOT = { has_technology = tech_hyper_drive_3 }
			}
			add_research_option = tech_hyper_drive_3
			add_tech_progress = {
				tech = tech_hyper_drive_3
				progress = 0.10
			}
		}
		else_if = {
			limit = {
				NOT = { has_technology = tech_wormhole_stabilization }
			}
			add_research_option = tech_wormhole_stabilization
			add_tech_progress = {
				tech = tech_wormhole_stabilization
				progress = 0.20
			}
		}
		else_if = {
			limit = {
				NOT = { has_technology = tech_experimental_subspace_navigation }
			}
			add_research_option = tech_experimental_subspace_navigation
			add_tech_progress = {
				tech = tech_experimental_subspace_navigation
				progress = 0.20
			}
		}

		generate_lcluster_clue = yes
	}
}

### Hyper Relays
# Connected to another capital | this = Hyper Relay owner; from = Hyper Relay partner (country)
country_event = {
	id = over.100
	title = over.100.title
	desc = {
		trigger = {
			NOR = {
				is_xenophobe = yes
				is_authoritarian = yes
				is_overlord_to = from
				is_gestalt = yes
			}
		}
		text = over.100.a.desc
	}
	desc = {
		trigger = {
			OR = {
				is_authoritarian = yes
				AND = {
					is_overlord_to = from
					is_gestalt = no
				}
			}
			is_xenophobe = no
		}
		text = over.100.b.desc
	}
	desc = {
		trigger = {
			OR = {
				is_gestalt = yes
				is_xenophobe = yes
			}
		}
		text = over.100.c.desc
	}
	picture = {
		trigger = {
			is_machine_empire = no
			NAND = {
				is_gestalt = yes
				from = { is_gestalt = yes }
			}
		}
		picture = GFX_evt_hyper_relay_conjunction
	}
	picture = {
		trigger = {
			OR = {
				is_machine_empire = yes
				AND = {
					is_gestalt = yes
					from = { is_gestalt = yes }
				}
			}
		}
		picture = GFX_evt_inhabited_solar_system
	}
	show_sound = evn_ove_relay_conjunction

	is_triggered_only = yes

	trigger = {
		is_country_type = default
		FROM = { is_country_type = default }
		NOR = {
			has_country_flag = hyper_relay_flag
			has_origin = origin_separatists
			from = {
				has_origin = origin_separatists
			}
		}
	}

	immediate = {
		set_country_flag = hyper_relay_flag
	}

	option = {
		name = over.100.a
		trigger = {
			NOR = {
				is_xenophobe = yes
				is_gestalt = yes
			}
		}
	}
	option = {
		name = over.100.b
		trigger = {
			is_megacorp = yes
		}
	}
	option = {
		name = over.100.c
		trigger = {
			OR = {
				is_xenophobe = yes
				is_gestalt = yes
			}
		}
	}
}
