Merge pull request #8408 from Ghommie/Ghommie-cit13
Fixing cult rounds potentially stalling if the sac target is erased from this realm.
This commit is contained in:
@@ -242,6 +242,30 @@
|
|||||||
var/cult_risen = FALSE
|
var/cult_risen = FALSE
|
||||||
var/cult_ascendent = FALSE
|
var/cult_ascendent = FALSE
|
||||||
|
|
||||||
|
/datum/team/cult/New()
|
||||||
|
. = ..()
|
||||||
|
START_PROCESSING(SSprocessing, src)
|
||||||
|
|
||||||
|
/datum/team/cult/Destroy()
|
||||||
|
STOP_PROCESSING(SSprocessing, src)
|
||||||
|
return ..()
|
||||||
|
|
||||||
|
/datum/team/cult/process()
|
||||||
|
if(SSticker.current_state == GAME_STATE_FINISHED)
|
||||||
|
return
|
||||||
|
var/datum/objective/sacrifice/sac_objective = locate() in objectives
|
||||||
|
if(!sac_objective || sac_objective.check_completion())
|
||||||
|
return
|
||||||
|
var/datum/mind/sacrificial = sac_objective.get_target()
|
||||||
|
var/mob/living/sac_current = sacrificial.current
|
||||||
|
if(!sacrificial || !sac_current) //target is gone for good but not sacrified.
|
||||||
|
sort_sacrifice(TRUE)
|
||||||
|
return
|
||||||
|
if(QDELETED(sac_objective.target_current) || sac_objective.target_current != sac_current) //target is now a different mob (monkey, simple mob)
|
||||||
|
sac_objective.sac_image = sac_current.get_sac_image()
|
||||||
|
sac_objective.target_current = sac_current
|
||||||
|
sac_objective.update_explanation_text()
|
||||||
|
|
||||||
/datum/team/cult/proc/check_size()
|
/datum/team/cult/proc/check_size()
|
||||||
if(cult_ascendent)
|
if(cult_ascendent)
|
||||||
return
|
return
|
||||||
@@ -289,48 +313,68 @@
|
|||||||
|
|
||||||
/datum/team/cult/proc/setup_objectives()
|
/datum/team/cult/proc/setup_objectives()
|
||||||
//SAC OBJECTIVE , todo: move this to objective internals
|
//SAC OBJECTIVE , todo: move this to objective internals
|
||||||
|
sort_sacrifice()
|
||||||
|
//SUMMON OBJECTIVE
|
||||||
|
var/datum/objective/eldergod/summon_objective = new()
|
||||||
|
summon_objective.team = src
|
||||||
|
objectives += summon_objective
|
||||||
|
|
||||||
|
/datum/team/cult/proc/sort_sacrifice(replacement = FALSE)
|
||||||
|
|
||||||
var/list/target_candidates = list()
|
var/list/target_candidates = list()
|
||||||
var/datum/objective/sacrifice/sac_objective = new
|
|
||||||
sac_objective.team = src
|
var/datum/objective/sacrifice/sac_objective = locate() in GLOB.objectives
|
||||||
|
if(!sac_objective)
|
||||||
|
sac_objective = new
|
||||||
|
sac_objective.team = src
|
||||||
|
|
||||||
for(var/mob/living/carbon/human/player in GLOB.player_list)
|
for(var/mob/living/carbon/human/player in GLOB.player_list)
|
||||||
if(player.mind && !player.mind.has_antag_datum(/datum/antagonist/cult) && !is_convertable_to_cult(player) && player.stat != DEAD)
|
if(player.mind && !player.mind.has_antag_datum(/datum/antagonist/cult) && !is_convertable_to_cult(player) && player.stat != DEAD)
|
||||||
target_candidates += player.mind
|
target_candidates += player.mind
|
||||||
|
|
||||||
if(target_candidates.len == 0)
|
if(!length(target_candidates))
|
||||||
message_admins("Cult Sacrifice: Could not find unconvertible target, checking for convertible target.")
|
message_admins("Cult Sacrifice: Could not find unconvertible target, checking for convertible target.")
|
||||||
for(var/mob/living/carbon/human/player in GLOB.player_list)
|
for(var/mob/living/carbon/human/player in GLOB.player_list)
|
||||||
if(player.mind && !player.mind.has_antag_datum(/datum/antagonist/cult) && player.stat != DEAD)
|
if(player.mind && !player.mind.has_antag_datum(/datum/antagonist/cult) && player.stat != DEAD)
|
||||||
target_candidates += player.mind
|
target_candidates += player.mind
|
||||||
|
|
||||||
listclearnulls(target_candidates)
|
listclearnulls(target_candidates)
|
||||||
if(LAZYLEN(target_candidates))
|
if(!LAZYLEN(target_candidates))
|
||||||
sac_objective.target = pick(target_candidates)
|
message_admins("Cult Sacrifice: Could not find unconvertible or convertible target. Proceeding to next stage!")
|
||||||
sac_objective.update_explanation_text()
|
sac_objective.sacced = TRUE
|
||||||
|
return
|
||||||
|
var/datum/mind/new_target = pick(target_candidates)
|
||||||
|
if(replacement)
|
||||||
|
for(var/datum/mind/H in members)
|
||||||
|
if(H.current)
|
||||||
|
to_chat(H.current, "<span class='danger'>Nar'Sie</span> murmurs, <span class='cultlarge'>[sac_objective.target] is beyond your reach. Sacrifice [new_target] instead...</span></span>")
|
||||||
|
sac_objective.target = new_target
|
||||||
|
sac_objective.target_current = new_target.current
|
||||||
|
sac_objective.update_explanation_text()
|
||||||
|
|
||||||
var/datum/job/sacjob = SSjob.GetJob(sac_objective.target.assigned_role)
|
sac_objective.sac_image = sac_objective.target_current.get_sac_image()
|
||||||
var/datum/preferences/sacface = sac_objective.target.current.client.prefs
|
objectives += sac_objective
|
||||||
var/icon/reshape = get_flat_human_icon(null, sacjob, sacface, list(SOUTH))
|
|
||||||
reshape.Shift(SOUTH, 4)
|
|
||||||
reshape.Shift(EAST, 1)
|
|
||||||
reshape.Crop(7,4,26,31)
|
|
||||||
reshape.Crop(-5,-3,26,30)
|
|
||||||
sac_objective.sac_image = reshape
|
|
||||||
|
|
||||||
objectives += sac_objective
|
/mob/proc/get_sac_image()
|
||||||
else
|
var/icon/reshape = icon(icon, icon_state, SOUTH)
|
||||||
message_admins("Cult Sacrifice: Could not find unconvertible or convertible target. WELP!")
|
reshape.Shift(SOUTH, 4)
|
||||||
|
reshape.Shift(EAST, 1)
|
||||||
|
reshape.Crop(7,4,26,31)
|
||||||
//SUMMON OBJECTIVE
|
reshape.Crop(-5,-3,26,30)
|
||||||
|
|
||||||
var/datum/objective/eldergod/summon_objective = new()
|
|
||||||
summon_objective.team = src
|
|
||||||
objectives += summon_objective
|
|
||||||
|
|
||||||
|
/mob/living/carbon/human/get_sac_image()
|
||||||
|
var/datum/job/sacjob = SSjob.GetJob(mind.assigned_role)
|
||||||
|
var/datum/preferences/sacface = client.prefs
|
||||||
|
var/icon/reshape = get_flat_human_icon(null, sacjob, sacface, list(SOUTH))
|
||||||
|
reshape.Shift(SOUTH, 4)
|
||||||
|
reshape.Shift(EAST, 1)
|
||||||
|
reshape.Crop(7,4,26,31)
|
||||||
|
reshape.Crop(-5,-3,26,30)
|
||||||
|
|
||||||
/datum/objective/sacrifice
|
/datum/objective/sacrifice
|
||||||
var/sacced = FALSE
|
var/sacced = FALSE
|
||||||
var/sac_image
|
var/sac_image
|
||||||
|
var/mob/living/target_current
|
||||||
|
|
||||||
/datum/objective/sacrifice/check_completion()
|
/datum/objective/sacrifice/check_completion()
|
||||||
return sacced || completed
|
return sacced || completed
|
||||||
|
|||||||
@@ -245,43 +245,6 @@
|
|||||||
// This function can not be undone; do not call this unless you are sure
|
// This function can not be undone; do not call this unless you are sure
|
||||||
/obj/machinery/cryopod/proc/despawn_occupant()
|
/obj/machinery/cryopod/proc/despawn_occupant()
|
||||||
var/mob/living/mob_occupant = occupant
|
var/mob/living/mob_occupant = occupant
|
||||||
var/list/target_candidates = list()
|
|
||||||
|
|
||||||
if(istype(SSticker.mode, /datum/antagonist/cult))//thank
|
|
||||||
if("sacrifice" in SSticker.mode.cult)
|
|
||||||
for(var/mob/living/carbon/human/player in GLOB.player_list)
|
|
||||||
if(player.mind && !player.mind.has_antag_datum(/datum/antagonist/cult) && !is_convertable_to_cult(player) && player.stat != DEAD)
|
|
||||||
target_candidates += player.mind
|
|
||||||
|
|
||||||
target_candidates -= mob_occupant.mind
|
|
||||||
|
|
||||||
if(target_candidates.len == 0)
|
|
||||||
message_admins("Cult Sacrifice: Could not find unconvertable target, checking for convertable target.")
|
|
||||||
for(var/mob/living/carbon/human/player in GLOB.player_list)
|
|
||||||
if(player.mind && !player.mind.has_antag_datum(/datum/antagonist/cult) && player.stat != DEAD)
|
|
||||||
target_candidates += player.mind
|
|
||||||
|
|
||||||
listclearnulls(target_candidates)
|
|
||||||
if(LAZYLEN(target_candidates))
|
|
||||||
var/datum/objective/sacrifice/sac_objective = locate() in GLOB.objectives
|
|
||||||
sac_objective.target = pick(target_candidates)
|
|
||||||
sac_objective.update_explanation_text()
|
|
||||||
|
|
||||||
var/datum/job/sacjob = SSjob.GetJob(sac_objective.target.assigned_role)
|
|
||||||
var/datum/preferences/sacface = sac_objective.target.current.client.prefs
|
|
||||||
var/icon/reshape = get_flat_human_icon(null, sacjob, sacface)
|
|
||||||
reshape.Shift(SOUTH, 4)
|
|
||||||
reshape.Shift(EAST, 1)
|
|
||||||
reshape.Crop(7,4,26,31)
|
|
||||||
reshape.Crop(-5,-3,26,30)
|
|
||||||
sac_objective.sac_image = reshape
|
|
||||||
|
|
||||||
for(var/datum/mind/H in SSticker.mode.cult)
|
|
||||||
if(H.current)
|
|
||||||
to_chat(H.current, "<span class='danger'>Nar'Sie</span> murmurs, <span class='cultlarge'>[occupant] is beyond your reach. Sacrifice [sac_objective.target.current] instead...</span></span>")
|
|
||||||
|
|
||||||
else
|
|
||||||
message_admins("Cult Sacrifice: Could not find unconvertable or convertable target after cryopod. WELP!")
|
|
||||||
|
|
||||||
//Update any existing objectives involving this mob.
|
//Update any existing objectives involving this mob.
|
||||||
for(var/datum/objective/O in GLOB.objectives)
|
for(var/datum/objective/O in GLOB.objectives)
|
||||||
|
|||||||
Reference in New Issue
Block a user