From 9ff90bea11426410b1013611eadf9646af4fc12d Mon Sep 17 00:00:00 2001 From: MacHac Date: Wed, 27 Jun 2018 23:44:11 -0400 Subject: [PATCH] Added the pheromone receptor power to changelings. --- .../changeling/powers/pheromone_receptors.dm | 57 +++++++++++++++++++ .../traitor/IAA/internal_affairs.dm | 5 +- tgstation.dme | 1 + 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 code/modules/antagonists/changeling/powers/pheromone_receptors.dm diff --git a/code/modules/antagonists/changeling/powers/pheromone_receptors.dm b/code/modules/antagonists/changeling/powers/pheromone_receptors.dm new file mode 100644 index 00000000000..c3fe3c9bc0b --- /dev/null +++ b/code/modules/antagonists/changeling/powers/pheromone_receptors.dm @@ -0,0 +1,57 @@ +#define CHANGELING_PHEROMONE_MIN_DISTANCE 10 //More generous than the agent pinpointer because you don't know who you're looking for. +#define CHANGELING_PHEROMONE_MAX_DISTANCE 25 //They can smell your fear a mile away. Well, 50 meters. +#define CHANGELING_PHEROMONE_PING_TIME 20 //2s update time. + + +/obj/effect/proc_holder/changeling/pheromone_receptors + name = "Pheromone Receptors" + desc = "We attune our senses to track other changelings by scent. The closer they are, the easier we can find them." + helptext = "We will know the general direction of nearby changelings, with closer scents being stronger. Our chemical generation is slowed while this is active." + chemical_cost = 0 //Reduces regain rate while active. + dna_cost = 2 + var/receptors_active = FALSE + +/obj/effect/proc_holder/changeling/pheromone_receptors/sting_action(mob/living/carbon/user) + var/datum/antagonist/changeling/changeling = user.mind.has_antag_datum(/datum/antagonist/changeling) + if(!receptors_active) + to_chat(user, "We search for the scent of any nearby changelings.") + changeling.chem_recharge_slowdown += 0.5 + user.apply_status_effect(/datum/status_effect/agent_pinpointer/changeling) + else + to_chat(user, "We stop searching for now.") + changeling.chem_recharge_slowdown -= 0.5 + user.remove_status_effect(/datum/status_effect/agent_pinpointer/changeling) + + receptors_active = !receptors_active + +//Modified IA pinpointer - Points to the NEAREST changeling, but will only get you within a few tiles of the target. +//You'll still have to rely on intuition and observation to make the identification. Lings can 'hide' in public places. +/datum/status_effect/agent_pinpointer/changeling + alert_type = /obj/screen/alert/status_effect/agent_pinpointer/changeling + minimum_range = CHANGELING_PHEROMONE_MIN_DISTANCE + tick_interval = CHANGELING_PHEROMONE_PING_TIME + range_fuzz_factor = 0 + +/datum/status_effect/agent_pinpointer/changeling/scan_for_target() + var/turf/my_loc = get_turf(owner) + + var/list/mob/living/carbon/changelings = list() + + for(var/mob/living/carbon/C in GLOB.alive_mob_list) + if(C != owner && C.mind) + var/datum/antagonist/changeling/antag_datum = C.mind.has_antag_datum(/datum/antagonist/changeling) + if(istype(antag_datum)) + var/their_loc = get_turf(C) + var/distance = get_dist_euclidian(my_loc, their_loc) + if (distance < CHANGELING_PHEROMONE_MAX_DISTANCE) + changelings[C] = (CHANGELING_PHEROMONE_MAX_DISTANCE ** 2) - (distance ** 2) + + if(changelings.len) + scan_target = pickweight(changelings) //Point at a 'random' changeling, biasing heavily towards closer ones. + else + scan_target = null + + +/obj/screen/alert/status_effect/agent_pinpointer/changeling + name = "Pheromone Scent" + desc = "The nose always knows." \ No newline at end of file diff --git a/code/modules/antagonists/traitor/IAA/internal_affairs.dm b/code/modules/antagonists/traitor/IAA/internal_affairs.dm index e17d1a23b47..85f4c4958de 100644 --- a/code/modules/antagonists/traitor/IAA/internal_affairs.dm +++ b/code/modules/antagonists/traitor/IAA/internal_affairs.dm @@ -44,6 +44,7 @@ tick_interval = PINPOINTER_PING_TIME alert_type = /obj/screen/alert/status_effect/agent_pinpointer var/minimum_range = PINPOINTER_MINIMUM_RANGE + var/range_fuzz_factor = PINPOINTER_EXTRA_RANDOM_RANGE var/mob/scan_target = null /obj/screen/alert/status_effect/agent_pinpointer @@ -61,7 +62,7 @@ if(here.z != there.z) linked_alert.icon_state = "pinonnull" return - if(get_dist_euclidian(here,there)<=minimum_range + rand(0, PINPOINTER_EXTRA_RANDOM_RANGE)) + if(get_dist_euclidian(here,there)<=minimum_range + rand(0, range_fuzz_factor)) linked_alert.icon_state = "pinondirect" else linked_alert.setDir(get_dir(here, there)) @@ -228,7 +229,7 @@ /datum/antagonist/traitor/internal_affairs/forge_traitor_objectives() forge_iaa_objectives() - + var/objtype = traitor_kind == TRAITOR_HUMAN ? /datum/objective/escape : /datum/objective/survive var/datum/objective/escape_objective = new objtype escape_objective.owner = owner diff --git a/tgstation.dme b/tgstation.dme index 66e5915650e..eb2a29943a9 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -1144,6 +1144,7 @@ #include "code\modules\antagonists\changeling\powers\mimic_voice.dm" #include "code\modules\antagonists\changeling\powers\mutations.dm" #include "code\modules\antagonists\changeling\powers\panacea.dm" +#include "code\modules\antagonists\changeling\powers\pheromone_receptors.dm" #include "code\modules\antagonists\changeling\powers\regenerate.dm" #include "code\modules\antagonists\changeling\powers\revive.dm" #include "code\modules\antagonists\changeling\powers\shriek.dm"