//Used to nominate oneself or ghosts for the role of Eminence. /obj/structure/destructible/clockwork/eminence_spire name = "eminence spire" desc = "A hulking machine made of powerful alloy, with three small obelisks and a huge plate in the center." clockwork_desc = "This spire is used to become the Eminence, who functions as an invisible leader of the cult. Activate it to nominate yourself or propose that the Eminence should be \ selected from available ghosts. Once an Eminence is selected, they can't normally be changed." icon_state = "tinkerers_daemon" break_message = "The spire screeches with crackling power and collapses into scrap!" max_integrity = 400 var/mob/eminence_nominee var/selection_timer //Timer ID; this is canceled if the vote is canceled var/kingmaking /obj/structure/destructible/clockwork/eminence_spire/attack_hand(mob/living/user) if(!is_servant_of_ratvar(user)) to_chat(user, "You can tell how powerful [src] is; you know better than to touch it.") return if(kingmaking) return var/datum/antagonist/clockcult/C = user.mind.has_antag_datum(/datum/antagonist/clockcult) if(!C || !C.clock_team) return if(C.clock_team.eminence) to_chat(user, "There's already an Eminence!") return if(!GLOB.servants_active) to_chat(user, "The Ark isn't active!") return if(eminence_nominee) //This could be one large proc, but is split into three for ease of reading if(eminence_nominee == user) cancelation(user) else objection(user) else nomination(user) /obj/structure/destructible/clockwork/eminence_spire/attack_ghost(mob/user) if(!IsAdminGhost(user)) return var/datum/antagonist/clockcult/random_cultist = locate() in GLOB.antagonists //if theres no cultists new team without eminence will be created anyway. if(random_cultist && random_cultist.clock_team && random_cultist.clock_team.eminence) to_chat(user, "There's already an Eminence - too late!") return if(!GLOB.servants_active) to_chat(user, "The Ark must be active first!") return if(alert(user, "Become the Eminence using admin?", "Become Eminence", "Yes", "No") != "Yes") return message_admins("Admin [key_name_admin(user)] directly became the Eminence of the cult!") log_admin("Admin [key_name(user)] made themselves the Eminence.") var/mob/camera/eminence/eminence = new(get_turf(src)) eminence.key = user.key hierophant_message("Ratvar has directly assigned the Eminence!") for(var/mob/M in servants_and_ghosts()) M.playsound_local(M, 'sound/machines/clockcult/eminence_selected.ogg', 50, FALSE) /obj/structure/destructible/clockwork/eminence_spire/proc/nomination(mob/living/nominee) //A user is nominating themselves or ghosts to become Eminence var/nomination_choice = alert(nominee, "Who would you like to nominate?", "Eminence Nomination", "Nominate Yourself", "Nominate Ghosts", "Cancel") if(!is_servant_of_ratvar(nominee) || !nominee.canUseTopic(src) || eminence_nominee) return switch(nomination_choice) if("Cancel") return if("Nominate Yourself") eminence_nominee = nominee hierophant_message("[nominee] nominates themselves as the Eminence! You may object by interacting with the eminence spire. The vote will otherwise pass in 30 seconds.") if("Nominate Ghosts") eminence_nominee = "ghosts" hierophant_message("[nominee] proposes selecting an Eminence from ghosts! You may object by interacting with the eminence spire. The vote will otherwise pass in 30 seconds.") for(var/mob/M in servants_and_ghosts()) M.playsound_local(M, 'sound/machines/clockcult/ocularwarden-target.ogg', 50, FALSE) selection_timer = addtimer(CALLBACK(src, .proc/kingmaker), 300, TIMER_STOPPABLE) /obj/structure/destructible/clockwork/eminence_spire/proc/objection(mob/living/wright) if(alert(wright, "Object to the selection of [eminence_nominee] as Eminence?", "Objection!", "Object", "Cancel") == "Cancel" || !is_servant_of_ratvar(wright) || !wright.canUseTopic(src) || !eminence_nominee) return hierophant_message("[wright] objects to the nomination of [eminence_nominee]! The eminence spire has been reset.") for(var/mob/M in servants_and_ghosts()) M.playsound_local(M, 'sound/machines/clockcult/integration_cog_install.ogg', 50, FALSE) eminence_nominee = null deltimer(selection_timer) /obj/structure/destructible/clockwork/eminence_spire/proc/cancelation(mob/living/cold_feet) if(alert(cold_feet, "Cancel your nomination?", "Cancel Nomination", "Withdraw Nomination", "Cancel") == "Cancel" || !is_servant_of_ratvar(cold_feet) || !cold_feet.canUseTopic(src) || !eminence_nominee) return hierophant_message("[eminence_nominee] has withdrawn their nomination! The eminence spire has been reset.") for(var/mob/M in servants_and_ghosts()) M.playsound_local(M, 'sound/machines/clockcult/integration_cog_install.ogg', 50, FALSE) eminence_nominee = null deltimer(selection_timer) /obj/structure/destructible/clockwork/eminence_spire/proc/kingmaker() if(!eminence_nominee) return if(ismob(eminence_nominee)) if(!eminence_nominee.client || !eminence_nominee.mind) hierophant_message("[eminence_nominee] somehow lost their sentience! The eminence spire has been reset.") for(var/mob/M in servants_and_ghosts()) M.playsound_local(M, 'sound/machines/clockcult/integration_cog_install.ogg', 50, FALSE) eminence_nominee = null return playsound(eminence_nominee, 'sound/machines/clockcult/ark_damage.ogg', 50, FALSE) eminence_nominee.visible_message("A blast of white-hot light flows into [eminence_nominee], vaporizing them in an instant!", \ "allthelightintheuniverseflowing.into.YOU") for(var/obj/item/I in eminence_nominee) eminence_nominee.dropItemToGround(I) var/mob/camera/eminence/eminence = new(get_turf(src)) eminence_nominee.mind.transfer_to(eminence) eminence_nominee.dust() hierophant_message("[eminence_nominee] has ascended into the Eminence!") else if(eminence_nominee == "ghosts") kingmaking = TRUE hierophant_message("The eminence spire is now selecting a ghost to be the Eminence...") var/list/candidates = pollGhostCandidates("Would you like to play as the servants' Eminence?", "Servant of Ratvar", null, ROLE_SERVANT_OF_RATVAR, poll_time = 100) kingmaking = FALSE if(!candidates.len) for(var/mob/M in servants_and_ghosts()) M.playsound_local(M, 'sound/machines/clockcult/integration_cog_install.ogg', 50, FALSE) hierophant_message("No ghosts accepted the offer! The eminence spire has been reset.") eminence_nominee = null return visible_message("A blast of white-hot light spirals from [src] in waves!") playsound(src, 'sound/machines/clockcult/ark_damage.ogg', 50, FALSE) var/mob/camera/eminence/eminence = new(get_turf(src)) eminence_nominee = pick(candidates) eminence.key = eminence_nominee.key hierophant_message("A ghost has ascended into the Eminence!") for(var/mob/M in servants_and_ghosts()) M.playsound_local(M, 'sound/machines/clockcult/eminence_selected.ogg', 50, FALSE) eminence_nominee = null