Merge pull request #3558 from Citadel-Station-13/upstream-merge-31978

[MIRROR] Cleans up datum traitor minimally.
This commit is contained in:
LetterJay
2017-10-23 14:50:05 -04:00
committed by GitHub
6 changed files with 24 additions and 96 deletions

View File

@@ -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

View File

@@ -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, "<B><font size=3 color=red>You are the [owner.special_role].</font></B>")
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)

View File

@@ -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)
.=..()

View File

@@ -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)

View File

@@ -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)

View File

@@ -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("<span class='adminnotice'>[key_name_admin(usr)] used everyone is a traitor secret. Objective is [objective]</span>")
log_admin("[key_name(usr)] used everyone is a traitor secret. Objective is [objective]")