#Unlisted on_actions by haveabeard
#http://forum.paradoxplaza.com/forum/index.php?threads/list-of-currently-hardcoded-features-mechanics-etc-in-hoi4.957265/page-25#post-22275603
#on_military_access
#on_offer_military_access
#on_improve_relation
#on_guarantee
#on_non_aggression_pact
#on_call_allies
#on_join_allies
#on_declare_war
#on_create_faction
#on_join_faction
#on_offer_join_faction
#on_peace_proposal
#on_add_wargoal
#on_lend_lease
#on_incoming_lend_lease
#on_send_volunteers
#on_send_expeditionary_force
#on_return_expeditionary_forces
#on_request_expeditionary_forces
#on_generate_wargoal
#on_boost_party_popularity
#on_stage_coup
#on_leave_faction
#on_dismantle_faction
#on_ask_for_state_control
#on_give_state_control
#on_reduce_autonomy
#on_increase_autonomy

on_actions = {
	
	#########################################################
	### STRATEGIES FOR AI DEBT HANLDING AND UNIT BUILDING ###
	#########################################################
	# country
	on_send_volunteers = {
		effect = {
			ROOT = {
				update_AI_NO_WANT_DEBT = yes
				set_variable = { var = AI_VOLUNTEERS value = 1 }
			}
		}
	}
	
	on_return_volunteers = {
		effect = {
			ROOT = {
				update_AI_NO_WANT_DEBT = yes
				update_military_rate = yes
				set_variable = { var = AI_VOLUNTEERS value = 0 }				
			}	
		}
	}

	on_join_allies = {
		effect = {
			every_country = { update_AI_NO_WANT_DEBT = yes }
		}
	}
	
	# During justifying wargoals
	# triggered daily, so make sure there is a sink somewhere not firing events
	# country, FROM = target nation
	on_generate_wargoal = {
		effect = {
			every_country = { ai_update_build_units = yes }

		}
	}
	on_add_wargoal = {
		effect = {
			every_country = { ai_update_build_units = yes }
		}
	}

	#FROM is the one that joins the faction
	on_create_faction = {
		effect = {
			every_country = { ai_update_build_units = yes }
			every_country = { update_AI_NO_WANT_DEBT = yes }
		}
	}
	
	#FROM is faction leader on join faction requests.
	on_join_faction = {
		effect = {
			every_country = { ai_update_build_units = yes }
			every_country = { update_AI_NO_WANT_DEBT = yes }
		}
	}

	# ROOT is capitulated country, FROM is winner
	on_capitulation = {
		effect = {
			every_country = { ai_update_build_units = yes }
		}
	}

	#FROM is war target
	on_declare_war = {
		effect = {
			hidden_effect = {
				every_country = { ai_update_build_units = yes }
				every_country = { update_AI_NO_WANT_DEBT = yes }
			}
		}
	}
	
	# When a new faction is formed
	on_faction_formed = {
		effect = {
			every_country = { ai_update_build_units = yes }
		}
	}

	on_coup_succeeded = {
		effect = {
			every_country = { ai_update_build_units = yes }
		}
	}

	#ROOT is winner #FROM gets annexed
	on_civil_war_end = {
		effect = {
			every_country = { ai_update_build_units = yes }
			every_country = { update_AI_NO_WANT_DEBT = yes }
		}
	}

}
