From 0faee43f9537b7a8995451858509b19da0c34e80 Mon Sep 17 00:00:00 2001 From: AnturK Date: Mon, 23 Oct 2017 00:44:43 +0200 Subject: [PATCH 1/2] Cleans up datum traitor minimally. (#31978) * Removes the /custom traitor subtype nonsense. Fixes borged/ai'zed traitors getting law 0. * Not needed anymore --- code/__DEFINES/antagonists.dm | 6 -- code/datums/antagonists/datum_traitor.dm | 65 ++++----------------- code/datums/antagonists/internal_affairs.dm | 29 +-------- code/datums/mind.dm | 5 +- code/game/gamemodes/traitor/traitor.dm | 6 +- code/modules/admin/secrets.dm | 9 ++- code/modules/mob/transform_procs.dm | 2 - 7 files changed, 24 insertions(+), 98 deletions(-) diff --git a/code/__DEFINES/antagonists.dm b/code/__DEFINES/antagonists.dm index 8ac155f20b..17b6e60158 100644 --- a/code/__DEFINES/antagonists.dm +++ b/code/__DEFINES/antagonists.dm @@ -7,16 +7,10 @@ #define ANTAG_DATUM_NINJA_FRIENDLY /datum/antagonist/ninja/friendly #define ANTAG_DATUM_NINJA_RANDOM /datum/antagonist/ninja/randomAllegiance/ #define ANTAG_DATUM_TRAITOR /datum/antagonist/traitor -#define ANTAG_DATUM_TRAITOR_CUSTOM /datum/antagonist/traitor/custom #define ANTAG_DATUM_TRAITOR_HUMAN /datum/antagonist/traitor/human -#define ANTAG_DATUM_TRAITOR_HUMAN_CUSTOM /datum/antagonist/traitor/human/custom #define ANTAG_DATUM_TRAITOR_AI /datum/antagonist/traitor/AI -#define ANTAG_DATUM_TRAITOR_AI_CUSTOM /datum/antagonist/traitor/AI/custom #define ANTAG_DATUM_IAA /datum/antagonist/traitor/internal_affairs -#define ANTAG_DATUM_IAA_CUSTOM /datum/antagonist/traitor/internal_affairs/custom #define ANTAG_DATUM_IAA_HUMAN /datum/antagonist/traitor/human/internal_affairs -#define ANTAG_DATUM_IAA_HUMAN_CUSTOM /datum/antagonist/traitor/human/internal_affairs/custom -#define ANTAG_DATUM_IAA_AI_CUSTOM /datum/antagonist/traitor/AI/internal_affairs/custom #define ANTAG_DATUM_IAA_AI /datum/antagonist/traitor/AI/internal_affairs #define ANTAG_DATUM_BROTHER /datum/antagonist/brother #define ANTAG_DATUM_ABDUCTOR /datum/antagonist/abductor diff --git a/code/datums/antagonists/datum_traitor.dm b/code/datums/antagonists/datum_traitor.dm index a32e849705..d386c79c25 100644 --- a/code/datums/antagonists/datum_traitor.dm +++ b/code/datums/antagonists/datum_traitor.dm @@ -1,8 +1,7 @@ /datum/antagonist/traitor name = "Traitor" job_rank = ROLE_TRAITOR - var/should_specialise = TRUE //do we split into AI and human - var/base_datum_custom = ANTAG_DATUM_TRAITOR_CUSTOM //used for body transfer + var/should_specialise = FALSE //do we split into AI and human, set to true on inital assignment only var/ai_datum = ANTAG_DATUM_TRAITOR_AI var/human_datum = ANTAG_DATUM_TRAITOR_HUMAN var/special_role = "traitor" @@ -11,71 +10,24 @@ var/should_give_codewords = TRUE var/list/objectives_given = list() -/datum/antagonist/traitor/proc/transfer_important_variables(datum/antagonist/traitor/other) - other.silent = silent - other.employer = employer - other.special_role = special_role - other.objectives_given = objectives_given - -/datum/antagonist/traitor/custom - ai_datum = ANTAG_DATUM_TRAITOR_AI_CUSTOM - human_datum = ANTAG_DATUM_TRAITOR_HUMAN_CUSTOM - /datum/antagonist/traitor/human - should_specialise = FALSE var/should_equip = TRUE -/datum/antagonist/traitor/human/custom - silent = TRUE - should_give_codewords = FALSE - give_objectives = FALSE - should_equip = FALSE //Duplicating TCs is dangerous - /datum/antagonist/traitor/AI - should_specialise = FALSE - -/datum/antagonist/traitor/AI/custom - silent = TRUE - should_give_codewords = FALSE - give_objectives = FALSE - - -/datum/antagonist/traitor/on_body_transfer(mob/living/old_body, mob/living/new_body) - // human <-> silicon only - if(old_body && issilicon(new_body) ^ issilicon(old_body)) - silent = TRUE - owner.add_antag_datum(base_datum_custom) - for(var/datum/antagonist/traitor/new_datum in owner.antag_datums) - if(new_datum == src) - continue - transfer_important_variables(new_datum) - break - on_removal() - else - ..() - -/datum/antagonist/traitor/human/custom //used to give custom objectives - silent = TRUE - give_objectives = FALSE - should_give_codewords = FALSE - -/datum/antagonist/traitor/AI/custom //used to give custom objectives - silent = TRUE - give_objectives = FALSE - should_give_codewords = FALSE /datum/antagonist/traitor/proc/specialise() silent = TRUE - if(owner.current&&isAI(owner.current)) + if(owner.current && isAI(owner.current)) owner.add_antag_datum(ai_datum) - else owner.add_antag_datum(human_datum) + else + owner.add_antag_datum(human_datum) on_removal() /datum/antagonist/traitor/on_gain() if(should_specialise) specialise() return - SSticker.mode.traitors+=owner + SSticker.mode.traitors += owner owner.special_role = special_role if(give_objectives) forge_traitor_objectives() @@ -85,7 +37,7 @@ /datum/antagonist/traitor/apply_innate_effects() if(owner.assigned_role == "Clown") var/mob/living/carbon/human/traitor_mob = owner.current - if(traitor_mob&&istype(traitor_mob)) + if(traitor_mob && istype(traitor_mob)) if(!silent) to_chat(traitor_mob, "Your training has allowed you to overcome your clownish nature, allowing you to wield weapons without harming yourself.") traitor_mob.dna.remove_mutation(CLOWNMUT) @@ -93,7 +45,7 @@ /datum/antagonist/traitor/remove_innate_effects() if(owner.assigned_role == "Clown") var/mob/living/carbon/human/traitor_mob = owner.current - if(traitor_mob&&istype(traitor_mob)) + if(traitor_mob && istype(traitor_mob)) traitor_mob.dna.add_mutation(CLOWNMUT) /datum/antagonist/traitor/on_removal() @@ -249,6 +201,7 @@ yandere_two.update_explanation_text() // normally called in find_target() add_objective(yandere_two) .=2 + /datum/antagonist/traitor/greet() to_chat(owner.current, "You are the [owner.special_role].") owner.announce_objectives() @@ -297,6 +250,8 @@ killer.add_malf_picker() /datum/antagonist/traitor/proc/equip(var/silent = FALSE) + return + /datum/antagonist/traitor/human/equip(var/silent = FALSE) owner.equip_traitor(employer, silent) diff --git a/code/datums/antagonists/internal_affairs.dm b/code/datums/antagonists/internal_affairs.dm index a07984262e..b06d8ea068 100644 --- a/code/datums/antagonists/internal_affairs.dm +++ b/code/datums/antagonists/internal_affairs.dm @@ -5,7 +5,6 @@ #define TRAITOR_AGENT_ROLE "Syndicate External Affairs Agent" /datum/antagonist/traitor/internal_affairs - base_datum_custom = ANTAG_DATUM_IAA_CUSTOM human_datum = ANTAG_DATUM_IAA_HUMAN ai_datum = ANTAG_DATUM_IAA_AI @@ -15,7 +14,6 @@ name = "Internal Affairs Agent" employer = "Nanotrasen" special_role = "internal affairs agent" - base_datum_custom = ANTAG_DATUM_IAA_CUSTOM var/syndicate = FALSE var/last_man_standing = FALSE var/list/datum/mind/targets_stolen @@ -29,47 +27,24 @@ name = "Internal Affairs Agent" employer = "Nanotrasen" special_role = "internal affairs agent" - base_datum_custom = ANTAG_DATUM_IAA_CUSTOM var/syndicate = FALSE var/last_man_standing = FALSE var/list/datum/mind/targets_stolen -/datum/antagonist/traitor/human/internal_affairs/custom - silent = TRUE - should_give_codewords = FALSE - give_objectives = FALSE - should_equip = FALSE //Duplicating TCs is dangerous - -/datum/antagonist/traitor/human/internal_affairs/transfer_important_variables(datum/antagonist/traitor/human/internal_affairs/other) - ..(other) - other.syndicate = syndicate - other.last_man_standing = last_man_standing - other.targets_stolen = targets_stolen - -/datum/antagonist/traitor/AI/internal_affairs/transfer_important_variables(datum/antagonist/traitor/human/internal_affairs/other) - ..(other) - other.syndicate = syndicate - other.last_man_standing = last_man_standing - other.targets_stolen = targets_stolen - /datum/antagonist/traitor/human/internal_affairs/proc/give_pinpointer() if(owner && owner.current) owner.current.apply_status_effect(/datum/status_effect/agent_pinpointer) /datum/antagonist/traitor/human/internal_affairs/apply_innate_effects() .=..() //in case the base is used in future - if(owner&&owner.current) + if(owner && owner.current) give_pinpointer(owner.current) /datum/antagonist/traitor/human/internal_affairs/remove_innate_effects() .=..() - if(owner&&owner.current) + if(owner && owner.current) owner.current.remove_status_effect(/datum/status_effect/agent_pinpointer) -/datum/antagonist/traitor/internal_affairs/custom - ai_datum = ANTAG_DATUM_IAA_AI_CUSTOM - human_datum = ANTAG_DATUM_IAA_HUMAN_CUSTOM - /datum/antagonist/traitor/human/internal_affairs/on_gain() START_PROCESSING(SSprocessing, src) .=..() diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 6efcd18324..4036aaaf45 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -1357,8 +1357,9 @@ /datum/mind/proc/make_Traitor() if(!(has_antag_datum(ANTAG_DATUM_TRAITOR))) - var/datum/antagonist/traitor/traitordatum = add_antag_datum(ANTAG_DATUM_TRAITOR) - return traitordatum + var/datum/antagonist/traitor/T = new(src) + T.should_specialise = TRUE + add_antag_datum(T) /datum/mind/proc/make_Nuke(turf/spawnloc, nuke_code, leader=0, telecrystals = TRUE) diff --git a/code/game/gamemodes/traitor/traitor.dm b/code/game/gamemodes/traitor/traitor.dm index 258b7ab59f..43582b99a3 100644 --- a/code/game/gamemodes/traitor/traitor.dm +++ b/code/game/gamemodes/traitor/traitor.dm @@ -60,7 +60,9 @@ /datum/game_mode/traitor/post_setup() for(var/datum/mind/traitor in pre_traitors) - addtimer(CALLBACK(traitor, /datum/mind.proc/add_antag_datum, antag_datum), rand(10,100)) + var/datum/antagonist/traitor/new_antag = new antag_datum(traitor) + new_antag.should_specialise = TRUE + addtimer(CALLBACK(traitor, /datum/mind.proc/add_antag_datum, new_antag), rand(10,100)) if(!exchange_blue) exchange_blue = -1 //Block latejoiners from getting exchange objectives ..() @@ -79,6 +81,8 @@ add_latejoin_traitor(character.mind) /datum/game_mode/traitor/proc/add_latejoin_traitor(datum/mind/character) + var/datum/antagonist/traitor/new_antag = new antag_datum(character) + new_antag.should_specialise = TRUE character.add_antag_datum(antag_datum) diff --git a/code/modules/admin/secrets.dm b/code/modules/admin/secrets.dm index 171e943aa0..5e1a8300c4 100644 --- a/code/modules/admin/secrets.dm +++ b/code/modules/admin/secrets.dm @@ -340,14 +340,13 @@ continue if(is_special_character(H)) continue - H.mind.add_antag_datum(ANTAG_DATUM_TRAITOR_CUSTOM) - var/datum/antagonist/traitor/traitordatum = H.mind.has_antag_datum(ANTAG_DATUM_TRAITOR) //original datum self deletes + var/datum/antagonist/traitor/human/T = new(H.mind) + T.give_objectives = FALSE var/datum/objective/new_objective = new new_objective.owner = H new_objective.explanation_text = objective - traitordatum.add_objective(new_objective) - traitordatum.equip(FALSE) - traitordatum.greet() + T.add_objective(new_objective) + H.mind.add_antag_datum(T) message_admins("[key_name_admin(usr)] used everyone is a traitor secret. Objective is [objective]") log_admin("[key_name(usr)] used everyone is a traitor secret. Objective is [objective]") diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 592d19e0b1..3bc2a225f0 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -376,8 +376,6 @@ if(!transfer_after) mind.active = FALSE mind.transfer_to(R) - if(mind.special_role) - R.mind.store_memory("In case you look at this after being borged, the objectives are only here until I find a way to make them not show up for you, as I can't simply delete them without screwing up round-end reporting. --NeoFite") else if(transfer_after) R.key = key