############################################################################################################
#	AC mod - on actions
############################################################################################################

on_actions = {
	on_startup = {
		effect = {
			every_country = {
				limit = { is_ai = no }
				set_variable = { AC_build_amount = 1 }
				set_variable = { AC_build_cost = 0 }
			}
		}
	}

	#ROOT = nation being puppeted, FROM = overlord
	on_puppet = {
		effect = {
			if = {
				limit = {
					any_country = {
						ROOT = { has_country_flag = AC_assist_repair_target_by_@PREV }
					}
				}
				
				every_country = {
					limit = {
						ROOT = { has_country_flag = AC_assist_repair_target_by_@PREV }
					}

					ROOT = { 
						clr_country_flag = AC_assist_repair_target_by_@PREV 
						remove_ideas = AC_assist_repair_target_idea
					}
				}
			}
		}
	}

	#ROOT is new controller #FROM is old controller #FROM.FROM is state ID
	on_state_control_changed = {
		effect = {
			if = { #cancel project on controller change
				limit = {
					any_country = {
						FROM.FROM = { AC_Control_change_has_flag = yes }
						ROOT = { NOT = { tag = PREV } }
					}
				}

				every_country = {
					limit = {
						FROM.FROM = { is_owned_by = this AC_Control_change_has_flag = yes }
					}

					FROM.FROM = { AC_clear_state_flag = yes }
					### refund $$$
					
				}
			}
		}
	}
}