﻿# Arrival detection: as the Sasanian adventurer passes through the old provinces, each dormant
# house rallies to his camp only when he reaches ITS ancestral seat.

# Fires in every province along a travel route (camp moves included), so passing THROUGH a
# homeland is enough. Keep the trigger cheap: the dynasty check filters out almost everyone.
on_travel_plan_movement = {
	on_actions = { he_check_house_arrivals }
}
# final destination reached (or travel completed through script)
on_travel_plan_complete = {
	on_actions = { he_check_house_arrivals }
}
# debug "move domicile" interaction
on_travel_relocation_end = {
	on_actions = { he_check_house_arrivals }
}
# fallback for a landed Sasanian who settles a region without travelling
yearly_playable_pulse = {
	on_actions = { he_check_house_arrivals }
}

he_check_house_arrivals = {
	trigger = {
		he_is_sasanian_trigger = yes
		is_adult = yes
		NAND = {
			has_character_flag = he_house_suren_risen
			has_character_flag = he_house_ispahbudhan_risen
			has_character_flag = he_house_waraz_risen
			has_character_flag = he_house_spandiyadh_risen
			has_character_flag = he_house_zik_risen
		}
	}
	effect = {
		he_check_house_arrivals_effect = yes
	}
}
