From aa7a27420c06ad7a52c81399d0da5a90518d4ebe Mon Sep 17 00:00:00 2001 From: vuonojenmustaturska Date: Wed, 16 May 2018 22:35:25 +0300 Subject: [PATCH] Merge pull request #37863 from AnturK/rr4 Fixes changeling team objectives (a bit) --- code/game/gamemodes/objective.dm | 38 +++++++++---------- .../antagonists/changeling/changeling.dm | 5 ++- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index 04753e3d50..fd9a1abd4a 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -712,6 +712,8 @@ GLOBAL_LIST_EMPTY(possible_items_special) var/min_lings = 3 //Minimum amount of lings for this team objective to be possible var/escape_objective_compatible = FALSE +/datum/objective/changeling_team_objective/proc/prepare() + return FALSE //Impersonate department //Picks as many people as it can from a department (Security,Engineer,Medical,Science) @@ -724,6 +726,19 @@ GLOBAL_LIST_EMPTY(possible_items_special) var/department_string = "" +/datum/objective/changeling_team_objective/impersonate_department/prepare() + var/result = FALSE + if(command_staff_only) + result = get_heads() + else + result = get_department_staff() + if(result) + update_explanation_text() + return TRUE + else + return FALSE + + /datum/objective/changeling_team_objective/impersonate_department/proc/get_department_staff() department_minds = list() department_real_names = list() @@ -756,9 +771,8 @@ GLOBAL_LIST_EMPTY(possible_items_special) if(!department_minds.len) log_game("[type] has failed to find department staff, and has removed itself. the round will continue normally") - owner.objectives -= src - qdel(src) - return + return FALSE + return TRUE /datum/objective/changeling_team_objective/impersonate_department/proc/get_heads() @@ -785,19 +799,8 @@ GLOBAL_LIST_EMPTY(possible_items_special) if(!department_minds.len) log_game("[type] has failed to find department heads, and has removed itself. the round will continue normally") - owner.objectives -= src - qdel(src) - return - - -/datum/objective/changeling_team_objective/impersonate_department/New(var/text) - ..() - if(command_staff_only) - get_heads() - else - get_department_staff() - - update_explanation_text() + return FALSE + return TRUE /datum/objective/changeling_team_objective/impersonate_department/update_explanation_text() @@ -862,9 +865,6 @@ GLOBAL_LIST_EMPTY(possible_items_special) return TRUE return FALSE - - - //A subtype of impersonate_department //This subtype always picks as many command staff as it can (HoS,HoP,Cap,CE,CMO,RD) //and tasks the lings with killing and replacing them diff --git a/code/modules/antagonists/changeling/changeling.dm b/code/modules/antagonists/changeling/changeling.dm index 8c6d7f52bd..a42ae6ef4f 100644 --- a/code/modules/antagonists/changeling/changeling.dm +++ b/code/modules/antagonists/changeling/changeling.dm @@ -353,7 +353,10 @@ if(GLOB.changeling_team_objective_type) var/datum/objective/changeling_team_objective/team_objective = new GLOB.changeling_team_objective_type team_objective.owner = owner - objectives += team_objective + if(team_objective.prepare())//Setting up succeeded + objectives += team_objective + else + qdel(team_objective) return /datum/antagonist/changeling/proc/forge_objectives()