
# trade_action_plnmg_eg_gateway = {
# 	fire_and_forget = yes
#
# 	potential = {
# 		has_global_flag = planetmega_trade_act_test
# 		is_nomadic = no
# 		from = {
# 			is_ai = no
# 			is_nomadic = yes
# 			has_technology = tech_planetmega_transfer
# 		}
# 	}
#
# 	on_traded_effect = {
# 		hidden_effect = { from = { set_country_flag = can_build_plnmg_eggw_in_@root } }
# 	}
#
# 	ai_weight = { weight = 50 }
# }

trade_action_plnmg_fe_technology = {
	fire_and_forget = yes
	potential = {
		or = {
			is_fallen_empire = yes
			has_ascension_perk = ap_cosmogenesis
		}
		from = {
			is_ai = no
			has_technology = tech_planetmega_improved
		}
	}
	possible = {
		not = { is_at_war_with = from }
		from = {
			or = {
				has_ascension_perk = ap_enigmatic_engineering
				has_ascension_perk = ap_technological_ascendancy
				has_ascension_perk = ap_cosmogenesis
			}
		}
	}

	on_traded_effect = {
		hidden_effect = {
			from = {
				country_event = {
					id = planetmega.215
					scopes = { from = prev }
				}
			}
		}
	}

	ai_weight = {
		weight = 350
		modifier = {
			factor = 2
			is_fallen_empire = yes
		}
		modifier = {
			factor = 0.5
			has_subject = from
		}
		modifier = {
			factor = 0.1
			or = {
				is_custodial_to = from
				is_loyal_to = from
				is_friendly_to = from
			}
		}
		modifier = {
			factor = 0
			has_overlord = from
		}
	}
}

# trade_action_plnmg_dyson_gun = { #need a overhaul in 4.5
# 	fire_and_forget = no
# 	potential = {
# 		always = no
# 		# has_dyson_gun = yes
# 		# from = {
# 		# 	is_ai = no
# 		# 	has_technology = tech_ground_megastructure
# 		# }
# 	}
# 	possible = {
# 		not = { is_at_war_with = from }
# 		from = {
# 			or = {
# 				has_ascension_perk = ap_enigmatic_engineering
# 				has_ascension_perk = ap_cosmogenesis
# 			}
# 		}
# 	}
#
# 	on_traded_effect = {
# 		random_owned_megastructure = {
# 			limit = { is_dyson_gun = yes }
# 			set_owner = from
# 			set_timed_megastructure_flag = { flag = is_rented_out months = 6 }
# 		}
# 	}
# 	on_deal_ended_sender_effect = {
# 		hidden_effect = {
# 			every_system_within_border = {
# 				every_system_megastructure = {
# 					limit = {
# 						is_dyson_gun = yes
# 						not = { has_megastructure_flag = is_rented_out }
# 						owner? = { not = { is_same_value = root } }
# 					}
# 					set_owner = root
# 				}
# 			}
# 		}
# 	}
#
# 	ai_weight = {
# 		weight = 150
# 		modifier = {
# 			factor = 100
# 			is_fallen_empire = yes
# 		}
# 		modifier = {
# 			factor = 0.5
# 			has_subject = from
# 		}
# 		modifier = {
# 			factor = 0.1
# 			or = {
# 				is_custodial_to = from
# 				is_loyal_to = from
# 				is_friendly_to = from
# 			}
# 		}
# 		modifier = {
# 			factor = 0
# 			has_overlord = from
# 		}
# 	}
# }

#event_target:global_event_country = { set_variable = { which = trade_action_plnmg_test_weight value = 10 } }
# trade_action_plnmg_test = {
# 	fire_and_forget = yes
# 	potential = { has_global_flag = trade_action_plnmg_test }
# 	ai_weight = {
# 		weight = 0
# 		modifier = {
# 			add = event_target:global_event_country.trade_action_plnmg_test_weight
# 			event_target:global_event_country = { is_variable_set = trade_action_plnmg_test_weight }
# 		}
# 	}
# }
