﻿on_death = { on_actions = { ep_on_player_death ep_on_archivist_death } }
ep_on_player_death = {
    trigger = { ep_eligible_death_subject = yes NOT = { ep_subject_already_recorded = yes } }
    effect = {
        ep_seed_recorded_subjects = yes
        if = {
            limit = { NOT = { exists = global_var:ep_count } }
            set_global_variable = { name = ep_count value = 0 }
        }
        if = {
            limit = { global_var:ep_count < 512 }
            ep_allocate = yes
        }
        else = { debug_log = "EP:CAPACITY_REACHED/;/512" }
    }
}

ep_on_archivist_death = {
    trigger = { exists = global_var:ep_archivist this = global_var:ep_archivist }
    effect = { set_global_variable = ep_archive_succession_pending debug_log = "EP:ARCHIVE_WAITING_NATIVE_SUCCESSION" }
}
