Why did you check if the gamemode's type is an antagonist datum?

And why did it sort of work too?
I don't understand.
Pooj's copypasting this black magic, smh.
This commit is contained in:
Ghommie
2019-05-22 06:09:18 +02:00
parent d40d9791c4
commit 6bb70297ec
3 changed files with 73 additions and 68 deletions

View File

@@ -97,6 +97,21 @@
main_cult = C.cult_team
..()
/datum/game_mode/cult/process()
if(finished)
return
var/datum/objective/sacrifice/sac_objective = locate() in main_cult.objectives
if(!sac_objective || sac_objective.check_completion())
return
var/datum/mind/sacrificial = sac_objective.get_target()
var/mob/living/t_current = sacrificial.current
if(!sacrificial || !sacrificial.current) //target is gone for good but not sacced.
main_cult.sort_sacrifice(TRUE)
if(QDELETED(sac_objective.target_current) || sac_objective.target_current != t_current) //target is now a different mob (monkey, simple mob)
sac_objective.sac_image = t_current.get_sac_image()
sac_objective.target_current = t_current
sac_objective.update_explanation_text()
/datum/game_mode/proc/add_cultist(datum/mind/cult_mind, stun , equip = FALSE) //BASE
if (!istype(cult_mind))
return FALSE

View File

@@ -13,7 +13,7 @@
var/give_equipment = FALSE
var/datum/team/cult/cult_team
/datum/antagonist/cult/get_team()
return cult_team
@@ -115,7 +115,7 @@
cult_team.rise(current)
if(cult_team.cult_ascendent)
cult_team.ascend(current)
/datum/antagonist/cult/remove_innate_effects(mob/living/mob_override)
. = ..()
var/mob/living/current = owner.current
@@ -220,7 +220,7 @@
throwing.Remove(current)
current.update_action_buttons_icon()
current.remove_status_effect(/datum/status_effect/cult_master)
if(ishuman(current))
var/mob/living/carbon/human/H = current
H.eye_color = initial(H.eye_color)
@@ -241,7 +241,7 @@
var/reckoning_complete = FALSE
var/cult_risen = FALSE
var/cult_ascendent = FALSE
/datum/team/cult/proc/check_size()
if(cult_ascendent)
return
@@ -262,7 +262,7 @@
to_chat(B.current, "<span class='cultlarge'>The veil weakens as your cult grows, your eyes begin to glow...")
addtimer(CALLBACK(src, .proc/rise, B.current), 200)
cult_risen = TRUE
if(ratio > CULT_ASCENDENT && !cult_ascendent)
for(var/datum/mind/B in members)
if(B.current)
@@ -270,8 +270,8 @@
to_chat(B.current, "<span class='cultlarge'>Your cult is ascendent and the red harvest approaches - you cannot hide your true nature for much longer!!")
addtimer(CALLBACK(src, .proc/ascend, B.current), 200)
cult_ascendent = TRUE
/datum/team/cult/proc/rise(cultist)
if(ishuman(cultist))
var/mob/living/carbon/human/H = cultist
@@ -279,7 +279,7 @@
H.dna.update_ui_block(DNA_EYE_COLOR_BLOCK)
H.add_trait(CULT_EYES)
H.update_body()
/datum/team/cult/proc/ascend(cultist)
if(ishuman(cultist))
var/mob/living/carbon/human/H = cultist
@@ -289,48 +289,68 @@
/datum/team/cult/proc/setup_objectives()
//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/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)
if(player.mind && !player.mind.has_antag_datum(/datum/antagonist/cult) && !is_convertable_to_cult(player) && player.stat != DEAD)
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.")
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))
sac_objective.target = pick(target_candidates)
sac_objective.update_explanation_text()
if(!LAZYLEN(target_candidates))
message_admins("Cult Sacrifice: Could not find unconvertible or convertible target. Proceeding to next stage!")
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)
var/datum/preferences/sacface = sac_objective.target.current.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)
sac_objective.sac_image = reshape
sac_objective.sac_image = sac_objective.target_current.get_sac_image()
objectives += sac_objective
objectives += sac_objective
else
message_admins("Cult Sacrifice: Could not find unconvertible or convertible target. WELP!")
/mob/proc/get_sac_image()
var/icon/reshape = icon(icon, icon_state, SOUTH)
reshape.Shift(SOUTH, 4)
reshape.Shift(EAST, 1)
reshape.Crop(7,4,26,31)
reshape.Crop(-5,-3,26,30)
/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)
//SUMMON OBJECTIVE
var/datum/objective/eldergod/summon_objective = new()
summon_objective.team = src
objectives += summon_objective
/datum/objective/sacrifice
var/sacced = FALSE
var/sac_image
var/mob/living/target_current
/datum/objective/sacrifice/check_completion()
return sacced || completed

View File

@@ -245,43 +245,13 @@
// This function can not be undone; do not call this unless you are sure
/obj/machinery/cryopod/proc/despawn_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!")
if(istype(SSticker.mode, /datum/game_mode/cult))
var/datum/game_mode/cult/M = SSticker.mode
var/datum/team/cult/C = M.main_cult
var/datum/objective/sacrifice/S = locate() in C.objectives
if(S.target == mob_occupant.mind)
C.sort_sacrifice(TRUE)
//Update any existing objectives involving this mob.
for(var/datum/objective/O in GLOB.objectives)