@phase_0_entity_x = -15
@phase_0_entity_y = -5
@entity_x = -15
@entity_y = -15
spy_orb_0 = {
	entity = "construction_platform_entity"
	construction_entity = "construction_platform_entity"
	portrait = "GFX_megastructure_construction_background"
	place_entity_on_planet_plane = no
	entity_offset = { x = @phase_0_entity_x y = @phase_0_entity_y }
	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_existing_spyorb"
			from = {
				NOT = {
					any_owned_megastructure = {
						OR = {
							is_megastructure_type = spy_orb_0
							is_megastructure_type = spy_orb_1
							is_megastructure_type = spy_orb_2
							is_megastructure_type = spy_orb_3
							is_megastructure_type = spy_orb_4
						}
					}
				}
			}
		}
	}
	
	placement_rules = {
		planet_possible = {
			custom_tooltip = {
				fail_text = "requires_survey_not_habitable"
				is_surveyed = {			# prevent leaking habitability information
					who = prev.from
					status = yes
				}
				habitable_planet = no
				habitable_structure = no
			}
			custom_tooltip = {
				fail_text = "requires_no_anomaly"
				NOT = { has_anomaly = yes }
			}

			#custom_tooltip = { # balance for think tanks
			#	fail_text = "requires_major_planetary_body"
			#	NOR = {
			#		is_asteroid = yes
			#		is_moon = yes
			#		is_star = yes
			#	}
			#}
			custom_tooltip = {
				fail_text = "must_build_around_star"
				is_star = yes
			}
		} # use these for all non-star megastructures
	}
	
	
	ai_weight = {
		factor = 5
	}
	
	on_build_start = {}
	on_build_cancel = {}
	on_build_complete = {
		set_star_flag = spy_orb_built
	}
}

spy_orb_1 = {
	entity = "spyorb_phase_01_entity"
	construction_entity = "spyorb_phase_01_construction_entity"
	portrait = "GFX_megastructure_construction_background"
	place_entity_on_planet_plane = no
	entity_offset = { x = @entity_x y = @entity_y }
	upgrade_from = {
		spy_orb_0
	}
	build_time = 1800
	build_cost = {
		minerals = 15000
	}
	
	construction_blocks_others = no

	maintenance = {
		energy = 8
	}
	sensor_range = 200
}

spy_orb_2 = {
	entity = "spyorb_phase_02_entity"
	construction_entity = "spyorb_phase_02_construction_entity"
	portrait = "GFX_megastructure_construction_background"
	place_entity_on_planet_plane = no
	entity_offset = { x = @entity_x y = @entity_y }
	upgrade_from = {
		spy_orb_1
	}
	build_time = 1800
	build_cost = {
		minerals = 15000
	}
	
	construction_blocks_others = no
	
	maintenance = {
		energy = 10
	}
	sensor_range = 400
}


spy_orb_3 = {
	entity = "spyorb_phase_03_entity"
	construction_entity = "spyorb_phase_03_construction_entity"
	portrait = "GFX_megastructure_construction_background"
	place_entity_on_planet_plane = no
	entity_offset = { x = @entity_x y = @entity_y }
	upgrade_from = {
		spy_orb_2
	}
	build_time = 1800
	build_cost = {
		minerals = 15000
	}
	
	construction_blocks_others = no
	
	maintenance = {
		energy = 12
	}
	sensor_range = 600
}

spy_orb_4 = {
	entity = "spyorb_phase_04_entity"
	construction_entity = "spyorb_phase_04_construction_entity"
	portrait = "GFX_megastructure_spy_orb_background"
	place_entity_on_planet_plane = no
	entity_offset = { x = @entity_x y = @entity_y }
	upgrade_from = {
		spy_orb_3
	}
	build_time = 1800
	build_cost = {
		minerals = 15000
	}
	
	construction_blocks_others = no
	
	maintenance = {
		energy = 15
	}
}