From e53c8605202736ebc32b6a200da2ebfcda027989 Mon Sep 17 00:00:00 2001
From: SkyratBot <59378654+SkyratBot@users.noreply.github.com>
Date: Sun, 23 Aug 2020 20:22:50 +0200
Subject: [PATCH] [MIRROR] Megafauna teleportion exploit fix (#475)
* Megafauna teleportion exploit fix (#53093)
Prevents megafauna from being added to a chilling bluespace extract's linked list, removing a way of teleporting all the megafauna from lavaland onto the station at once.
Also prevents regenerative bluespace extracts from instantly teleporting megas to where the extract was made.
* Megafauna teleportion exploit fix
Co-authored-by: ArcaneDefence <51932756+ArcaneDefence@users.noreply.github.com>
---
.../crossbreeding/_status_effects.dm | 8 ++++----
.../xenobiology/crossbreeding/chilling.dm | 3 +++
.../xenobiology/crossbreeding/regenerative.dm | 17 +++++++++--------
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm
index 4439a19b448..f49b4c7ded1 100644
--- a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm
+++ b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm
@@ -83,10 +83,10 @@
if(interrupted || !ismob(target))
to_chat(owner, "The bluespace tug fades away, and you feel that the force has passed you by.")
return
- owner.visible_message("[owner] disappears in a flurry of sparks!",
- "The unknown force snatches briefly you from reality, and deposits you next to [target]!")
- do_sparks(3, TRUE, owner)
- owner.forceMove(target.loc)
+ var/turf/old_location = get_turf(owner)
+ if(do_teleport(owner, target.loc, channel = TELEPORT_CHANNEL_QUANTUM)) //despite being named a bluespace teleportation method the quantum channel is used to preserve precision teleporting with a bag of holding
+ old_location.visible_message("[owner] disappears in a flurry of sparks!")
+ to_chat(owner, "The unknown force snatches briefly you from reality, and deposits you next to [target]!")
/obj/screen/alert/status_effect/freon/stasis
desc = "You're frozen inside of a protective ice cube! While inside, you can't do anything, but are immune to harm! Resist to get out."
diff --git a/code/modules/research/xenobiology/crossbreeding/chilling.dm b/code/modules/research/xenobiology/crossbreeding/chilling.dm
index 1f1aafb804c..3acdf7ff779 100644
--- a/code/modules/research/xenobiology/crossbreeding/chilling.dm
+++ b/code/modules/research/xenobiology/crossbreeding/chilling.dm
@@ -149,6 +149,9 @@ Chilling extracts:
/obj/item/slimecross/chilling/bluespace/afterattack(atom/target, mob/user, proximity)
if(!proximity || !isliving(target) || active)
return
+ if(HAS_TRAIT(target, TRAIT_NO_TELEPORT))
+ to_chat(user, "[target] resists being linked with [src]!")
+ return
if(target in allies)
allies -= target
to_chat(user, "You unlink [src] with [target].")
diff --git a/code/modules/research/xenobiology/crossbreeding/regenerative.dm b/code/modules/research/xenobiology/crossbreeding/regenerative.dm
index 80b89fe0428..b6b39a7a699 100644
--- a/code/modules/research/xenobiology/crossbreeding/regenerative.dm
+++ b/code/modules/research/xenobiology/crossbreeding/regenerative.dm
@@ -23,11 +23,11 @@ Regenerative extracts:
to_chat(user, "[src] will not work on the dead!")
return
if(H != user)
- user.visible_message("[user] crushes the [src] over [H], the milky goo quickly regenerating all of [H.p_their()] injuries!",
- "You squeeze the [src], and it bursts over [H], the milky goo regenerating [H.p_their()] injuries.")
+ user.visible_message("[user] crushes [src] over [H], the milky goo quickly regenerating all of [H.p_their()] injuries!",
+ "You squeeze [src], and it bursts over [H], the milky goo regenerating [H.p_their()] injuries.")
else
- user.visible_message("[user] crushes the [src] over [user.p_them()]self, the milky goo quickly regenerating all of [user.p_their()] injuries!",
- "You squeeze the [src], and it bursts in your hand, splashing you with milky goo which quickly regenerates your injuries!")
+ user.visible_message("[user] crushes [src] over [user.p_them()]self, the milky goo quickly regenerating all of [user.p_their()] injuries!",
+ "You squeeze [src], and it bursts in your hand, splashing you with milky goo which quickly regenerates your injuries!")
core_effect_before(H, user)
H.revive(full_heal = TRUE, admin_revive = FALSE)
core_effect(H, user)
@@ -144,10 +144,11 @@ Regenerative extracts:
var/turf/open/T
/obj/item/slimecross/regenerative/bluespace/core_effect(mob/living/target, mob/user)
- target.visible_message("[src] disappears in a shower of sparks!","The milky goo teleports you somewhere it remembers!")
- do_sparks(5,FALSE,target)
- target.forceMove(T)
- do_sparks(5,FALSE,target)
+ var/turf/old_location = get_turf(target)
+ if(do_teleport(target, T, channel = TELEPORT_CHANNEL_QUANTUM)) //despite being named a bluespace teleportation method the quantum channel is used to preserve precision teleporting with a bag of holding
+ old_location.visible_message("[target] disappears in a shower of sparks!")
+ to_chat(target, "The milky goo teleports you somewhere it remembers!")
+
/obj/item/slimecross/regenerative/bluespace/Initialize()
. = ..()