From 3f6eac48d17fcf336b1e2e21a12f56ee92b5abf5 Mon Sep 17 00:00:00 2001
From: hal9000PR <69320440+hal9000PR@users.noreply.github.com>
Date: Wed, 7 Jul 2021 19:22:49 +0100
Subject: [PATCH] Fixes getting TK abilities when you shouldn't (#16300)
* fix
* oops
Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
* review
* oops
Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
---
code/__HELPERS/traits.dm | 1 +
code/_globalvars/traits.dm | 1 +
code/_onclick/other_mobs.dm | 2 +-
code/_onclick/telekinesis.dm | 4 ++--
code/game/dna/mutations/powers.dm | 1 +
code/modules/power/lighting.dm | 2 +-
code/modules/tgui/states.dm | 2 +-
7 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/code/__HELPERS/traits.dm b/code/__HELPERS/traits.dm
index 4241cee9e9b..a6d288d6af0 100644
--- a/code/__HELPERS/traits.dm
+++ b/code/__HELPERS/traits.dm
@@ -119,6 +119,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_XENO_HOST "xeno_host" //Tracks whether we're gonna be a baby alien's mummy.
#define TRAIT_SHOCKIMMUNE "shock_immunity"
#define TRAIT_TESLA_SHOCKIMMUNE "tesla_shock_immunity"
+#define TRAIT_TELEKINESIS "telekinesis"
#define TRAIT_RESISTHEAT "resist_heat"
#define TRAIT_RESISTHEATHANDS "resist_heat_handsonly" //For when you want to be able to touch hot things, but still want fire to be an issue.
#define TRAIT_RESISTCOLD "resist_cold"
diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm
index da0fb3b8fc2..39551da14b6 100644
--- a/code/_globalvars/traits.dm
+++ b/code/_globalvars/traits.dm
@@ -24,6 +24,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_XENO_HOST" = TRAIT_XENO_HOST,
"TRAIT_SHOCKIMMUNE" = TRAIT_SHOCKIMMUNE,
"TRAIT_TESLA_SHOCKIMMUNE" = TRAIT_TESLA_SHOCKIMMUNE,
+ "TRAIT_TELEKINESIS" = TRAIT_TELEKINESIS,
"TRAIT_RESISTHEAT" = TRAIT_RESISTHEAT,
"TRAIT_RESISTHEATHANDS" = TRAIT_RESISTHEATHANDS,
"TRAIT_RESISTCOLD" = TRAIT_RESISTCOLD,
diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm
index b2338937ebc..7eed9f0e2ef 100644
--- a/code/_onclick/other_mobs.dm
+++ b/code/_onclick/other_mobs.dm
@@ -45,7 +45,7 @@
if(HAS_TRAIT(src, TRAIT_LASEREYES) && a_intent == INTENT_HARM)
LaserEyes(A)
- if(dna.GetSEState(GLOB.teleblock))
+ if(HAS_TRAIT(src, TRAIT_TELEKINESIS))
A.attack_tk(src)
if(isturf(A) && get_dist(src, A) <= 1)
diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm
index 7b9dc898399..5e22e548a99 100644
--- a/code/_onclick/telekinesis.dm
+++ b/code/_onclick/telekinesis.dm
@@ -39,7 +39,7 @@
/obj/item/attack_tk(mob/user)
if(user.stat || !isturf(loc))
return
- if(user.dna?.GetSEState(GLOB.teleblock) && !user.get_active_hand()) // both should already be true to get here
+ if(HAS_TRAIT(user, TRAIT_TELEKINESIS) && !user.get_active_hand()) // both should already be true to get here
var/obj/item/tk_grab/O = new(src)
O.form_grab(user, src)
else
@@ -109,7 +109,7 @@
if(!host || host != user)
qdel(src)
return
- if(!host.dna?.GetSEState(GLOB.teleblock))
+ if(!HAS_TRAIT(host, TRAIT_TELEKINESIS))
qdel(src)
return
if(isobj(target) && !isturf(target.loc))
diff --git a/code/game/dna/mutations/powers.dm b/code/game/dna/mutations/powers.dm
index e8fa3998df3..c0e20372a19 100644
--- a/code/game/dna/mutations/powers.dm
+++ b/code/game/dna/mutations/powers.dm
@@ -185,6 +185,7 @@
activation_messages = list("You feel smarter.")
deactivation_messages = list("You feel dumber.")
instability = GENE_INSTABILITY_MAJOR
+ traits_to_add = list(TRAIT_TELEKINESIS)
activation_prob = 15
/datum/mutation/tk/New()
diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm
index e7aafa88fac..e275b747814 100644
--- a/code/modules/power/lighting.dm
+++ b/code/modules/power/lighting.dm
@@ -578,7 +578,7 @@
if(prot > 0 || HAS_TRAIT(user, TRAIT_RESISTHEAT) || HAS_TRAIT(user, TRAIT_RESISTHEATHANDS))
to_chat(user, "You remove the light [fitting]")
- else if(user.dna?.GetSEState(GLOB.teleblock))
+ else if(HAS_TRAIT(user, TRAIT_TELEKINESIS))
to_chat(user, "You telekinetically remove the light [fitting].")
else
if(user.a_intent == INTENT_DISARM || user.a_intent == INTENT_GRAB)
diff --git a/code/modules/tgui/states.dm b/code/modules/tgui/states.dm
index 383344317c1..07a74544181 100644
--- a/code/modules/tgui/states.dm
+++ b/code/modules/tgui/states.dm
@@ -113,6 +113,6 @@
return STATUS_CLOSE // Otherwise, we got nothing.
/mob/living/carbon/human/shared_living_ui_distance(atom/movable/src_object)
- if(dna.GetSEState(GLOB.teleblock) && (get_dist(src, src_object) <= 2))
+ if(HAS_TRAIT(src, TRAIT_TELEKINESIS) && (get_dist(src, src_object) <= 2))
return STATUS_INTERACTIVE
return ..()