From 175fe71cc0171d325c4af7fab588fbfe30ecf34d Mon Sep 17 00:00:00 2001
From: SkyratBot <59378654+SkyratBot@users.noreply.github.com>
Date: Sun, 20 Jun 2021 23:58:37 +0200
Subject: [PATCH] [MIRROR] (Hopefully) Stops cryopodded contract targets from
breaking contractor uplinks (#6420)
* (Hopefully) Stops cryopodded contract targets from breaking contractor uplinks (#59742)
This PR aims to stop contractor uplinks from breaking due to having a target cryopod. When a contract target enters cryosleep, it now manually rerolls the contract.
This PR is admittedly somewhat bandaid-y, as contractors are slotted for removal soon, apparently.
* (Hopefully) Stops cryopodded contract targets from breaking contractor uplinks
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
---
code/game/machinery/cryopod.dm | 13 +++++++++++--
.../programs/antagonist/contract_uplink.dm | 5 +++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm
index 3c830ed9bbb..146a2372eb9 100644
--- a/code/game/machinery/cryopod.dm
+++ b/code/game/machinery/cryopod.dm
@@ -220,8 +220,17 @@ GLOBAL_LIST_EMPTY(cryopod_computers)
for(var/datum/mind/mind in objective.team.members)
to_chat(mind.current, "
[span_userdanger("Your target is no longer within reach. Objective removed!")]")
mind.announce_objectives()
- else if(objective.target && istype(objective.target, /datum/mind))
- if(objective.target == mob_occupant.mind)
+ else if(istype(objective.target) && objective.target == mob_occupant.mind)
+ if(istype(objective, /datum/objective/contract))
+ var/datum/antagonist/traitor/affected_traitor = objective.owner.has_antag_datum(/datum/antagonist/traitor)
+ var/datum/contractor_hub/affected_contractor_hub = affected_traitor.contractor_hub
+ for(var/datum/syndicate_contract/affected_contract as anything in affected_contractor_hub.assigned_contracts)
+ if(affected_contract.contract == objective)
+ affected_contract.generate(affected_contractor_hub.assigned_targets)
+ affected_contractor_hub.assigned_targets.Add(affected_contract.contract.target)
+ to_chat(objective.owner.current, "
[span_userdanger("Contract target out of reach. Contract rerolled.")]")
+ break
+ else
var/old_target = objective.target
objective.target = null
if(!objective)
diff --git a/code/modules/modular_computers/file_system/programs/antagonist/contract_uplink.dm b/code/modules/modular_computers/file_system/programs/antagonist/contract_uplink.dm
index 682996987c1..1cad0e46f83 100644
--- a/code/modules/modular_computers/file_system/programs/antagonist/contract_uplink.dm
+++ b/code/modules/modular_computers/file_system/programs/antagonist/contract_uplink.dm
@@ -165,6 +165,11 @@
))
for (var/datum/syndicate_contract/contract in traitor_data.contractor_hub.assigned_contracts)
+ if(!contract.contract)
+ stack_trace("Syndiate contract with null contract objective found in [traitor_data.owner]'s contractor hub!")
+ contract.status = CONTRACT_STATUS_ABORTED
+ continue
+
data["contracts"] += list(list(
"target" = contract.contract.target,
"target_rank" = contract.target_rank,