# Low priority overwrites

# Thanks Aphyxia

### ALDERSON DISK
# Additional Cultrobium + Minerals for construction
#Big, empty frame
alderson_disk_1 = {
	entity = ""
	construction_entity = "giga_alderson_frames_01_entity"
	portrait = "GFX_megastructure_construction_background"
	place_entity_on_planet_plane = yes
	upgrade_from = { alderson_disk_0 }

	outliner_trigger = {
		exists = owner
		NOT = { has_megastructure_flag = giga_outliner_hidden_by_@owner }
	}
	
	build_time = 3600
	resources = {
		category = giga_gigastructures
		cost = {
			trigger = { country_uses_bio_ships = no }
			alloys = 150000
		}
		cost = {
			trigger = { country_uses_bio_ships = yes }
			alloys = 150000
			mult = 0.5
		}
		cost = {
			trigger = { country_uses_bio_ships = yes }
			food = 150000
			mult = @halved_alloy_to_food_cost_ratio
		}
		cost = {
			sr_cultrobium = 75000 # Active Support
			unity = @giga_giga_unity_cost
		}
		upkeep = { alloys = 25 }
	}

	potential = {
		has_gigastructures = yes
		NOT = { has_global_flag = alderson_disabled }
		has_technology = ssh_tech_nuclei_modification # For cultrobium/active support
	}
	possible = {
		has_enough_bm = yes			 
		from = {
			has_technology = giga_tech_alderson_disk
			has_ascension_perk = ap_gigastructural_constructs
		}
	}

	on_build_start = {
		remove_bm_cost_from_stockpile = yes
	}
	
	ai_weight = { factor = value:giga_ai_base_continue } # If we can build it, we will build it
	on_build_complete = {
		save_event_target_as = giga_system
		from = { country_event = { id = giga_dialog.2503 } }	# Notification
		giga_remove_system_planets = yes
		giga_remove_system_debris = yes
		generate_bulk_matter_cache = yes
		set_asteroid_belt = { radius = 0 }
		spawn_megastructure = { name = "Alderson Section" type = "alderson_disk_2" orbit_angle = 0   orbit_distance = 178.75	owner = from }
		spawn_megastructure = { name = "Alderson Section" type = "alderson_disk_2" orbit_angle = 45  orbit_distance = 180		owner = from }
		spawn_megastructure = { name = "Alderson Section" type = "alderson_disk_2" orbit_angle = 90  orbit_distance = 178.75	owner = from }
		spawn_megastructure = { name = "Alderson Section" type = "alderson_disk_2" orbit_angle = 135 orbit_distance = 180		owner = from }
		spawn_megastructure = { name = "Alderson Section" type = "alderson_disk_2" orbit_angle = 180 orbit_distance = 178.75	owner = from }
		spawn_megastructure = { name = "Alderson Section" type = "alderson_disk_2" orbit_angle = 225 orbit_distance = 180		owner = from }
		spawn_megastructure = { name = "Alderson Section" type = "alderson_disk_2" orbit_angle = 270 orbit_distance = 178.75	owner = from }
		spawn_megastructure = { name = "Alderson Section" type = "alderson_disk_2" orbit_angle = 315 orbit_distance = 180		owner = from }
		remove_megastructure = fromfrom
		create_ambient_object = {
			type = "alderson_frame"
			location = star
			use_3d_location = yes
			base_angle_towards = star
			entity_face_object = star
		}
	}
}

# Gaia
alderson_disk_2_gaia = {
	entity = "giga_alderson_gaia_01_entity"
	construction_entity = "giga_alderson_ruined_center_01_entity"
	portrait = "GFX_megastructure_alderson"
	upgrade_from = { alderson_disk_2 }
	place_entity_on_planet_plane = yes

	outliner_trigger = {
		exists = owner
		NOT = { has_megastructure_flag = giga_outliner_hidden_by_@owner }
	}
	
	build_time = 3600
	resources = {
		category = giga_gigastructures
		cost = {
			sr_cultrobium = 75000 # Active Support
			minerals = 500000
			unity = @giga_giga_unity_cost
		}
		cost = {
			trigger = { country_uses_bio_ships = no }
			alloys = 150000
		}
		cost = {
			trigger = { country_uses_bio_ships = yes }
			alloys = 150000
			mult = 0.5
		}
		cost = {
			trigger = { country_uses_bio_ships = yes }
			food = 150000
			mult = @halved_alloy_to_food_cost_ratio
		}
		inline_script = {
			script = megastructures/generic_parts/giga_mega_bulk_matter_cost
			giga_sr_bulk_matter = @alderson_disk_2_gaia_bm_cost
			 
		}
	}

	potential = {
		has_gigastructures = yes
		NOT = { has_global_flag = alderson_disabled }
	}
	possible = {
		from = {
			has_technology = giga_tech_alderson_disk
			has_ascension_perk = ap_gigastructural_constructs
		}
	}

	ai_weight = { factor = value:giga_ai_base_continue } # If we can build it, we will build it
	on_build_complete = {
		save_event_target_as = giga_system
		from = {
			country_event = { id = giga_dialog.2504 }	# Notification
			if = {
				limit = {
					NOR = {
						has_global_flag = giga_achievements_disabled
						has_country_flag = giga_achievement_94
					}
				}
				set_country_flag = giga_achievement_94
				set_timed_country_flag = { flag = giga_achievement_94_notification days = 30 }
				giga_achievement_sound = yes
			}
		}

		change_variable = { which = alderson_slices value = 1 }
		if = {
			limit = { check_variable = { which = alderson_slices value >= 8 } }
			from = {
				country_event = { id = giga_dialog.2507 }			# Fully completed Alderson
				remove_country_flag = giga_started_alderson
				change_variable = { which = completed_alderson value = 1 }
			}
			clear_variable = alderson_slices
		}

		spawn_planet = {
			class = "pc_alderson_slice_gaia"
			location = fromfrom
			size = 15
			init_effect = {
				set_name = "Alderson Slice"
				set_surveyed = { surveyed = yes surveyor = solar_system.owner }
				every_country = {
					limit = { has_communications = root.owner }
					prev = { set_surveyed = { surveyed = yes surveyor = prev } }
				}
				clear_blockers = yes
				save_event_target_as = alderson_section
				trigger_megastructure_icon = yes
				set_planet_flag = giga_alderson_gaia
				set_planet_flag = forbid_guillis_planet_modifiers
				set_planet_flag = megastructure
				set_planet_flag = colony_event			# Vanilla uses to prevent unwanted events on planets

				giga_start_ai_colony_if_safe = yes
				if = {
					limit = { solar_system.owner = { is_machine_empire = yes } }
					set_planet_entity = { picture = pc_ai entity = giga_alderson_machine_01_entity }
				}
				else_if = {
					limit = { solar_system.owner = { is_hive_empire = yes } }
					set_planet_entity = { picture = pc_infested entity = giga_alderson_hive_01_entity }
				}
			}
		}

		remove_megastructure = fromfrom
		# Name the segments
		if = {		limit = { NOT = { has_star_flag = giga_alderson_1 } } set_star_flag = giga_alderson_1 event_target:alderson_section = { set_name = "Hypersegment A" } }
		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_2 } } set_star_flag = giga_alderson_2 event_target:alderson_section = { set_name = "Hypersegment B" } }
		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_3 } } set_star_flag = giga_alderson_3 event_target:alderson_section = { set_name = "Hypersegment C" } }
		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_4 } } set_star_flag = giga_alderson_4 event_target:alderson_section = { set_name = "Hypersegment D" } }
		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_5 } } set_star_flag = giga_alderson_5 event_target:alderson_section = { set_name = "Hypersegment E" } }
		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_6 } } set_star_flag = giga_alderson_6 event_target:alderson_section = { set_name = "Hypersegment F" } }
		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_7 } } set_star_flag = giga_alderson_7 event_target:alderson_section = { set_name = "Hypersegment G" } }
		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_8 } } set_star_flag = giga_alderson_8 event_target:alderson_section = { set_name = "Hypersegment H" } }
	}
}

# # PC
# alderson_disk_2_pc = {
# 	entity = "giga_alderson_pc_01_entity"
# 	construction_entity = "giga_alderson_ruined_center_01_entity"
# 	place_entity_on_planet_plane = yes
# 	portrait = "GFX_megastructure_alderson"
# 	upgrade_from = { alderson_disk_2 }

# 	outliner_trigger = {
# 		exists = owner
# 		NOT = { has_megastructure_flag = giga_outliner_hidden_by_@owner }
# 	}
	
# 	build_time = 3600
# 	resources = {
# 		category = giga_gigastructures
# 		cost = {
# 			sr_cultrobium = 60000 # Active Support
# 			minerals = 300000
# 			unity = @giga_giga_unity_cost
# 		}
# 		cost = {
# 			trigger = { country_uses_bio_ships = no }
# 			alloys = 120000
# 		}
# 		cost = {
# 			trigger = { country_uses_bio_ships = yes }
# 			alloys = 120000
# 			mult = 0.5
# 		}
# 		cost = {
# 			trigger = { country_uses_bio_ships = yes }
# 			food = 120000
# 			mult = @halved_alloy_to_food_cost_ratio
# 		}
# 	}

# 	potential = {
# 		has_gigastructures = yes
# 		NOT = { has_global_flag = alderson_disabled }
# 	}
# 	possible = {
# 		from = {
# 			has_technology = giga_tech_planetary_computer
# 			has_technology = giga_tech_alderson_disk
# 			has_ascension_perk = ap_slice_of_life
# 		}
# 	}

# 	ai_weight = { factor = value:giga_ai_base_continue } # If we can build it, we will build it
# 	on_build_complete = {
# 		save_event_target_as = giga_system
# 		from = {
# 			country_event = { id = giga_dialog.2505 }	# Notification
# 			if = {
# 				limit = {
# 					NOR = {
# 						has_global_flag = giga_achievements_disabled
# 						has_country_flag = giga_achievement_94
# 					}
# 				}
# 				set_country_flag = giga_achievement_94
# 				set_timed_country_flag = { flag = giga_achievement_94_notification days = 30 }
# 				giga_achievement_sound = yes
# 			}
# 		}

# 		change_variable = { which = alderson_slices value = 1 }
# 		if = {
# 			limit = { check_variable = { which = alderson_slices value >= 8 } }
# 			from = { country_event = { id = giga_dialog.2507 } }			# Fully completed Alderson
# 			from = { remove_country_flag = giga_started_alderson }
# 			clear_variable = alderson_slices
# 		}

# 		spawn_planet = {
# 			class = "pc_alderson_slice_pc"
# 			location = fromfrom
# 			size = 15
# 			init_effect = {
# 				set_name = "Alderson Slice"
# 				set_surveyed = { surveyed = yes surveyor = solar_system.owner }
# 				every_country = {
# 					limit = { has_communications = root.owner }
# 					prev = { set_surveyed = { surveyed = yes surveyor = prev } }
# 				}
# 				clear_blockers = yes
# 				save_event_target_as = alderson_section
# 				trigger_megastructure_icon = yes
# 				set_planet_flag = giga_alderson_pc
# 				set_planet_flag = forbid_guillis_planet_modifiers
# 				set_planet_flag = megastructure
# 				set_planet_flag = colony_event			# Vanilla uses to prevent unwanted events on planets
# 				add_modifier = { modifier = "giga_planetary_computer" days = -1 }
# 				add_deposit = d_giga_job_size

# 				giga_start_ai_colony_if_safe = yes
# 				if = {
# 					limit = { solar_system.owner = { is_machine_empire = yes } }
# 					set_planet_entity = { picture = pc_ai entity = giga_alderson_machine_01_entity }
# 				}
# 				else_if = {
# 					limit = { solar_system.owner = { is_hive_empire = yes } }
# 					set_planet_entity = { picture = pc_infested entity = giga_alderson_hive_01_entity }
# 				}
# 			}
# 		}

# 		remove_megastructure = fromfrom
# 		# Name the segments
# 		if = {		limit = { NOT = { has_star_flag = giga_alderson_1 } } set_star_flag = giga_alderson_1 event_target:alderson_section = { set_name = "Habitable Hypersegment A" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_2 } } set_star_flag = giga_alderson_2 event_target:alderson_section = { set_name = "Habitable Hypersegment B" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_3 } } set_star_flag = giga_alderson_3 event_target:alderson_section = { set_name = "Habitable Hypersegment C" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_4 } } set_star_flag = giga_alderson_4 event_target:alderson_section = { set_name = "Habitable Hypersegment D" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_5 } } set_star_flag = giga_alderson_5 event_target:alderson_section = { set_name = "Habitable Hypersegment E" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_6 } } set_star_flag = giga_alderson_6 event_target:alderson_section = { set_name = "Habitable Hypersegment F" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_7 } } set_star_flag = giga_alderson_7 event_target:alderson_section = { set_name = "Habitable Hypersegment G" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_8 } } set_star_flag = giga_alderson_8 event_target:alderson_section = { set_name = "Habitable Hypersegment H" } }
# 	}
# }

# # Ecu
# alderson_disk_2_ecu = {
# 	entity = "giga_alderson_ecu_01_entity"
# 	construction_entity = "giga_alderson_ruined_center_01_entity"
# 	place_entity_on_planet_plane = yes
# 	portrait = "GFX_megastructure_alderson"
# 	upgrade_from = { alderson_disk_2 }

# 	outliner_trigger = {
# 		exists = owner
# 		NOT = { has_megastructure_flag = giga_outliner_hidden_by_@owner }
# 	}
	
# 	build_time = 3600
# 	resources = {
# 		category = giga_gigastructures
# 		cost = {
# 			sr_cultrobium = 60000 # Active Support
# 			minerals = 350000
# 			unity = @giga_giga_unity_cost
# 		}
# 		cost = {
# 			trigger = { country_uses_bio_ships = no }
# 			alloys = 120000
# 		}
# 		cost = {
# 			trigger = { country_uses_bio_ships = yes }
# 			alloys = 120000
# 			mult = 0.5
# 		}
# 		cost = {
# 			trigger = { country_uses_bio_ships = yes }
# 			food = 120000
# 			mult = @halved_alloy_to_food_cost_ratio
# 		}
# 	}

# 	potential = {
# 		has_gigastructures = yes
# 		NOT = { has_global_flag = alderson_disabled } 
# 		OR = {
# 			is_gestalt = no
# 			has_valid_civic = civic_machine_servitor
# 		}
# 	}
# 	possible = {
# 		from = {
# 			has_technology = giga_tech_alderson_disk
# 			has_ascension_perk = ap_slice_of_life
# 			has_ascension_perk = ap_arcology_project
# 		}
# 	}

# 	ai_weight = { factor = value:giga_ai_base_continue } # If we can build it, we will build it
# 	on_build_complete = {
# 		save_event_target_as = giga_system
# 		from = {
# 			country_event = { id = giga_dialog.2506 }	# Notification
# 			if = {
# 				limit = {
# 					NOR = {
# 						has_global_flag = giga_achievements_disabled
# 						has_country_flag = giga_achievement_94
# 					}
# 				}
# 				set_country_flag = giga_achievement_94
# 				set_timed_country_flag = { flag = giga_achievement_94_notification days = 30 }
# 				giga_achievement_sound = yes
# 			}
# 		}

# 		change_variable = { which = alderson_slices value = 1 }
# 		if = {
# 			limit = { check_variable = { which = alderson_slices value >= 8 } }
# 			from = { country_event = { id = giga_dialog.2507 } }			# Fully completed Alderson
# 			from = { remove_country_flag = giga_started_alderson }
# 			clear_variable = alderson_slices
# 		}

# 		spawn_planet = {
# 			class = "pc_alderson_slice_ecu"
# 			location = fromfrom
# 			size = 15
# 			init_effect = {
# 				set_name = "Alderson Slice"
# 				set_surveyed = { surveyed = yes surveyor = solar_system.owner }
# 				every_country = {
# 					limit = { has_communications = root.owner }
# 					prev = { set_surveyed = { surveyed = yes surveyor = prev } }
# 				}
# 				clear_blockers = yes
# 				save_event_target_as = alderson_section
# 				trigger_megastructure_icon = yes
# 				set_planet_flag = giga_alderson_ecu
# 				set_planet_flag = forbid_guillis_planet_modifiers
# 				set_planet_flag = megastructure
# 				set_planet_flag = colony_event			# Vanilla uses to prevent unwanted events on planets
# 				add_deposit = d_giga_job_size

# 				giga_start_ai_colony_if_safe = yes
# 				if = {
# 					limit = { solar_system.owner = { is_machine_empire = yes } }
# 					set_planet_entity = { picture = pc_ai entity = giga_alderson_machine_01_entity }
# 				}
# 				else_if = {
# 					limit = { solar_system.owner = { is_hive_empire = yes } }
# 					set_planet_entity = { picture = pc_infested entity = giga_alderson_hive_01_entity }
# 				}
# 			}
# 		}

# 		remove_megastructure = fromfrom
# 		# Name the segments
# 		if = {		limit = { NOT = { has_star_flag = giga_alderson_1 } } set_star_flag = giga_alderson_1 event_target:alderson_section = { set_name = "Hypersegment A" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_2 } } set_star_flag = giga_alderson_2 event_target:alderson_section = { set_name = "Hypersegment B" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_3 } } set_star_flag = giga_alderson_3 event_target:alderson_section = { set_name = "Hypersegment C" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_4 } } set_star_flag = giga_alderson_4 event_target:alderson_section = { set_name = "Hypersegment D" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_5 } } set_star_flag = giga_alderson_5 event_target:alderson_section = { set_name = "Hypersegment E" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_6 } } set_star_flag = giga_alderson_6 event_target:alderson_section = { set_name = "Hypersegment F" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_7 } } set_star_flag = giga_alderson_7 event_target:alderson_section = { set_name = "Hypersegment G" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_8 } } set_star_flag = giga_alderson_8 event_target:alderson_section = { set_name = "Hypersegment H" } }
# 	}
# }

# # hive
# alderson_disk_2_hive = {
# 	entity = "giga_alderson_hive_01_entity"
# 	construction_entity = "giga_alderson_ruined_center_01_entity"
# 	place_entity_on_planet_plane = yes
# 	portrait = "GFX_megastructure_alderson"
# 	upgrade_from = { alderson_disk_2 }

# 	outliner_trigger = {
# 		exists = owner
# 		NOT = { has_megastructure_flag = giga_outliner_hidden_by_@owner }
# 	}
	
# 	build_time = 3600
# 	resources = {
# 		category = giga_gigastructures
# 		cost = {
# 			sr_cultrobium = 60000 # Active Support
# 			minerals = 300000
# 			unity = @giga_giga_unity_cost
# 		}
# 		cost = {
# 			trigger = { country_uses_bio_ships = no }
# 			alloys = 120000
# 		}
# 		cost = {
# 			trigger = { country_uses_bio_ships = yes }
# 			alloys = 120000
# 			mult = 0.5
# 		}
# 		cost = {
# 			trigger = { country_uses_bio_ships = yes }
# 			food = 120000
# 			mult = @halved_alloy_to_food_cost_ratio
# 		}
# 	}

# 	potential = { 
# 		has_gigastructures = yes
# 		NOT = { has_global_flag = alderson_disabled } 
# 		is_hive_empire = yes
# 	}
# 	possible = {
# 		from = {
# 			has_technology = giga_tech_alderson_disk
# 			has_ascension_perk = ap_slice_of_life
# 		}
# 	}

# 	ai_weight = { factor = value:giga_ai_base_continue } # If we can build it, we will build it
# 	on_build_complete = {
# 		save_event_target_as = giga_system
# 		from = {
# 			country_event = { id = giga_dialog.25061 }	# Notification
# 			if = {
# 				limit = {
# 					NOR = {
# 						has_global_flag = giga_achievements_disabled
# 						has_country_flag = giga_achievement_94
# 					}
# 				}
# 				set_country_flag = giga_achievement_94
# 				set_timed_country_flag = { flag = giga_achievement_94_notification days = 30 }
# 				giga_achievement_sound = yes
# 			}
# 		}

# 		change_variable = { which = alderson_slices value = 1 }
# 		if = {
# 			limit = { check_variable = { which = alderson_slices value >= 8 } }
# 			from = { country_event = { id = giga_dialog.2507 } }			# Fully completed Alderson
# 			from = { remove_country_flag = giga_started_alderson }
# 			clear_variable = alderson_slices
# 		}

# 		spawn_planet = {
# 			class = "pc_alderson_slice_hive"
# 			location = fromfrom
# 			size = 15
# 			init_effect = {
# 				set_name = "Alderson Slice"
# 				set_surveyed = { surveyed = yes surveyor = solar_system.owner }
# 				every_country = {
# 					limit = { has_communications = root.owner }
# 					prev = { set_surveyed = { surveyed = yes surveyor = prev } }
# 				}
# 				clear_blockers = yes
# 				save_event_target_as = alderson_section
# 				trigger_megastructure_icon = yes
# 				set_planet_flag = giga_alderson_hive
# 				set_planet_flag = forbid_guillis_planet_modifiers
# 				set_planet_flag = megastructure
# 				set_planet_flag = colony_event			# Vanilla uses to prevent unwanted events on planets
# 				add_deposit = d_giga_job_size

# 				giga_start_ai_colony_if_safe = yes
# 				if = {
# 					limit = { solar_system.owner = { is_machine_empire = yes } }
# 					set_planet_entity = { picture = pc_ai entity = giga_alderson_machine_01_entity }
# 				}
# 				else_if = {
# 					limit = { solar_system.owner = { is_hive_empire = yes } }
# 					set_planet_entity = { picture = pc_infested entity = giga_alderson_hive_01_entity }
# 				}
# 			}
# 		}

# 		remove_megastructure = fromfrom
# 		# Name the segments
# 		if = {		limit = { NOT = { has_star_flag = giga_alderson_1 } } set_star_flag = giga_alderson_1 event_target:alderson_section = { set_name = "Hypersegment A" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_2 } } set_star_flag = giga_alderson_2 event_target:alderson_section = { set_name = "Hypersegment B" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_3 } } set_star_flag = giga_alderson_3 event_target:alderson_section = { set_name = "Hypersegment C" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_4 } } set_star_flag = giga_alderson_4 event_target:alderson_section = { set_name = "Hypersegment D" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_5 } } set_star_flag = giga_alderson_5 event_target:alderson_section = { set_name = "Hypersegment E" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_6 } } set_star_flag = giga_alderson_6 event_target:alderson_section = { set_name = "Hypersegment F" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_7 } } set_star_flag = giga_alderson_7 event_target:alderson_section = { set_name = "Hypersegment G" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_8 } } set_star_flag = giga_alderson_8 event_target:alderson_section = { set_name = "Hypersegment H" } }
# 	}
# }

# # machine
# alderson_disk_2_machine = {
# 	entity = "giga_alderson_machine_01_entity"
# 	construction_entity = "giga_alderson_ruined_center_01_entity"
# 	place_entity_on_planet_plane = yes
# 	portrait = "GFX_megastructure_alderson"
# 	upgrade_from = { alderson_disk_2 }

# 	outliner_trigger = {
# 		exists = owner
# 		NOT = { has_megastructure_flag = giga_outliner_hidden_by_@owner }
# 	}
	
# 	build_time = 3600
# 	resources = {
# 		category = giga_gigastructures
# 		cost = {
# 			sr_cultrobium = 60000 # Active Support
# 			minerals = 300000
# 			unity = @giga_giga_unity_cost
# 		}
# 		cost = {
# 			trigger = { country_uses_bio_ships = no }
# 			alloys = 120000
# 		}
# 		cost = {
# 			trigger = { country_uses_bio_ships = yes }
# 			alloys = 120000
# 			mult = 0.5
# 		}
# 		cost = {
# 			trigger = { country_uses_bio_ships = yes }
# 			food = 120000
# 			mult = @halved_alloy_to_food_cost_ratio
# 		}
# 	}

# 	potential = {
# 		has_gigastructures = yes
# 		NOT = { has_global_flag = alderson_disabled } 
# 		is_machine_empire = yes
# 	}
# 	possible = {
# 		from = {
# 			has_technology = giga_tech_alderson_disk
# 			has_ascension_perk = ap_slice_of_life
# 			has_ascension_perk = ap_machine_worlds
# 		}
# 	}

# 	ai_weight = { factor = value:giga_ai_base_continue } # If we can build it, we will build it
# 	on_build_complete = {
# 		save_event_target_as = giga_system
# 		from = {
# 			country_event = { id = giga_dialog.25062 }	# Notification
# 			if = {
# 				limit = {
# 					NOR = {
# 						has_global_flag = giga_achievements_disabled
# 						has_country_flag = giga_achievement_94
# 					}
# 				}
# 				set_country_flag = giga_achievement_94
# 				set_timed_country_flag = { flag = giga_achievement_94_notification days = 30 }
# 				giga_achievement_sound = yes
# 			}
# 		}

# 		change_variable = { which = alderson_slices value = 1 }
# 		if = {
# 			limit = { check_variable = { which = alderson_slices value >= 8 } }
# 			from = { country_event = { id = giga_dialog.2507 } }			# Fully completed Alderson
# 			from = { remove_country_flag = giga_started_alderson }
# 			clear_variable = alderson_slices
# 		}

# 		spawn_planet = {
# 			class = "pc_alderson_slice_machine"
# 			location = fromfrom
# 			size = 15
# 			init_effect = {
# 				set_name = "Alderson Slice"
# 				set_surveyed = { surveyed = yes surveyor = solar_system.owner }
# 				every_country = {
# 					limit = { has_communications = root.owner }
# 					prev = { set_surveyed = { surveyed = yes surveyor = prev } }
# 				}
# 				clear_blockers = yes
# 				save_event_target_as = alderson_section
# 				trigger_megastructure_icon = yes
# 				set_planet_flag = giga_alderson_machine
# 				set_planet_flag = forbid_guillis_planet_modifiers
# 				set_planet_flag = megastructure
# 				set_planet_flag = colony_event			# Vanilla uses to prevent unwanted events on planets
# 				add_deposit = d_giga_job_size

# 				giga_start_ai_colony_if_safe = yes
# 				if = {
# 					limit = { solar_system.owner = { is_machine_empire = yes } }
# 					set_planet_entity = { picture = pc_ai entity = giga_alderson_machine_01_entity }
# 				}
# 				else_if = {
# 					limit = { solar_system.owner = { is_hive_empire = yes } }
# 					set_planet_entity = { picture = pc_infested entity = giga_alderson_hive_01_entity }
# 				}
# 			}
# 		}

# 		remove_megastructure = fromfrom
# 		# Name the segments
# 		if = {		limit = { NOT = { has_star_flag = giga_alderson_1 } } set_star_flag = giga_alderson_1 event_target:alderson_section = { set_name = "Hypersegment A" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_2 } } set_star_flag = giga_alderson_2 event_target:alderson_section = { set_name = "Hypersegment B" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_3 } } set_star_flag = giga_alderson_3 event_target:alderson_section = { set_name = "Hypersegment C" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_4 } } set_star_flag = giga_alderson_4 event_target:alderson_section = { set_name = "Hypersegment D" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_5 } } set_star_flag = giga_alderson_5 event_target:alderson_section = { set_name = "Hypersegment E" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_6 } } set_star_flag = giga_alderson_6 event_target:alderson_section = { set_name = "Hypersegment F" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_7 } } set_star_flag = giga_alderson_7 event_target:alderson_section = { set_name = "Hypersegment G" } }
# 		else_if = {	limit = { NOT = { has_star_flag = giga_alderson_8 } } set_star_flag = giga_alderson_8 event_target:alderson_section = { set_name = "Hypersegment H" } }
# 	}
# }