Refactor quick create antag panel code, fixed AFK revs not properly ending the round. (#31103)

* Refactor quick create antag, fixed AFK revs not ending

* More cleanup

* Simplified one of the checks
The other half was covered by considered_alive already.

* Reordered check

Eliminate current antags sooner before running them through the rest of
the checks.

* removed switch
This commit is contained in:
ShizCalev
2017-10-02 03:48:42 -04:00
committed by CitadelStationBot
parent 52369cdb7c
commit e402c4350c
4 changed files with 59 additions and 55 deletions
+8 -18
View File
@@ -17,14 +17,6 @@
if(owner)
. += owner
/datum/objective/proc/considered_alive(var/datum/mind/M)
if(M && M.current)
var/mob/living/carbon/human/H
if(ishuman(M.current))
H = M.current
return M.current.stat != DEAD && !issilicon(M.current) && !isbrain(M.current) && (!H || H.dna.species.id != "memezombies")
return FALSE
/datum/objective/proc/considered_escaped(datum/mind/M)
if(!considered_alive(M))
return FALSE
@@ -37,9 +29,6 @@
return FALSE
return location.onCentCom() || location.onSyndieBase()
/datum/objective/proc/considered_afk(datum/mind/M)
return !M || !M.current || !M.current.client || M.current.client.is_afk()
/datum/objective/proc/check_completion()
return completed
@@ -348,13 +337,14 @@
return FALSE
return TRUE
//Like survive, but works for silicons and zombies and such.
/datum/objective/survive/exist/considered_alive(var/datum/mind/M)
if(M && M.current)
if(isliving(M.current))
var/mob/living/L = M.current
return L.stat != DEAD
return FALSE
/datum/objective/survive/exist //Like survive, but works for silicons and zombies and such.
/datum/objective/survive/exist/check_completion()
var/list/datum/mind/owners = get_owners()
for(var/datum/mind/M in owners)
if(!considered_alive(M, FALSE))
return FALSE
return TRUE
/datum/objective/martyr
explanation_text = "Die a glorious death."
+1 -1
View File
@@ -329,7 +329,7 @@
/datum/game_mode/revolution/proc/check_heads_victory()
for(var/datum/mind/rev_mind in head_revolutionaries)
var/turf/T = get_turf(rev_mind.current)
if((rev_mind) && (rev_mind.current) && (rev_mind.current.stat != DEAD) && T && (T.z in GLOB.station_z_levels))
if(!considered_afk(rev_mind) && considered_alive(rev_mind) && (T.z in GLOB.station_z_levels))
if(ishuman(rev_mind.current))
return 0
return 1