
########    ###    ##    ## ##    ##  ######  
   ##      ## ##   ###   ## ##   ##  ##    ## 
   ##     ##   ##  ####  ## ##  ##   ##       
   ##    ##     ## ## ## ## #####     ######  
   ##    ######### ##  #### ##  ##         ## 
   ##    ##     ## ##   ### ##   ##  ##    ## 
   ##    ##     ## ##    ## ##    ##  ######  

ENG_vickers_armstrong_eng_organization = {
	include = generic_medium_tank_organization
	icon = GFX_idea_vickers_armstrong_eng
 	allowed = {	
 		always = no
 	}

	visible = {
		IF = {
			limit = { FROM = { original_tag = ETH } }
			FROM = { has_completed_focus = ETH_invite_foreign_industrialists }
		}
	}
	
	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = ENG } }
			}
			FROM = { NOT = { has_war_with = ENG } }
		}

		IF = {
			limit = { 
				OR = { 
					FROM = { original_tag = BUL }
					FROM = { original_tag = ETH }
				}  
			}
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_country_flag = has_invited_vickers_mio_flag 
				}
			}
		}
		IF = {
			limit = { FROM = { original_tag = BUL } } 
			FROM = {
				OR = {
					is_subject = no
					is_subject_of = ENG
				}
				#is_in_faction_with = ENG
				NOT = { has_completed_focus = BUL_nationalization }
			}
		}
	}

	initial_trait = {
		organization_modifier = {
			military_industrial_organization_research_bonus = 0.05
		}
		equipment_bonus = {
			maximum_speed = 0.1
			reliability = 0.05
			armor_value = -0.1
		}
	}

	add_trait = { 
		token = ENG_mio_trait_expanded_turret_capacity
		name = ENG_mio_trait_expanded_turret_capacity
		icon = GFX_generic_mio_department_icon_tank_medium_tank_engine
		special_trait_background = yes

		position = { x=1 y=1 }
		relative_position_id = generic_mio_trait_all_round_cupola

		any_parent = { generic_mio_trait_all_round_cupola }
		limit_to_equipment_type = { mio_cat_eq_all_medium_tank }

		equipment_bonus = {
			reliability = 0.05
			armor_value = 0.05
			breakthrough = 0.05
		}
	}

	add_trait = { 
		token = ENG_mio_trait_expanded_production_facilities
		name = ENG_mio_trait_expanded_production_facilities
		icon = GFX_generic_mio_department_icon_tank_medium_tank_technology
		special_trait_background = yes

		position = { x=2 y=1 }
		relative_position_id = generic_mio_trait_simplified_turret_design

		all_parents = { generic_mio_trait_simplified_turret_design generic_mio_trait_armor_steel_working }
		production_bonus = {
			production_efficiency_cap_factor = 0.1
			production_efficiency_gain_factor = 0.1
		}
		
	}
}

ENG_vauxhall_organization = {
	include = generic_infantry_tank_organization
	icon = GFX_idea_vauxhall

 	allowed = {	
 		always = no
 	}

	visible = {
		IF = { 
			limit = {
				FROM = { original_tag = POL }
			}
			FROM = {
				has_country_flag = POL_vauxhall_motors
			}
		}
		IF = {
			limit = { FROM = { original_tag = ETH } }
			FROM = { has_completed_focus = ETH_invite_foreign_industrialists }
		}
	
	}

	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = ENG } }
			}
			FROM = { NOT = { has_war_with = ENG } }
		}

		IF = {
			limit = { 
				OR = { 
					FROM = { original_tag = BUL }
					FROM = { original_tag = ETH }
				}  
			}
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_country_flag = has_invited_vauxhall_mio_flag 
				}
			}
		}
		IF = {
			limit = { FROM = { original_tag = BUL } } 
			FROM = {
				OR = {
					is_subject = no
					is_subject_of = ENG
				}
				#is_in_faction_with = ENG
				NOT = { has_completed_focus = BUL_nationalization }
			}
		}
		IF = {
			limit = { FROM = { original_tag = BRA } }
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_completed_focus = BRA_invite_foreign_companies
					has_country_flag = has_vauxhall_mio_flag
				}
			}
		}
	}

	initial_trait = {
		equipment_bonus = {
			armor_value = 0.05
		}
	}
}


 ######  ##     ## #### ########   ######  
##    ## ##     ##  ##  ##     ## ##    ## 
##       ##     ##  ##  ##     ## ##       
 ######  #########  ##  ########   ######  
      ## ##     ##  ##  ##              ## 
##    ## ##     ##  ##  ##        ##    ## 
 ######  ##     ## #### ##         ######  



ENG_harland_wolff_organization = {
	include = generic_task_force_ship_organization
	icon = GFX_idea_harland_wolff
	
 	allowed = {	
 		always = no
 	}

	override_trait = {
		token = generic_mio_trait_underway_replenishment_equipment

		position = { x=1 y=0 }
		relative_position_id = generic_mio_trait_transom_stern
	}

	add_trait = { 
		token = ENG_mio_trait_flared_bow
		name = ENG_mio_trait_flared_bow
		icon = GFX_generic_mio_department_icon_ship_general_quality
		special_trait_background = yes

		position = { x=1 y=0 }
		relative_position_id = generic_mio_trait_underway_replenishment_equipment

		any_parent = { generic_mio_trait_splinter_protection }

		equipment_bonus = {
			naval_weather_penalty_factor = -0.1
		}
	}

	add_trait = { 
		token = generic_mio_trait_semi_armor_piercing_shells
		name = generic_mio_trait_semi_armor_piercing_shells
		icon = GFX_generic_mio_trait_icon_lg_attack
		special_trait_background = yes

		any_parent = { generic_mio_trait_secondary_fire_director_control }
		position = { x=0 y=1 }
		relative_position_id = generic_mio_trait_secondary_fire_director_control

		equipment_bonus = {
			lg_attack = 0.05
			lg_armor_piercing = 0.05
		}
	}
}


ENG_cammell_laird_organization = {
	include = generic_battle_line_ship_organization
	icon = GFX_idea_cammell_laird
	
 	allowed = {	
 		always = no
 	}

	available = {
		IF = {
			limit = {
				FROM = { NOT = { original_tag = ENG } }
			}
			FROM = { NOT = { has_war_with = ENG } }
		}
		IF = {
			limit = { FROM = { original_tag = BRA } }
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_completed_focus = BRA_invite_foreign_companies
					has_country_flag = has_cammell_laird_mio_flag
				}
			}
		}
	}
		


	override_trait = {
		token = generic_mio_trait_advanced_armor_design

		position = { x=1 y=0 }
		relative_position_id = generic_mio_trait_advanced_hydrodynamic_design
	}

	add_trait = { 
		token = ENG_mio_trait_flared_bow
		name = ENG_mio_trait_flared_bow
		icon = GFX_generic_mio_department_icon_ship_general_quality
		special_trait_background = yes

		position = { x=1 y=0 }
		relative_position_id = generic_mio_trait_advanced_armor_design

		any_parent = { generic_mio_trait_hardened_critical_components}
		
		equipment_bonus = {
			naval_weather_penalty_factor = -0.1
		}
	}

	add_trait = { 
		token = ENG_mio_trait_super_charges
		name = ENG_mio_trait_super_charges
		icon = GFX_generic_mio_department_icon_ship_capital_ship_weapons
		special_trait_background = yes

		position = { x=0 y=2 }
		relative_position_id = generic_mio_trait_semi_armor_piercing_shells

		any_parent = { generic_mio_trait_super_heavy_shells generic_mio_trait_semi_armor_piercing_shells generic_mio_trait_high_velocity_guns }

		limit_to_equipment_type = { capital_ship }

		equipment_bonus = {
			hg_armor_piercing = 0.05
			lg_armor_piercing = 0.05
		}
	}
}

ENG_yarrow_shipbuilders_organization = {
	include = generic_escort_ship_organization
	icon = GFX_idea_yarrow_shipbuilders
	
 	allowed = {	
 		always = no
 	}
	
	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = ENG } }
			}
			FROM = { NOT = { has_war_with = ENG } }
		}

		IF = {
			limit = { FROM = { original_tag = BUL } }
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_country_flag = has_invited_yarrow_mio_flag 
				}
			}
			FROM = {
				OR = {
					is_subject = no
					is_subject_of = ENG
				}
				#is_in_faction_with = ENG
				NOT = { has_completed_focus = BUL_nationalization }
			}
		}
	}
}

ENG_john_brown_organization = {
	include = generic_raider_ship_organization
	icon = GFX_idea_john_brown_company
 	allowed = {	
 		always = no
 	}

	visible = {
		IF = {
			limit = { FROM = { original_tag = ETH } }
			FROM = { has_completed_focus = ETH_invite_foreign_industrialists }
		}
	}
	
	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = ENG } }
			}
			FROM = { NOT = { has_war_with = ENG } }
		}

		IF = {
			limit = {
				FROM = { NOT  = { original_tag = ENG } }
			}
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_country_flag = has_invited_ENG_john_brown_organization_flag
				}
			}
		}
	}
}



########  ##          ###    ##    ## ########  ######  
##     ## ##         ## ##   ###   ## ##       ##    ## 
##     ## ##        ##   ##  ####  ## ##       ##       
########  ##       ##     ## ## ## ## ######    ######  
##        ##       ######### ##  #### ##             ## 
##        ##       ##     ## ##   ### ##       ##    ## 
##        ######## ##     ## ##    ## ########  ######  


ENG_supermarine_organization = {
	include = generic_high_agility_fighter_aircraft_organization
	icon = GFX_idea_supermarine
	
 	allowed = {	
 		always = no
 	}

	equipment_type = {
		mio_cat_eq_all_small_plane
		maritime_patrol_plane
	}	

	research_categories = {	
		mio_cat_all_light_fighter_and_modules 
#		mio_cat_all_naval_bomber_and_modules 
			#Could be used to allow Supermarine to research naval bombs, but this could overpower English fighter MIO trait gain early on.
	}

	override_trait = {
		token = generic_mio_trait_fuel_injection_engines
		
		position = { x=0 y=2 }
		relative_position_id = generic_mio_trait_bigger_engines
	}

	override_trait = {
		token = generic_mio_trait_high_octane_fuels
		
		position = { x=1 y=1 }
		relative_position_id = generic_mio_trait_bigger_engines
	}

	override_trait = {
		token = generic_mio_trait_subsidiary_suppliers
		
		position = { x=0 y=2 }
		relative_position_id = generic_mio_trait_fuel_injection_engines
	}

	add_trait = { 
		token = ENG_mio_trait_seaplane_origins
		name = ENG_mio_trait_seaplane_origins
		icon = GFX_generic_mio_trait_icon_detection
		special_trait_background = yes

		position = { x=2 y=0 }
		relative_position_id = generic_mio_trait_minimum_weapon_requirements

		#any_parent = { generic_mio_trait_super_heavy_shells generic_mio_trait_semi_armor_piercing_shells generic_mio_trait_high_velocity_guns }

		limit_to_equipment_type = { mio_cat_eq_all_small_plane mio_cat_eq_all_large_plane }

		equipment_bonus = {
			sub_detection = 0.05
			surface_detection = 0.05
			naval_strike_targetting = 0.1
		}
	}

	add_trait = { 
		token = ENG_mio_trait_elliptical_wings
		name = ENG_mio_trait_elliptical_wings
		icon = GFX_generic_mio_trait_icon_defense
		special_trait_background = yes

		position = { x=0 y=1 }
		relative_position_id = generic_mio_trait_cantilever_wing_structure

		any_parent = { generic_mio_trait_cantilever_wing_structure }

		equipment_bonus = {
			air_defence = 0.1	
		}
	}

	add_trait = { 
		token = ENG_mio_trait_supercharger
		name = ENG_mio_trait_supercharger
		icon = GFX_generic_mio_trait_icon_defense
		special_trait_background = yes

		position = { x=1 y=1 }
		relative_position_id = generic_mio_trait_fuel_injection_engines

		all_parents = { generic_mio_trait_fuel_injection_engines generic_mio_trait_high_octane_fuels }

		equipment_bonus = {
			air_defence = 0.1	
		}
	}
}

ENG_hawker_organization = {
	include = generic_cas_aircraft_organization
	icon = GFX_idea_hawker
 	allowed = {	
 		always = no
 	}
}

ENG_de_havilland_organization = {
	include = generic_medium_aircraft_organization
	icon = GFX_idea_de_havilland
 	allowed = {	
 		always = no
 	}
	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = ENG } }
			}
			FROM = { NOT = { has_war_with = ENG } }
		}

		if = {
			limit = {
				FROM = { tag = NOR }
			}
			FROM = {
				has_completed_focus = NOR_invite_transnational_manufacturers
			}
		}
	}
}

ENG_fairey_aviation_organization = {
	include = generic_naval_aircraft_organization
	icon = GFX_idea_fairey_aviation
	
 	allowed = {	
 		always = no
 	}

	visible = {
		IF = {
			limit = { FROM = { original_tag = ETH } }
			FROM = { has_completed_focus = ETH_invite_foreign_industrialists }
		}
	}
	
	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = ENG } }
			}
			FROM = { NOT = { has_war_with = ENG } }
		}

		IF = {
			limit = { FROM = { original_tag = BUL } }
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_country_flag = has_invited_fairey_aviation_mio_flag 
				}
			}
			FROM = {
				OR = {
					is_subject = no
					is_subject_of = ENG
				}
				#is_in_faction_with = ENG
				NOT = { has_completed_focus = BUL_nationalization }
			}
		}
		ELSE_IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_country_flag = has_invited_fairey_aviation_mio_flag
				}
			}
		}
	}
}

ENG_avro_organization = {
	include = generic_heavy_aircraft_organization
	icon = GFX_idea_avro
 	allowed = {	
 		always = no
 	}
	available = {
		IF = {
			limit = {
				FROM = { NOT = { original_tag = ENG } }
			}
			FROM = { NOT = { has_war_with = ENG } }
		}
		IF = {
			limit = { FROM = { original_tag = BRA } }
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_completed_focus = BRA_invite_foreign_companies
					has_country_flag = has_avro_mio_flag
				}
			}
		}
	}
}




##     ##    ###    ######## ######## ########  #### ######## ##       
###   ###   ## ##      ##    ##       ##     ##  ##  ##       ##       
#### ####  ##   ##     ##    ##       ##     ##  ##  ##       ##       
## ### ## ##     ##    ##    ######   ########   ##  ######   ##       
##     ## #########    ##    ##       ##   ##    ##  ##       ##       
##     ## ##     ##    ##    ##       ##    ##   ##  ##       ##       
##     ## ##     ##    ##    ######## ##     ## #### ######## ######## 

ENG_rsaf_enfield_organization = {
	include = generic_infantry_equipment_organization
	icon = GFX_idea_rsaf_enfield
 	allowed = {	
 		always = no
 	}

	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = ENG } }
			}
			FROM = { NOT = { has_war_with = ENG } }
		}

		if = {
			limit = {
				FROM = {
					OR = {
						original_TAG = LAT
						original_TAG = LIT
						original_TAG = EST
					}
				}
			}
			FROM = {
				has_completed_focus = BALTIC_british_designers
			}
		}
	}

	override_trait = { 
		token = generic_mio_trait_anti_vechicle_land_mines	
		name = ENG_mio_trait_piat	
		icon = GFX_generic_mio_trait_icon_hard_attack
		special_trait_background = yes

		equipment_bonus = {
			hard_attack = 0.05
			defense = 0.05
			breakthrough = 0.1
		}
	}

	add_trait = { 
		token = ENG_mio_trait_sten_submachine_guns	
		name = ENG_mio_trait_sten_submachine_guns	
		icon = GFX_generic_mio_trait_icon_ap_attack
		special_trait_background = yes

		position = { x=1 y=1 }
		relative_position_id = generic_mio_trait_drum_pattern_sights

		any_parent = { generic_mio_trait_reinforced_stocks generic_mio_trait_drum_pattern_sights }

		equipment_bonus = {
			reliability = 0.05
			soft_attack = 0.03
			ap_attack = 0.05
		}
	}
}

ENG_vauxhall_automotive_organization = {
	include = generic_motorized_mechanized_organization
	icon = GFX_idea_vauxhall
	name = ENG_vauxhall_organization
	
 	allowed = {	
 		always = no
 	}
	
	visible = {
		IF = { 
			limit = {
				FROM = { original_tag = POL }
			}
			FROM = {
				has_country_flag = POL_vauxhall_motors
			}
		}
		IF = {
			limit = { FROM = { original_tag = ETH } }
			FROM = { has_completed_focus = ETH_invite_foreign_industrialists }
		}	
	}
	
	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = ENG } }
			}
			FROM = { NOT = { has_war_with = ENG } }
		}

		IF = {
			limit = {
				OR = { 
					FROM = { original_tag = BUL }
					FROM = { original_tag = ETH }
				}  
			}
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_country_flag = has_invited_vauxhall_mio_flag 
				}
			}
		}
		IF = {
			limit = { FROM = { original_tag = BUL } }
			FROM = {
				OR = {
					is_subject = no
					is_subject_of = ENG
				}
				#is_in_faction_with = ENG
				NOT = { has_completed_focus = BUL_nationalization }
			}
		}
		IF = {
			limit = { FROM = { original_tag = ROM } }
			FROM = { has_country_flag = ENG_mot_chosen }
		}	
	}
	
	initial_trait = {
		equipment_bonus = {
			maximum_speed = 0.05
		}
	}
}

ENG_royal_arsenal_organization = {
	include = generic_artillery_organization
	icon = GFX_idea_royal_arsenal
 	allowed = {	
 		always = no
 	}

	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = ENG } }
			}
			FROM = { NOT = { has_war_with = ENG } }
		}

		if = {
			limit = {
				FROM = {
					OR = {
						original_TAG = LAT
						original_TAG = LIT
						original_TAG = EST
					}
				}
			}
			FROM = {
				has_completed_focus = BALTIC_british_designers
			}
		}
	}
}
