#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 = -14 }
	build_time = 1800
	build_cost = {
		minerals = 10000
		influence = 300
	}
	
	construction_blocks_others = no

	maintenance = {
		energy = 5
	}

	potential = {
		has_ascension_perk = ap_galactic_wonders
	}
	
	possible = {
		custom_tooltip = {
			fail_text = "requires_inside_border"
			is_inside_border = from
		}
		custom_tooltip = {
			fail_text = "requires_surveyed_system"
			NOT = {
				any_planet = {
					is_surveyed = {
						who = prev.from
						status = no
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = "requires_no_habitable_planets"
			NOT = {
				any_planet = {
					AND = {
						AND = {
							habitable_planet = yes
							OR = {
								is_colony = yes
								is_under_colonization = yes
							}	
						}
						NOT = {
							habitable_structure = yes
							is_planet_class = pc_ringworld_habitable
							is_planet_class = pc_ringworld_habitable_damaged	
						}
					}
				}
			}
		}
		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_existing_megastructure"
			NOT = {
				has_star_flag = dyson_sphere_built
			}
		}
	}
	
	placement_rules = {
		planet_possible = {
			custom_tooltip = {
				fail_text = "must_build_around_star"
				is_star = yes
			}
			custom_tooltip = {
				fail_text = "requires_no_anomaly"
				NOT = { has_anomaly = yes }
			}
			custom_tooltip = {
				fail_text = "requires_no_orbital_station"
				has_orbital_station = no
			}
		}
	}
	
	ai_weight = {
		factor = 5
	}
	
	on_build_start = {}
	on_build_cancel = {}
	on_build_complete = {
		set_star_flag = dyson_sphere_built
	}
}

#Dyson Sphere Frame
dyson_sphere_1 = {
	entity = "dyson_sphere_phase_01_entity"
	construction_entity = "dyson_sphere_frame_entity"
	portrait = "GFX_megastructure_construction_background"
	upgrade_from = {
		dyson_sphere_0
	}
	build_time = 3600
	build_cost = {
		minerals = 40000
	}

	construction_blocks_others = no	

	monthly_production = {
	}
}

#Partial Dyson Sphere
dyson_sphere_2 = {
	entity = "dyson_sphere_phase_02_entity"
	construction_entity = "dyson_sphere_part_1_entity"
	portrait = "GFX_megastructure_construction_background"
	upgrade_from = {
		dyson_sphere_1
	}
	build_time = 2700
	build_cost = {
		minerals = 17000
	}
	
	construction_blocks_others = no

	monthly_production = {
		energy = 100
	}
}

#Partial Dyson Sphere
dyson_sphere_3 = {
	entity = "dyson_sphere_phase_03_entity"
	construction_entity = "dyson_sphere_part_2_entity"
	portrait = "GFX_megastructure_construction_background"
	upgrade_from = {
		dyson_sphere_2
	}
	build_time = 2700
	build_cost = {
		minerals = 17000
	}
	
	construction_blocks_others = no
	
	monthly_production = {
		energy = 200
	}
}

#Partial Dyson Sphere
dyson_sphere_4 = {
	entity = "dyson_sphere_phase_04_entity"
	construction_entity = "dyson_sphere_part_3_entity"
	portrait = "GFX_megastructure_construction_background"
	upgrade_from = {
		dyson_sphere_3
	}
	build_time = 2700
	build_cost = {
		minerals = 17000
	}
	
	construction_blocks_others = no
	
	monthly_production = {
		energy = 300
	}
}

#Dyson Sphere
dyson_sphere_5 = {
	entity = "dyson_sphere_phase_05_entity"
	construction_entity = "dyson_sphere_part_4_entity"
	portrait = "GFX_megastructure_dyson_sphere_background"
	upgrade_from = {
		dyson_sphere_4
	}
	build_time = 2700
	build_cost = {
		minerals = 34000
	}
	
	construction_blocks_others = no
	
	on_build_complete = {
		every_system_planet = {
			limit = {
				OR = {
					is_planet_class = pc_molten
					is_planet_class = pc_toxic
					is_planet_class = pc_tropical
					is_planet_class = pc_continental
					is_planet_class = pc_ocean
					is_planet_class = pc_artic
					is_planet_class = pc_gaia
					is_planet_class = pc_alpine
					is_planet_class = pc_nuked
				}
			}
			change_pc = pc_frozen
		}
		every_system_planet = {
			limit = {
				OR = {
					is_planet_class = pc_barren
					is_planet_class = pc_desert
					is_planet_class = pc_savannah
					is_planet_class = pc_arid
					is_planet_class = pc_tundra
				}
			}
			change_pc = pc_barren_cold
		}		
	}
	monthly_production = {
		energy = 400
	}
}