# Prevent certain events from ever happening
disable_events = {
	FRA = {
		if = {
			limit = {
				is_ai = yes # Exclude other player-controlled nations that might be working with Germany
			}
			country_event = { id = ragnarok.91 } # Disable French non-intervention in Spain decisions
		}
	}
	GER = { set_country_flag = FRA_non_intervention_refused } # Ensure Germany never gets asked

	MEX = {
		if = {
			limit = {
				is_ai = yes # Exclude other player-controlled nations that might be working with Germany
			}
			set_global_flag = flag_second_mexican_civil_war
		}
	}
}

# All countries in the Allies join France in declaring war on Germany
all_allies_join_war_against_germany = {
	every_country = {
		limit = {
			is_in_faction_with = ENG
			NOT = { has_war_with = GER }
		}

		add_to_war = { targeted_alliance = FRA enemy = GER hostility_reason = ally }
	}
}

# Prevents rebel countries popping up during the war
resistance_disabled = {
	every_owned_state = {
		limit = {
			has_resistance = yes
		}

		add_resistance = -100
		force_disable_resistance = THIS
	}
}

# Move factories and building slots out of Burgenland if placed there by a national focus [1937 only]
relocate_burgenland_factories = {
	move_burgenland_factory = yes
	move_burgenland_factory = yes
	move_burgenland_factory = yes
	move_burgenland_factory = yes
	move_burgenland_factory = yes
	
	move_burgenland_guild_slots = yes
}

# Move factories out of Burgenland
move_burgenland_factory = {
	if = {
		limit = {
			975 = { # Burgenland
				arms_factory > 0
			}
		}
		
		975 = { # Burgenland
			remove_building = {
				type = arms_factory
				level = 1
			}
			add_extra_state_shared_building_slots = -1
		}
		153 = { # Tyrol
			add_extra_state_shared_building_slots = 1
			add_building_construction = {
				type = arms_factory
				level = 1
				instant_build = yes
			}
		}
	}
	
	if = {
		limit = {
			975 = { # Burgenland
				industrial_complex > 1
			}
		}
		
		975 = { # Burgenland
			remove_building = {
				type = industrial_complex
				level = 1
			}
			add_extra_state_shared_building_slots = -1
		}
		153 = { # Tyrol
			add_extra_state_shared_building_slots = 1
			add_building_construction = {
				type = industrial_complex
				level = 1
				instant_build = yes
			}
		}
	}
}

# Move extra slots out of Burgenland
move_burgenland_guild_slots = {
	if = {
		limit = {
			975 = { # Burgenland
				has_state_flag = AUS_construction_guilds_building_slot_added_flag
			}
		}
		
		975 = { # Burgenland
			add_extra_state_shared_building_slots = -2
			clr_state_flag = AUS_construction_guilds_building_slot_added_flag
		}			
		AUS = {
			random_owned_controlled_state = {
				limit = {
					is_core_of = AUS
					NOT = { state = 975 } # Burgenland
					NOT = { state = 4 } # Lower Austria
					NOT = {	has_state_flag = AUS_construction_guilds_building_slot_added_flag }
				}
				add_extra_state_shared_building_slots = 2
				set_state_flag = AUS_construction_guilds_building_slot_added_flag
			}
		}
	}
}

# Move factories out of East Prussia if placed there by a national focus [1937 only]
relocate_east_prussia_factories = {
	move_konigsberg_factory = yes
	move_konigsberg_factory = yes
	move_konigsberg_factory = yes
	move_konigsberg_factory = yes
	move_konigsberg_factory = yes
	
	move_ermland_masuren_factory = yes
	move_ermland_masuren_factory = yes
	move_ermland_masuren_factory = yes
	move_ermland_masuren_factory = yes
	move_ermland_masuren_factory = yes
}

# Move factories out of Königsberg if placed there by a national focus
move_konigsberg_factory = {
	if = {
		limit = {
			763 = { # Königsberg
				arms_factory > 1
			}
		}
		
		763 = { # Königsberg
			remove_building = {
				type = arms_factory
				level = 1
			}
			add_extra_state_shared_building_slots = -1
		}
		53 = { # Niederbayern
			add_extra_state_shared_building_slots = 1
			add_building_construction = {
				type = arms_factory
				level = 1
				instant_build = yes
			}
		}
	}
	
	if = {
		limit = {
			763 = { # Königsberg
				industrial_complex > 2
			}
		}
		
		763 = { # Königsberg
			remove_building = {
				type = industrial_complex
				level = 1
			}
			add_extra_state_shared_building_slots = -1
		}
		53 = { # Niederbayern
			add_extra_state_shared_building_slots = 1
			add_building_construction = {
				type = industrial_complex
				level = 1
				instant_build = yes
			}
		}
	}
}

# Move factories out of Ermland-Masuren if placed there by a national focus
move_ermland_masuren_factory = {
	if = {
		limit = {
			5 = { # Ermland-Masuren
				arms_factory > 0
			}
		}
		
		5 = { # Ermland-Masuren
			remove_building = {
				type = arms_factory
				level = 1
			}
			add_extra_state_shared_building_slots = -1
		}
		63 = { # Hinterpommern
			add_extra_state_shared_building_slots = 1
			add_building_construction = {
				type = arms_factory
				level = 1
				instant_build = yes
			}
		}
	}
	
	if = {
		limit = {
			5 = { # Ermland-Masuren
				industrial_complex > 2
			}
		}
		
		5 = { # Ermland-Masuren
			remove_building = {
				type = industrial_complex
				level = 1
			}
			add_extra_state_shared_building_slots = -1
		}
		63 = { # Hinterpommern
			add_extra_state_shared_building_slots = 1
			add_building_construction = {
				type = industrial_complex
				level = 1
				instant_build = yes
			}
		}
	}
}
