From 1e1a92983aaebbb5722ba94be4c3175e60ed7284 Mon Sep 17 00:00:00 2001
From: DeltaFire15 <46569814+DeltaFire15@users.noreply.github.com>
Date: Thu, 15 Oct 2020 12:44:08 +0200
Subject: [PATCH] [s] Objective fixes : Cryo edition (#13561)
* no more free wins from cryo
* Kicks travis with an empty commit
* Update code/game/gamemodes/objective.dm
Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
---
code/game/gamemodes/objective.dm | 39 +++++++++++++++++++++++++++++---
code/game/machinery/cryopod.dm | 2 +-
2 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm
index 10b92d9655..a8ed4611eb 100644
--- a/code/game/gamemodes/objective.dm
+++ b/code/game/gamemodes/objective.dm
@@ -76,6 +76,13 @@ GLOBAL_LIST_EMPTY(objectives)
/datum/objective/proc/check_completion()
return completed
+/*
+Used during the round to check if an objective has already been completed, generally should have harsher requirements that the default objective (no true because of short afk, etc)
+If not set, defaults to check_completion instead. Set it. It's used by cryo.
+*/
+/datum/objective/proc/check_midround_completion()
+ return check_completion()
+
/datum/objective/proc/is_unique_objective(possible_target)
var/list/datum/mind/owners = get_owners()
for(var/datum/mind/M in owners)
@@ -175,6 +182,9 @@ GLOBAL_LIST_EMPTY(objectives)
/datum/objective/assassinate/check_completion()
return !considered_alive(target) || considered_afk(target)
+/datum/objective/assassinate/check_midround_completion()
+ return FALSE //They need to be dead at the end of the round, silly!
+
/datum/objective/assassinate/update_explanation_text()
..()
if(target && target.current)
@@ -201,13 +211,16 @@ GLOBAL_LIST_EMPTY(objectives)
return won || ..()
/datum/objective/assassinate/once/process()
- won = check_midround_completion()
+ won = tick_check_completion()
if(won)
STOP_PROCESSING(SSprocessing,src)
-/datum/objective/assassinate/once/proc/check_midround_completion()
+/datum/objective/assassinate/once/proc/tick_check_completion()
return won || !considered_alive(target) //The target afking / logging off for a bit during the round doesn't complete it, but them being afk at roundend does.
+/datum/objective/assassinate/once/check_midround_completion()
+ return won //If they cryoed, only keep it if we already won
+
/datum/objective/assassinate/internal
var/stolen = 0 //Have we already eliminated this target?
@@ -233,6 +246,9 @@ GLOBAL_LIST_EMPTY(objectives)
var/turf/T = get_turf(target.current)
return !T || !is_station_level(T.z)
+/datum/objective/mutiny/check_midround_completion()
+ return FALSE
+
/datum/objective/mutiny/update_explanation_text()
..()
if(target && target.current)
@@ -252,7 +268,10 @@ GLOBAL_LIST_EMPTY(objectives)
return target
/datum/objective/maroon/check_completion()
- return !target || !considered_alive(target) || (!target.current.onCentCom() && !target.current.onSyndieBase())
+ return !target || !considered_alive(target) || (!target.current?.onCentCom() && !target.current?.onSyndieBase())
+
+/datum/objective/maroon/check_midround_completion()
+ return FALSE
/datum/objective/maroon/update_explanation_text()
if(target && target.current)
@@ -313,6 +332,9 @@ GLOBAL_LIST_EMPTY(objectives)
/datum/objective/protect/check_completion()
return !target || considered_alive(target, enforce_human = human_check)
+/datum/objective/protect/check_midround_completion()
+ return FALSE //Nuh uh, you get a new objective
+
/datum/objective/protect/update_explanation_text()
..()
if(target && target.current)
@@ -412,6 +434,9 @@ GLOBAL_LIST_EMPTY(objectives)
/datum/objective/breakout/check_completion()
return !target || considered_escaped(target)
+/datum/objective/breakout/check_midround_completion()
+ return FALSE
+
/datum/objective/breakout/find_target_by_role(role, role_type=0, invert=0)
if(!invert)
target_role_type = role_type
@@ -462,6 +487,9 @@ GLOBAL_LIST_EMPTY(objectives)
return TRUE
return FALSE
+/datum/objective/escape/escape_with_identity/check_midround_completion()
+ return FALSE
+
/datum/objective/escape/escape_with_identity/admin_edit(mob/admin)
admin_simple_target_pick(admin)
@@ -622,6 +650,8 @@ GLOBAL_LIST_EMPTY(possible_items_special)
explanation_text = "Acquire [targetinfo.name] held by [target.current.real_name], the [target.assigned_role] and syndicate agent"
steal_target = targetinfo.targetitem
+/datum/objective/steal/exchange/check_midround_completion()
+ return FALSE
/datum/objective/steal/exchange/update_explanation_text()
..()
@@ -826,6 +856,9 @@ GLOBAL_LIST_EMPTY(possible_items_special)
return target.current.stat == DEAD || target.current.z > 6 || !target.current.ckey //Borgs/brains/AIs count as dead for traitor objectives.
return TRUE
+/datum/objective/destroy/check_midround_completion()
+ return FALSE
+
/datum/objective/destroy/update_explanation_text()
..()
if(target && target.current)
diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm
index b48742d885..a2a395c51c 100644
--- a/code/game/machinery/cryopod.dm
+++ b/code/game/machinery/cryopod.dm
@@ -361,7 +361,7 @@
// them win or lose based on cryo is silly so we remove the objective.
if(istype(O,/datum/objective/mutiny) && O.target == mob_occupant.mind)
qdel(O)
- else if(O.target && istype(O.target, /datum/mind) && !O.check_completion())
+ else if(O.target && istype(O.target, /datum/mind) && !O.check_midround_completion())
if(O.target == mob_occupant.mind && O.owner?.current)
to_chat(O.owner.current, "
You get the feeling your target is no longer within reach. Time for Plan [pick("A","B","C","D","X","Y","Z")]. Objectives updated!")
O.target = null