From d27ead5c0e0b4a49dd977fa19d5fc2d14656d0ed Mon Sep 17 00:00:00 2001 From: Aquilar Date: Tue, 14 Nov 2023 21:01:32 +0800 Subject: [PATCH] fixes admin given assassinateonce objective. (#23177) * fixes admin given assassinateonce * replaces accidently removed comment * requested adjustments --- code/datums/mind.dm | 1 + code/game/gamemodes/objective.dm | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 87beafb097c..ae2dc41e616 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -686,6 +686,7 @@ new_objective:target = new_target:mind //Will display as special role if assigned mode is equal to special role.. Ninjas/commandos/nuke ops. new_objective.explanation_text = "[objective_type] [new_target:real_name], the [new_target:mind:assigned_role == new_target:mind:special_role ? (new_target:mind:special_role) : (new_target:mind:assigned_role)]." + new_objective.establish_signals() if("destroy") var/list/possible_targets = active_ais(1) diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index 9fdc83f0b0a..fad00385276 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -57,6 +57,12 @@ GLOBAL_LIST_INIT(potential_theft_objectives, (subtypesof(/datum/theft_objective) /datum/objective/proc/found_target() return target +/** + * This is for objectives that need to register signals, so place them in here. Makes it easier for add_objective to call it. + */ +/datum/objective/proc/establish_signals() + return + /** * Get all owners of the objective, including ones from the objective's team, if it has one. * @@ -174,11 +180,14 @@ GLOBAL_LIST_INIT(potential_theft_objectives, (subtypesof(/datum/theft_objective) ..() if(target?.current) explanation_text = "Teach [target.current.real_name], the [target.assigned_role], a lesson they will not forget. The target only needs to die once for success." - RegisterSignal(target.current, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING), PROC_REF(check_midround_completion)) + establish_signals() else explanation_text = "Free Objective" return target +/datum/objective/assassinateonce/establish_signals() + RegisterSignal(target.current, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING), PROC_REF(check_midround_completion)) + /datum/objective/assassinateonce/check_completion() return won || completed || !target?.current?.ckey @@ -670,7 +679,7 @@ GLOBAL_LIST_INIT(potential_theft_objectives, (subtypesof(/datum/theft_objective) /datum/objective/destroy/post_target_cryo(list/owners) holder.replace_objective(src, /datum/objective/assassinate) - + /datum/objective/steal_five_of_type name = "Steal Five Items" explanation_text = "Steal at least five items!"