
planet_megastructure_restoration = {
	situation_log_category = planetmegas
	complete_icon_frame = GFX_situation_outcome_frame_green
	complete_icon = GFX_situation_outcome_positive
	fail_icon_frame = GFX_situation_outcome_frame_red
	fail_icon = GFX_situation_outcome_meh
	inline_script = situations/plnmg_sit_pics

	stages = {
		stage_1 = {
			icon = GFX_planet_mega_stage_2
			icon_background = GFX_situation_stage_frame_green
			custom_tooltip = planetmega_restoration_tooltip
			end = 600
		}
	}

	category = positive

	on_progress_complete = {
		custom_tooltip = planet_megastructure_restoration_tooltip
		hidden_effect = { situation_event = { id = planetmega.80 } }
	}
	on_start = { 
		situation_event = { id = planetmega.8 }
		owner = { save_event_target_as = situation_starter_country }
	}
	on_fail = {
		custom_tooltip = planet_megastructure_restoration_fail_tooltip
		hidden_effect = { situation_event = { id = situation.1180 } }
	}
	on_abort = {
		destroy_situation = this
	}
	modifier = {
	}
	on_monthly = {
		events = {
			planetmega.903
			planetmega.904
		}
	}
	approach = {#steady
		name = planetmega_approach_default
		icon = GFX_situation_tower_crane
		icon_background = GFX_situation_approach_bg_yellow
		default = yes
		on_select = {
			custom_tooltip = planet_megastructure_default_effect
		}
		ai_weight = {
			base = 100
		}
		resources = {
			category = situations
			upkeep = {
				energy = 25
				alloys = 15
				mult = value:sv_plnmg_sit_upkp_mult
			}
			upkeep = {
				trigger = { situation_is_plnmg_hive_type = yes }
				food = 20
				mult = value:sv_plnmg_sit_upkp_mult
			}
		}
	}
	approach = {#hurry
		name = planetmega_approach_encourage
		on_select = {
			custom_tooltip = planet_megastructure_encourage_effect
		}
		icon = GFX_situation_tower_crane
		icon_background = GFX_situation_approach_bg_green
		ai_weight = {
			base = 0
		}
		resources = {
			category = situations
			upkeep = {
				energy = 50
				alloys = 30
				mult = value:sv_plnmg_sit_upkp_mult
			}
			upkeep = {
				trigger = { situation_is_plnmg_hive_type = yes }
				food = 40
				mult = value:sv_plnmg_sit_upkp_mult
			}
		}
	}

	approach = {#pause
		name = planetmega_approach_pause
		on_select = {
			custom_tooltip = planet_megastructure_pause_effect
		}
		icon = GFX_situation_tower_crane
		icon_background = GFX_situation_approach_bg_red
		ai_weight = {
			base = 0
		}
		resources = {
			category = situations
			upkeep = { energy = 1 }
		}
	}

	approach = {#reverse
		name = planetmega_approach_cancel
		on_select = {
			situation_event = { id = planetmega.30 }
		}
		icon = GFX_situation_tower_crane
		icon_background = GFX_situation_approach_bg_red
		ai_weight = {
			base = 0
		}
		resources = {
			category = situations
			upkeep = {
				energy = 0 #3
				#mult = value:sv_plnmg_sit_upkp_mult
			}
		}
	}

	monthly_progress = {
		base = 0
		modifier = {
			add = 10
			desc = string_current_approach
			current_situation_approach = planetmega_approach_default
		}
		modifier = {
			add = 10
			desc = string_current_approach
			current_situation_approach = planetmega_approach_encourage
		}
		modifier = {
			subtract = 25
			desc = string_current_approach
			current_situation_approach = planetmega_approach_reverse
		}
		modifier = {
			mult = target.value:scripted_modifier_mult|MODIFIER|planet_clear_blocker_speed_mult|
			desc = MOD_PLANET_CLEAR_BLOCKER_SPEED_MULT
			target = { not = { check_modifier_value = { modifier = planet_clear_blocker_speed_mult value = 0 } } }
		}
		# modifier = {
		# 	factor = target.value:scripted_modifier_mult|MODIFIER|planet_clear_blocker_time_mult|
		# 	desc = MOD_PLANET_CLEAR_BLOCKER_TIME_MULT
		# 	target = { not = { check_modifier_value = { modifier = planet_clear_blocker_time_mult value = 0 }  } }
		# }
		modifier = {
			mult = 0
			desc = string_current_approach
			current_situation_approach = planetmega_approach_pause
		}
		modifier = {
			mult = 0
			desc = situation_locked_desc
			has_situation_flag = situation_locked
		}
	}

	abort_trigger = {
		OR = {
			NOT = { exists = target.owner }
			target.owner = { NOT = { is_same_value = root.owner } }
		}
	}
}

planet_megastructure_teardown = {
	situation_log_category = planetmegas
	complete_icon_frame = GFX_situation_outcome_frame_red
	complete_icon = GFX_situation_outcome_negative
	fail_icon_frame = GFX_situation_outcome_frame_green
	fail_icon = GFX_situation_outcome_positive
	category = neutral
	inline_script = situations/plnmg_sit_pics

	abort_trigger = {
		OR = {
			NOT = { exists = target.owner }
			target.owner = { NOT = { is_same_value = root.owner } }
		}
	}

	on_start = { situation_event = { id = planetmega.7 } }
	on_progress_complete = {
		custom_tooltip = planetmega_teardown_effect_tt
		hidden_effect = {
			sit_dismantle_plnmg_mega_pre_action = yes
			target = {
				fire_on_action = {
					on_action = on_planetmega_demolished
					scopes = { from = event_target:target_deposit }
				}
			}
			situation_event = { id = planetmega.99 days = 1 }
		}
	}
	on_abort = { destroy_situation = this }
	on_fail = { destroy_situation = this }

	stages = {
		stage_1 = {
			icon = GFX_planet_mega_stage_2
			icon_background = GFX_situation_stage_frame_green
			custom_tooltip = planetmega_restoration_tooltip
			end = 52
		}
	}

	approach = {
		name = planetmega_approach_default
		on_select = { custom_tooltip = planet_megastructure_reverse_effect }
		icon = GFX_situation_tower_crane
		icon_background = GFX_situation_approach_bg_green
		ai_weight = { base = 100 }
		resources = {
			category = situations
			produces = { minerals = 1 }
			upkeep = { energy = 5 }
		}
	}

	approach = { #reverse
		name = planetmega_approach_regret
		on_select = { custom_tooltip = planetmega_approach_regret_effect }
		icon = GFX_situation_tower_crane
		icon_background = GFX_situation_approach_bg_red
		ai_weight = { base = 0 }
		resources = {
			category = situations
			upkeep = { minerals = 1 }
		}
	}

	monthly_progress = {
		base = 1
		modifier = {
			mult = -2
			desc = string_current_approach
			current_situation_approach = planetmega_approach_regret
		}
		modifier = {
			mult = 0
			desc = situation_locked_desc
			has_situation_flag = situation_locked
		}
	}
}

