Skip to content

Commit

Permalink
[S] Fixes an exploit (ParadiseSS13#24703)
Browse files Browse the repository at this point in the history
* it never had a range........

* slide to the left

* guh
  • Loading branch information
BiancaWilkson authored Mar 20, 2024
1 parent d6fd9d3 commit e67f75e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion code/_onclick/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
if(HAS_TRAIT(src, TRAIT_LASEREYES) && a_intent == INTENT_HARM)
LaserEyes(A)

if(HAS_TRAIT(src, TRAIT_TELEKINESIS))
if(HAS_TRAIT(src, TRAIT_TELEKINESIS) && telekinesis_range_check(src, A))
A.attack_tk(src)

if(isturf(A) && get_dist(src, A) <= 1)
Expand Down
8 changes: 7 additions & 1 deletion code/_onclick/telekinesis.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
user.UnarmedAttack(src,0) // attack_hand, attack_paw, etc
return

/*
Returns: True if the target is within the 15 tile range of telekinesis and on the same z-level, false otherwise.
*/
/proc/telekinesis_range_check(mob/living/carbon/human/user, atom/target)
return (get_dist(user, target) <= TK_MAXRANGE && user.z == target.z)

/*
This is similar to item attack_self, but applies to anything
that you can grab with a telekinetic grab.
Expand Down Expand Up @@ -119,7 +125,7 @@
var/d = get_dist(user, target)
if(focus)
d = max(d,get_dist(user,focus)) // whichever is further
if(d > TK_MAXRANGE)
if(d > TK_MAXRANGE || user.z != target.z)
to_chat(user, "<span class='warning'>Your mind won't reach that far.</span>")
return

Expand Down

0 comments on commit e67f75e

Please sign in to comment.