Dead cultists no longer count towards the amount of cultists & cult-size is checked on stat change (#23326)

* bam

* more stuff

* signal handler

* farie review
This commit is contained in:
Contrabang
2023-12-08 16:51:44 +01:00
committed by GitHub
parent 19af9dfaf8
commit 3afd8e4d05
+16 -5
View File
@@ -164,6 +164,7 @@
check_cult_size()
cult_objs.study(cult_mind.current)
to_chat(cult_mind.current, "<span class='motd'>For more information, check the wiki page: ([GLOB.configuration.url.wiki_url]/index.php/Cultist)</span>")
RegisterSignal(cult_mind.current, COMSIG_MOB_STATCHANGE, PROC_REF(cultist_stat_change))
return TRUE
/datum/game_mode/proc/remove_cultist(datum/mind/cult_mind, show_message = TRUE, remove_gear = FALSE, mob/target_mob)
@@ -203,6 +204,7 @@
if(show_message)
cultist.visible_message("<span class='cult'>[cultist] looks like [cultist.p_they()] just reverted to [cultist.p_their()] old faith!</span>",
"<span class='userdanger'>An unfamiliar white light flashes through your mind, cleansing the taint of [SSticker.cultdat ? SSticker.cultdat.entity_title1 : "Nar'Sie"] and the memories of your time as their servant with it.</span>")
UnregisterSignal(cult_mind.current, COMSIG_MOB_STATCHANGE)
/datum/game_mode/proc/add_cult_immunity(mob/living/target)
ADD_TRAIT(target, TRAIT_CULT_IMMUNITY, CULT_TRAIT)
@@ -246,23 +248,32 @@
/datum/game_mode/proc/get_cultists(separate = FALSE)
var/cultists = 0
var/constructs = 0
for(var/I in cult)
var/datum/mind/M = I
for(var/datum/mind/M as anything in cult)
if(QDELETED(M) || M.current?.stat == DEAD)
continue
if(ishuman(M.current) && !M.current.has_status_effect(STATUS_EFFECT_SUMMONEDGHOST))
cultists++
else if(isconstruct(M.current))
constructs++
if(separate)
return list(cultists, constructs)
else
return cultists + constructs
return cultists + constructs
/datum/game_mode/proc/cultist_stat_change(mob/target_cultist, new_stat, old_stat)
SIGNAL_HANDLER // COMSIG_MOB_STATCHANGE from cultists
if(new_stat == old_stat) // huh, how? whatever, we ignore it
return
if(new_stat != DEAD && old_stat != DEAD)
return // switching between alive and unconcious
// switching between dead and alive/unconcious
check_cult_size()
/datum/game_mode/proc/check_cult_size()
var/cult_players = get_cultists()
if(cult_ascendant)
// The cult only falls if below 1/2 of the rising, usually pretty low. e.g. 5% on highpop, 10% on lowpop
if(cult_players < rise_number / 2)
if(cult_players < (rise_number / 2))
cult_fall()
return