namespace = est_subminds

#Subminds 3, edict bonus for sector planets
country_event = {
	id = est_subminds.3
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {	
		Or = {
			has_active_tradition = tr_est_subminds_3
			has_active_tradition = tr_est_subminds_3_machines
		}
	}
	
	immediate = {
		if = {
			limit = {
				has_policy_flag = policy_flag_est_subminds_3_energy
			}
			every_owned_planet = {
				if = {
					limit = {
						est_is_core_world = no						
					}
					if = {
						limit = {
							Not = {
								has_modifier = mod_est_subminds_3_energy
							}
						}
						add_modifier = {
							modifier = "mod_est_subminds_3_energy"							
							days = -1
						}
					}
				}
				else = {
					if = {
						limit = {
							has_modifier = mod_est_subminds_3_energy
						}
						remove_modifier = "mod_est_subminds_3_energy"		
					}
				}
			}
		}
		if = {
			limit = {
				has_policy_flag = policy_flag_est_subminds_3_food
			}
			every_owned_planet = {
				if = {
					limit = {
						est_is_core_world = no						
					}
					if = {
						limit = {
							Not = {
								has_modifier = mod_est_subminds_3_food
							}
						}
						add_modifier = {
							modifier = "mod_est_subminds_3_food"							
							days = -1
						}
					}
				}
				else = {
					if = {
						limit = {
							has_modifier = mod_est_subminds_3_food
						}
						remove_modifier = "mod_est_subminds_3_food"		
					}
				}
			}
		}
		if = {
			limit = {
				has_policy_flag = policy_flag_est_subminds_3_minerals
			}
			every_owned_planet = {
				if = {
					limit = {
						est_is_core_world = no				
					}
					if = {
						limit = {
							Not = {
								has_modifier = mod_est_subminds_3_minerals
							}
						}
						add_modifier = {
							modifier = "mod_est_subminds_3_minerals"							
							days = -1
						}
					}
				}
				else = {
					if = {
						limit = {
							has_modifier = mod_est_subminds_3_minerals
						}
						remove_modifier = "mod_est_subminds_3_minerals"		
					}
				}
			}
		}
		if = {
			limit = {
				has_policy_flag = policy_flag_est_subminds_3_research
			}
			every_owned_planet = {
				if = {
					limit = {
						est_is_core_world = no						
					}
					if = {
						limit = {
							Not = {
								has_modifier = mod_est_subminds_3_research
							}
						}
						add_modifier = {
							modifier = "mod_est_subminds_3_research"							
							days = -1
						}
					}
				}
				else = {
					if = {
						limit = {
							has_modifier = mod_est_subminds_3_research
						}
						remove_modifier = "mod_est_subminds_3_research"		
					}
				}
			}
		}
		if = {
			limit = {
				has_policy_flag = policy_flag_est_subminds_3_unity
			}
			every_owned_planet = {
				if = {
					limit = {
						est_is_core_world = no			
					}
					if = {
						limit = {
							Not = {
								has_modifier = mod_est_subminds_3_unity
							}
						}
						add_modifier = {
							modifier = "mod_est_subminds_3_unity"							
							days = -1
						}
					}
				}
				else = {
					if = {
						limit = {
							has_modifier = mod_est_subminds_3_unity
						}
						remove_modifier = "mod_est_subminds_3_unity"		
					}
				}
			}
		}
	}
}