situation_stellar_extraction = {
	picture = GFX_evt_dyson_sphere
	category = positive
	complete_icon = GFX_situation_outcome_unknown
	complete_icon_frame = GFX_situation_outcome_frame_green

	start_value = 0
	initial_progress = 100

	on_start = {
		situation_event = {
			id = stellar_manip_utility.4
		}
	}

	on_monthly = {
		events = {
			stellar_manip_utility.6
		}
	}

	on_progress_complete = {
		target = {
			planet_event = {
				id = stellar_manip_utility.2
			}
		}
	}

	on_abort = {
		stellar_manip_clean_up_extraction_megas = yes
	}

	abort_trigger = {
		NAND = {
			exists = owner
			exists = target
			target = {
				stellar_manip_is_valid_star = yes
				exists = space_owner
				space_owner = {
					is_same_empire = prevprev.owner
				}
			}
		}
	}

	stages = {
		stellarm_manip_stage = {
			icon = GFX_situation_stage_1
			icon_background = GFX_situation_stage_frame_green
			end = 200
		}
	}

	approach = {
		name = approach_abort_stellar_manipulation
		icon = GFX_situation_approach_this_is_fine
		icon_background = GFX_situation_approach_bg_red

		on_select = {
			custom_tooltip = approach_abort_stellar_manipulation_tooltip
		}

		resources = {
			category = situations
		}

		ai_weight = {
			base = 0
			modifier = {
				owner = {
					has_deficit = energy
				}
				add = 75
			}
		}
	}

	approach = {
		name = approach_stellar_manip_harvest_pause
		icon = GFX_situation_approach_balance_sheet
		icon_background = GFX_situation_approach_bg_yellow
		on_select = {
			custom_tooltip = situation_pause_harvest_approach_tooltip
		}

		resources = {
			category = situations
			upkeep = { sr_stellar_plasma = 0 }
		}
	}

	approach = {
		name = approach_stellarm_standard
		icon = GFX_situation_approach_balance_sheet
		icon_background = GFX_situation_approach_bg_green
		default = yes
		allow = {
			custom_tooltip = {
				fail_text = situation_no_energy_for_manipulation
				NOR = {
					owner = { has_actual_deficit = { RESOURCE = energy } }
					owner = { resource_stockpile_compare = { RESOURCE = energy VALUE <= 0 }}
				}
			}
		}


		on_select = {
			custom_tooltip = situation_standard_extraction_approach_tooltip
		}

		resources = {
			category = situations

			produces = {
				trigger = { target = { giga_is_o_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_o_star
			}
			produces = {
				trigger = { target = { giga_is_b_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_b_star
			}

			produces = {
				trigger = { target = { giga_is_m_giant_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_m_giant_star
			}

			produces = {
				trigger = { target = { giga_is_a_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_a_star
			}

			produces = {
				trigger = { target = { giga_is_f_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_f_star
			}

			produces = {
				trigger = { target = { giga_is_g_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_g_star
			}

			produces = {
				trigger = { target = { giga_is_k_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_k_star
			}

			produces = {
				trigger = { target = { giga_is_m_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_m_star
			}
		}

		ai_weight = {
			base = 8
		}
	}

	monthly_progress = {
		base = 0
		modifier = {
			add = 2.0
			desc = STRING_APPROACH_STELLARM_STANDARD
			current_situation_approach = approach_stellarm_standard
		}

		modifier = {
			divide = 2
			desc = STRING_STELLARM_IS_O_STAR
			target = {
				giga_is_o_star_for_megas = yes
			}
		}

		modifier = {
			multiply = 0
			desc = energy_deficit
			owner = {
				has_actual_deficit = {
					RESOURCE = energy
				}

			}
		}
	}
}

situation_stellar_infusion = {
	picture = GFX_evt_dyson_sphere
	category = positive
	complete_icon = GFX_situation_outcome_unknown
	complete_icon_frame = GFX_situation_outcome_frame_green

	start_value = 0
	initial_progress = 100

	on_start = {
		situation_event = {
			id = stellar_manip_utility.5
		}
	}

	on_monthly = {
		events = {
			stellar_manip_utility.7
		}
	}

	on_progress_complete = {
		target = {
			planet_event = {
				id = stellar_manip_utility.3
			}
		}
	}

	on_abort = {
		stellar_manip_clean_up_infusion_megas = yes
	}

	abort_trigger = {
		NAND = {
			exists = owner
			exists = target
			target = {
				stellar_manip_is_valid_star = yes
				exists = space_owner
				space_owner = {
					is_same_empire = prevprev.owner
				}
			}
		}
	}

	stages = {
		stellarm_manip_stage = {
			icon = GFX_situation_stage_1
			icon_background = GFX_situation_stage_frame_green
			end = 200
		}
	}
	approach = {
		name = approach_abort_stellar_manipulation
		icon = GFX_situation_approach_this_is_fine
		icon_background = GFX_situation_approach_bg_red
		on_select = {
			custom_tooltip = approach_abort_stellar_manipulation_tooltip
		}
		resources = {
			category = situations
		}
		ai_weight = {
			base = 0
			modifier = {
				owner = {
					has_deficit = energy
				}
				add = 75
			}
			modifier = {
				owner = {
					has_deficit = sr_stellar_plasma
				}
				add = 75
			}
		}
	}

	approach = {
		name = approach_stellarm_pause
		icon = GFX_situation_approach_balance_sheet
		icon_background = GFX_situation_approach_bg_yellow
		on_select = {
			custom_tooltip = situation_pause_infusion_approach_tooltip
		}

		resources = {
			category = situations
			upkeep = { sr_stellar_plasma = 0 }
		}
	}

	approach = {
		name = approach_stellarm_standard_infusion
		icon = GFX_situation_approach_this_is_fine
		icon_background = GFX_situation_approach_bg_green
		default = yes
		allow = {
			custom_tooltip = {
				fail_text = situation_no_plasma_to_infuse
				NOR = {
					owner = { has_actual_deficit = { RESOURCE = sr_stellar_plasma } }
					owner = { resource_stockpile_compare = { RESOURCE = sr_stellar_plasma VALUE <= 0 }}
				}
			}
			custom_tooltip = {
				fail_text = situation_no_energy_for_manipulation
				NOR = {
					owner = { has_actual_deficit = { RESOURCE = energy } }
					owner = { resource_stockpile_compare = { RESOURCE = energy VALUE <= 0 }}
				}
			}
		}

		on_select = {
			custom_tooltip = situation_standard_infusion_approach_tooltip
		}

		resources = {
			category = situations
			upkeep = {
				trigger = { target = { giga_is_b_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_b_star
			}

			upkeep = {
				trigger = { target = { giga_is_m_giant_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_m_giant_star
			}

			upkeep = {
				trigger = { target = { giga_is_a_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_a_star
			}

			upkeep = {
				trigger = { target = { giga_is_f_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_f_star
			}

			upkeep = {
				trigger = { target = { giga_is_g_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_g_star
			}

			upkeep = {
				trigger = { target = { giga_is_k_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_k_star
			}
			upkeep = {
				trigger = { target = { giga_is_m_star_for_megas = yes } }
				sr_stellar_plasma = @stellar_manip_manipulator_m_star
			}
		}
		ai_weight = {
			base = 8
		}
	}

	monthly_progress = {
		base = 0
		modifier = {
			add = 2.0
			desc = STRING_APPROACH_STELLARM_STANDARD_INFUSION
			current_situation_approach = approach_stellarm_standard_infusion
		}

		modifier = {
			divide = 2
			desc = STRING_STELLARM_IS_B_STAR
			target = {
				is_planet_class = pc_b_star
			}
		}

		modifier = {
			multiply = 0
			desc = energy_deficit
			owner = {
				has_actual_deficit = {
					RESOURCE = energy
				}

			}
		}
	}
}
