#Dyson Sphere Site
dyson_sphere_0 = {
	entity = "construction_platform_entity"
	construction_entity = "construction_platform_entity"
	portrait = "GFX_megastructure_construction_background"
	place_entity_on_planet_plane = no
	entity_offset = { x = -7 y = -7 }
	build_time = 1800
	resources = {
		category = megastructures
		cost = {
			unity = 1000
		}
		cost = {
			trigger = {
				country_uses_bio_ships = no
			}
			alloys = 5000
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			alloys = 5000
			mult = 0.5
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			food = 5000
			mult = @halved_alloy_to_food_cost_ratio
		}

		upkeep = {
			energy = 5
		}
	}

	custom_tooltip_requirements = "MEGASTRUCTURE_TOOLTIP_REQUIREMENTS_DYSON_SPHERE"

	prerequisites = { "tech_dyson_sphere" }

	potential = {
		has_machine_age_dlc = no
	}

	possible = {
		hidden_trigger = {
			exists = starbase
		}
		custom_tooltip = {
			fail_text = "requires_inside_border"
			is_inside_border = from
		}
		custom_tooltip = {
			fail_text = "requires_no_existing_dyson_sphere"
			from = {
				OR = {
					has_relic = r_contingency_core
					NOT = { has_country_flag = built_dyson_sphere }
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_machine_age"
			from = { has_machine_age_dlc = no }
		}
		custom_tooltip = {
			fail_text = "requires_no_existing_dyson_sphere_two"
			from = {
				NOR = {
					has_country_flag = built_dyson_sphere_contingency
					has_country_flag = built_dyson_sphere_contingency_swarm
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_surveyed_system"
			NOT = {
				any_system_planet = {
					is_surveyed = {
						who = prev.from
						status = no
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace"
			system_has_arc_furnace = no
		}
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace_construction"
			if = {
				limit = {
					system_has_arc_furnace = no
				}
				NOT = {
					solar_system = {
						has_star_flag = arc_furnace_construction
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_colonies"
			NOT = {
				any_system_planet = {
					is_colony = yes
					is_artificial = no
					exists = owner
					owner = {
						is_primitive = no
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "blocked_by_pre_ftl_policy"
			if = {
				limit = {
					any_system_planet = {
						exists = owner
						owner = {
							is_primitive = yes
						}
					}
				}
				from = {
					has_policy_flag = interference_aggressive
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_black_hole_neutron_star_pulsar"
			NOT = {
				is_star_class = sc_black_hole
				is_star_class = sc_neutron_star
				is_star_class = sc_pulsar
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_binary_trinary"
			is_binary_star = no
			is_trinary_star = no
		}
		custom_tooltip = {
			fail_text = "requires_no_existing_megastructure"
			has_no_non_gate_megastructure = yes
			NOT = {
				any_system_planet = {
					is_planet_class = pc_cosmogenesis_world
				}
			}
		}
	}

	placement_rules = {
		planet_possible = {
			custom_tooltip = {
				fail_text = "requires_no_protostar"
				NOT = {
					is_planet_class = pc_protostar
				}
			}
			custom_tooltip = {
				fail_text = "must_build_around_star"
				is_star = yes
			}
			custom_tooltip = {
				fail_text = "requires_no_anomaly"
				NOT = { has_anomaly = yes }
			}
		}
	}

	# root = system
	# from = country
	ai_weight = {
		factor = 15

		modifier = {
			factor = 0.1
			starbase = { NOT = { has_starbase_size >= starbase_starfortress } }
		}

		modifier = {
			factor = 0.1
			any_neighbor_system = {
				exists = owner
				NOT = {
					owner = { is_same_value = from }
				}
			}
		}
	}

	on_build_start = {
		set_star_flag = dyson_sphere_construction
	}
	on_build_cancel = {
		remove_star_flag = dyson_sphere_construction
	}
	on_build_complete = {
		remove_star_flag = dyson_sphere_construction
		set_star_flag = dyson_sphere_built
		remove_system_terraforming_candidates = yes
		from = {
			if = {
				limit = {
					has_relic = r_contingency_core
					has_country_flag = built_dyson_sphere
				}
				set_country_flag = built_dyson_sphere_contingency
			}
			set_country_flag = built_dyson_sphere
		}
		fromfrom.planet = {
			if = {
				limit = { has_orbital_station = yes }
				orbital_station = {
					dismantle = yes
				}
			}
		}
	}
}

#Dyson Sphere Frame
dyson_sphere_1 = {
	entity = "dyson_sphere_phase_01_entity"
	construction_entity = "dyson_sphere_frame_entity"
	portrait = "GFX_megastructure_construction_background"
	build_time = 3600
	resources = {
		category = megastructures
		cost = {
			unity = 5000
		}
		cost = {
			alloys = 10000
		}
		cost = {
			trigger = {
				country_uses_bio_ships = no
			}
			alloys = 10000
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			alloys = 10000
			mult = 0.5
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			food = 10000
			mult = @halved_alloy_to_food_cost_ratio
		}
	}

	possible = {
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace"
			system_has_arc_furnace = no
		}
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace_construction"
			if = {
				limit = {
					system_has_arc_furnace = no
				}
				NOT = {
					solar_system = {
						has_star_flag = arc_furnace_construction
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_colonies"
			NOT = {
				any_system_planet = {
					is_colony = yes
					is_artificial = no
					exists = owner
					owner = {
						is_primitive = no
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "blocked_by_pre_ftl_policy"
			if = {
				limit = {
					any_system_planet = {
						exists = owner
						owner = {
							is_primitive = yes
						}
					}
				}
				from = {
					has_policy_flag = interference_aggressive
				}
			}
		}
	}

	upgrade_from = {
		dyson_sphere_0
	}

	prerequisites = { "tech_dyson_sphere" }

	on_build_start = {
		set_star_flag = dyson_sphere_construction
	}

	on_build_cancel = {
		remove_star_flag = dyson_sphere_construction
	}

	on_build_complete = {
		remove_star_flag = dyson_sphere_construction
		remove_system_terraforming_candidates = yes
	}
}

#Partial Dyson Sphere
dyson_sphere_2 = {
	entity = "dyson_sphere_phase_02_entity"
	construction_entity = "dyson_sphere_part_1_entity"
	portrait = "GFX_megastructure_construction_background"
	build_time = 3600
	use_planet_resource = yes
	possible = {
		custom_tooltip = {
			fail_text = "requires_no_existing_dyson_sphere"
			from = {
				OR = {
					has_relic = r_contingency_core
					NOT = { has_country_flag = built_dyson_sphere_swarm }
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_existing_dyson_sphere_two"
			from = {
				NOT = { has_country_flag = built_dyson_sphere_contingency_swarm } }
		}
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace"
			system_has_arc_furnace = no
		}
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace_construction"
			if = {
				limit = {
					system_has_arc_furnace = no
				}
				NOT = {
					solar_system = {
						has_star_flag = arc_furnace_construction
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_colonies"
			NOT = {
				any_system_planet = {
					OR = {
						sapient_pop_amount > 0
						is_colony = yes
					}
					is_artificial = no
					exists = owner
					owner = {
						is_primitive = no
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "blocked_by_pre_ftl_policy"
			if = {
				limit = {
					any_system_planet = {
						exists = owner
						owner = {
							is_primitive = yes
						}
					}
				}
				from = {
					has_policy_flag = interference_aggressive
				}
			}
		}
	}
	resources = {
		category = megastructures
		cost = {
			unity = 5000
		}
		cost = {
			trigger = {
				country_uses_bio_ships = no
			}
			alloys = 10000
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			alloys = 10000
			mult = 0.5
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			food = 10000
			mult = @halved_alloy_to_food_cost_ratio
		}

		produces = {
			energy = 1000
		}
	}

	upgrade_from = {
		dyson_sphere_1
		dyson_swarm_3
	}

	prerequisites = { "tech_dyson_sphere" }

	on_build_start = {
		set_star_flag = dyson_sphere_construction
		from = {
			if = {
				limit = {
					NOR = {
						has_country_flag = build_dyson_sphere_swarm
						has_country_flag = built_dyson_sphere_contingency_swarm
					}
				}
				if = {
					limit = {
						has_relic = r_contingency_core
						has_country_flag = built_dyson_sphere_swarm
					}
					set_country_flag = built_dyson_sphere_contingency_swarm
				}
			set_country_flag = built_dyson_sphere_swarm
			}
		}
	}

	on_build_cancel = {
		remove_star_flag = dyson_sphere_construction
	}

	on_build_complete = {
		remove_star_flag = dyson_sphere_construction
		remove_system_terraforming_candidates = yes
		from = {
			if = {
				limit = {
					NOT = { has_country_flag = swarm_counter_decreased }
				}
				if = {
					limit = {
						check_variable = {
							which = dyson_swarm_counter
							value >= 1
						}
					}
					change_variable = {
						which = dyson_swarm_counter
						value = -1
					}
					set_country_flag = swarm_counter_decreased
				}
				set_country_flag = swarm_counter_decreased
			}
		}
	}
}

#Partial Dyson Sphere
dyson_sphere_3 = {
	entity = "dyson_sphere_phase_03_entity"
	construction_entity = "dyson_sphere_part_2_entity"
	portrait = "GFX_megastructure_construction_background"
	build_time = 3600
	use_planet_resource = yes
	resources = {
		category = megastructures
		cost = {
			unity = 5000
		}
		cost = {
			trigger = {
				country_uses_bio_ships = no
			}
			alloys = 10000
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			alloys = 10000
			mult = 0.5
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			food = 10000
			mult = @halved_alloy_to_food_cost_ratio
		}

		produces = {
			energy = 2000
		}
	}

	possible = {
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace"
			system_has_arc_furnace = no
		}
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace_construction"
			if = {
				limit = {
					system_has_arc_furnace = no
				}
				NOT = {
					solar_system = {
						has_star_flag = arc_furnace_construction
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_colonies"
			NOT = {
				any_system_planet = {
					is_colony = yes
					is_artificial = no
					exists = owner
					owner = {
						is_primitive = no
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "blocked_by_pre_ftl_policy"
			if = {
				limit = {
					any_system_planet = {
						exists = owner
						owner = {
							is_primitive = yes
						}
					}
				}
				from = {
					has_policy_flag = interference_aggressive
				}
			}
		}
	}

	upgrade_from = {
		dyson_sphere_2
	}

	prerequisites = { "tech_dyson_sphere" }

	on_build_start = {
		set_star_flag = dyson_sphere_construction
	}

	on_build_cancel = {
		remove_star_flag = dyson_sphere_construction
	}

	on_build_complete = {
		remove_star_flag = dyson_sphere_construction
		remove_system_terraforming_candidates = yes
	}
}

#Partial Dyson Sphere
dyson_sphere_4 = {
	entity = "dyson_sphere_phase_04_entity"
	construction_entity = "dyson_sphere_part_3_entity"
	portrait = "GFX_megastructure_construction_background"
	build_time = 3600
	use_planet_resource = yes
	resources = {
		category = megastructures
		cost = {
			unity = 5000
		}
		cost = {
			trigger = {
				country_uses_bio_ships = no
			}
			alloys = 10000
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			alloys = 10000
			mult = 0.5
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			food = 10000
			mult = @halved_alloy_to_food_cost_ratio
		}


		produces = {
			energy = 3000
		}
	}

	upgrade_from = {
		dyson_sphere_3
	}

	prerequisites = { "tech_dyson_sphere" }

	possible = {
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace"
			system_has_arc_furnace = no
		}
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace_construction"
			if = {
				limit = {
					system_has_arc_furnace = no
				}
				NOT = {
					solar_system = {
						has_star_flag = arc_furnace_construction
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_colonies"
			NOT = {
				any_system_planet = {
					is_colony = yes
					is_artificial = no
					exists = owner
					owner = {
						is_primitive = no
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "blocked_by_pre_ftl_policy"
			if = {
				limit = {
					any_system_planet = {
						exists = owner
						owner = {
							is_primitive = yes
						}
					}
				}
				from = {
					has_policy_flag = interference_aggressive
				}
			}
		}
	}

	on_build_start = {
		set_star_flag = dyson_sphere_construction
	}

	on_build_cancel = {
		remove_star_flag = dyson_sphere_construction
	}

	on_build_complete = {
		remove_star_flag = dyson_sphere_construction
		remove_system_terraforming_candidates = yes
	}
}

#Dyson Sphere
dyson_sphere_5 = {
	entity = "dyson_sphere_phase_05_entity"
	construction_entity = "dyson_sphere_part_4_entity"
	portrait = "GFX_megastructure_dyson_sphere_background"
	build_time = 3600
	use_planet_resource = yes
	resources = {
		category = megastructures
		cost = {
			unity = 5000
		}
		cost = {
			trigger = {
				country_uses_bio_ships = no
			}
			alloys = 10000
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			alloys = 10000
			mult = 0.5
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			food = 10000
			mult = @halved_alloy_to_food_cost_ratio
		}

		produces = {
			energy = 4000
		}
	}

	upgrade_from = {
		dyson_sphere_4
	}

	prerequisites = { "tech_dyson_sphere" }
	show_prereqs = yes

	outliner_trigger = {
		exists = owner
		owner = {
			has_country_flag = can_build_disco_sphere
		}
	}

	possible = {
		custom_tooltip = {
			fail_text = "requires_no_consecrated_worlds"
			NOT = {
				any_system_planet = {
					has_modifier = consecrated_world
					is_frozen_by_dyson_sphere = yes
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace"
			system_has_arc_furnace = no
		}
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace_construction"
			if = {
				limit = {
					system_has_arc_furnace = no
				}
				NOT = {
					solar_system = {
						has_star_flag = arc_furnace_construction
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_colonies"
			NOT = {
				any_system_planet = {
					is_colony = yes
					is_artificial = no
					exists = owner
					owner = {
						is_primitive = no
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "blocked_by_pre_ftl_policy"
			if = {
				limit = {
					any_system_planet = {
						exists = owner
						owner = {
							is_primitive = yes
						}
					}
				}
				from = {
					has_policy_flag = interference_aggressive
				}
			}
		}
	}

	on_build_start = {
		set_star_flag = dyson_sphere_construction
	}

	on_build_cancel = {
		remove_star_flag = dyson_sphere_construction
	}

	on_build_complete = {
		remove_star_flag = dyson_sphere_construction
		from = {
			set_country_flag = has_built_or_repaired_megastructure
		}

		every_system_planet = {
			limit = {
				is_frozen_by_dyson_sphere = yes
			}
			if = {
				limit = {
					OR = {
						sapient_pop_amount > 0
						is_colony = yes
					}
				}
				destroy_colony = yes
			}
			change_pc = pc_frozen
		}
		every_system_planet = {
			limit = {
				is_planet_class = pc_barren
			}
			change_pc = pc_barren_cold
		}
		remove_system_terraforming_candidates = yes
	}
}

# Permanently Ruined Dyson Sphere
dyson_sphere_permanently_ruined = {
	entity = "dyson_sphere_destroyed_entity"
	portrait = "GFX_megastructure_construction_background"
	show_galactic_map_icon = no
	show_in_outliner = no

	potential = {
		always = no
	}
}

# Ruined Dyson Sphere
dyson_sphere_ruined = {
	entity = "dyson_sphere_destroyed_entity"
	portrait = "GFX_megastructure_construction_background"

	potential = {
		always = no
	}
}

# Restored Dyson Sphere
dyson_sphere_restored = {
	entity = "dyson_sphere_phase_05_entity"
	construction_entity = "dyson_sphere_part_4_entity"
	portrait = "GFX_megastructure_dyson_sphere_background"
	build_time = 7200
	resources = {
		category = megastructures
		cost = {
			unity = 7500
		}
		cost = {
			trigger = {
				country_uses_bio_ships = no
			}
			alloys = 20000
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			alloys = 20000
			mult = 0.5
		}
		cost = {
			trigger = {
				country_uses_bio_ships = yes
			}
			food = 20000
			mult = @halved_alloy_to_food_cost_ratio
		}

		produces = {
			energy = 4000
		}
	}
	upgrade_from = {
		dyson_sphere_ruined
	}

	outliner_trigger = {
		exists = owner
		owner = {
			has_country_flag = can_build_disco_sphere
		}
	}

	possible = {
		custom_tooltip = {
			fail_text = "requires_no_consecrated_worlds"
			NOT = {
				any_system_planet = {
					has_modifier = consecrated_world
					is_frozen_by_dyson_sphere = yes
				}
			}
		}
		from = { has_technology = tech_mega_engineering }
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace"
			system_has_arc_furnace = no
		}
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace_construction"
			if = {
				limit = {
					system_has_arc_furnace = no
				}
				NOT = {
					solar_system = {
						has_star_flag = arc_furnace_construction
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_colonies"
			NOT = {
				any_system_planet = {
					is_colony = yes
					is_artificial = no
					exists = owner
					owner = {
						is_primitive = no
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "blocked_by_pre_ftl_policy"
			if = {
				limit = {
					any_system_planet = {
						exists = owner
						owner = {
							is_primitive = yes
						}
					}
				}
				from = {
					has_policy_flag = interference_aggressive
				}
			}
		}
	}

	on_build_start = {
		set_star_flag = dyson_sphere_construction
		fromfrom = {
			set_graphical_culture = root.from
		}
	}

	on_build_cancel = {
		remove_star_flag = dyson_sphere_construction
	}

	on_build_complete = {
		remove_star_flag = dyson_sphere_construction
		every_system_planet = {
			limit = {
				is_frozen_by_dyson_sphere = yes
			}
			if = {
				limit = {
					OR = {
						sapient_pop_amount > 0
						is_colony = yes
					}
				}
				destroy_colony = yes
			}
			change_pc = pc_frozen
		}
		every_system_planet = {
			limit = {
				is_planet_class = pc_barren
			}
			change_pc = pc_barren_cold
		}
		remove_system_terraforming_candidates = yes
		every_system_ambient_object = {
			limit = {
				OR = {
					is_ambient_object_type = large_debris_object
					is_ambient_object_type = medium_debris_01_object
					is_ambient_object_type = medium_debris_02_object
					is_ambient_object_type = small_debris_object
				}
			}
			destroy_ambient_object = this
		}
		from = {
			set_country_flag = has_built_or_repaired_megastructure
			country_event = { id = utopia.2011 }
		}
	}
}

#Disco Sphere
dyson_sphere_disco = {
	entity = "dyson_sphere_phase_05_entity"
	construction_entity = "dyson_sphere_part_4_entity"
	portrait = "GFX_megastructure_dyson_sphere_background"
	build_time = 360
	resources = {
		category = megastructures
		cost = {
			rare_crystals = 2500
			unity = 3000
		}

		produces = {
			unity = 750
		}

		upkeep = {
			energy = 30
		}
	}

	upgrade_from = {
		dyson_sphere_5
	}

	potential = {
		has_nemesis = yes
		has_country_flag = can_build_disco_sphere
	}

	possible = {
		from = {
			has_nemesis = yes
			has_country_flag = can_build_disco_sphere
		}
	}

	country_modifier = {
		planet_amenities_mult = 0.3
	}

	on_build_start = {
		set_star_flag = dyson_sphere_construction
	}

	on_build_cancel = {
		remove_star_flag = dyson_sphere_construction
	}

	on_build_complete = {
		remove_star_flag = dyson_sphere_construction
		set_star_flag = mega_art_installation_built
		fromfrom = {
			create_ambient_object = {
				location = this
				type = kaleidoscope_happy
				entity_scale_to_size = yes
				scale = 0.50
			}
			create_ambient_object = {
				location = this
				type = kaleidoscope_neutral
				entity_scale_to_size = yes
				scale = 0.30
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					angle = 45
				}
			}
			create_ambient_object = {
				location = this
				type = kaleidoscope_angry
				entity_scale_to_size = yes
				scale = 0.20
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					angle = 90
				}
			}
		}
		from = {
			remove_country_flag = can_build_disco_sphere
			remove_country_flag = built_dyson_sphere
			remove_country_flag = built_dyson_sphere_contingency
			country_event = { id = situation.2049 }
		}
	}
}

dyson_sphere_disco_restored = {
	entity = "dyson_sphere_phase_05_entity"
	construction_entity = "dyson_sphere_part_4_entity"
	portrait = "GFX_megastructure_dyson_sphere_background"
	build_time = 360
	resources = {
		category = megastructures
		cost = {
			rare_crystals = 2500
			unity = 3000
		}

		produces = {
			unity = 500
		}

		upkeep = {
			energy = 30
		}
	}

	upgrade_from = {
		dyson_sphere_restored
	}

	potential = {
		has_nemesis = yes
		has_country_flag = can_build_disco_sphere
	}

	possible = {
		from = {
			has_nemesis = yes
			has_country_flag = can_build_disco_sphere
		}
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace"
			system_has_arc_furnace = no
		}
		custom_tooltip = {
			fail_text = "requires_no_arc_furnace_construction"
			if = {
				limit = {
					system_has_arc_furnace = no
				}
				NOT = {
					solar_system = {
						has_star_flag = arc_furnace_construction
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_colonies"
			NOT = {
				any_system_planet = {
					is_colony = yes
					is_artificial = no
					exists = owner
					owner = {
						is_primitive = no
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "blocked_by_pre_ftl_policy"
			if = {
				limit = {
					any_system_planet = {
						exists = owner
						owner = {
							is_primitive = yes
						}
					}
				}
				from = {
					has_policy_flag = interference_aggressive
				}
			}
		}
	}

	country_modifier = {
		planet_amenities_mult = 0.3
	}

	on_build_start = {
		set_star_flag = dyson_sphere_construction
	}

	on_build_cancel = {
		remove_star_flag = dyson_sphere_construction
	}

	on_build_complete = {
		remove_star_flag = dyson_sphere_construction
		set_star_flag = mega_art_installation_built
		fromfrom = {
			create_ambient_object = {
				location = this
				type = kaleidoscope_happy
				entity_scale_to_size = yes
				scale = 0.50
			}
			create_ambient_object = {
				location = this
				type = kaleidoscope_neutral
				entity_scale_to_size = yes
				scale = 0.30
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					angle = 45
				}
			}
			create_ambient_object = {
				location = this
				type = kaleidoscope_angry
				entity_scale_to_size = yes
				scale = 0.20
			}
			last_created_ambient_object = {
				set_location = {
					target = prev
					angle = 90
				}
			}
		}
		from = {
			remove_country_flag = can_build_disco_sphere
			remove_country_flag = built_dyson_sphere
			remove_country_flag = built_dyson_sphere_contingency
			country_event = { id = situation.2049 }
		}
	}
}
