# Hot-Swap Augments
#
# Scope: country. Called from the edict's effect when a frame is fitted.
#   apb_augment_recal (180 days)  the frame gives nothing while this is set
#   apb_augment_lock  (720 days)  no frame can be fitted while this is set
#   apb_augment_worn_<frame>      Worn In; all three are cleared by every fitting
#   apb_augment_start             the day of the latest fitting. The Worn In event
#                                 (apb_augments.2) compares it with the current day,
#                                 so a timer left from an earlier fitting does nothing.
apb_augments_fit_frame = {
	remove_country_flag = apb_augment_worn_labour
	remove_country_flag = apb_augment_worn_combat
	remove_country_flag = apb_augment_worn_research
	set_timed_country_flag = {
		flag = apb_augment_recal
		days = 180
	}
	set_timed_country_flag = {
		flag = apb_augment_lock
		days = 720
	}
	set_variable = {
		which = apb_augment_start
		value = trigger:days_passed
	}
	country_event = {
		id = apb_augments.2
		days = 3600
	}
}

# Scope: country. The AI frames are plain modifiers: drop both.
apb_augments_clear_ai_frames = {
	if = {
		limit = { has_modifier = apb_augments_ai_labour }
		remove_modifier = apb_augments_ai_labour
	}
	if = {
		limit = { has_modifier = apb_augments_ai_combat }
		remove_modifier = apb_augments_ai_combat
	}
}
