[MIRROR] Fix teleportation putting you outside of reservations (#26319)

* Fix teleportation putting you outside of reservations  (#81203)

## About The Pull Request

Blocks teleportation if someone is about to be transported into a
reservation not intended for them.
Fixes #45529

## Why It's Good For The Game

Prevents people from GBJing themselves in the reservation level or
getting into a reservation they're not allowed to enter.
## Changelog
🆑
fix: Teleportations will no longer exceed reservation bounds.
/🆑

* Fix teleportation putting you outside of reservations

---------

Co-authored-by: distributivgesetz <distributivgesetz93@gmail.com>
This commit is contained in:
SkyratBot
2024-02-02 11:39:25 -06:00
committed by GitHub
co-authored by distributivgesetz
parent 5d0145fcee
commit 29bb098d13
+7 -2
View File
@@ -65,7 +65,7 @@
return FALSE
if(!forced)
if(!check_teleport_valid(teleatom, destination, channel))
if(!check_teleport_valid(teleatom, destturf, channel, original_destination = destination))
if(ismob(teleatom))
teleatom.balloon_alert(teleatom, "something holds you back!")
return FALSE
@@ -185,7 +185,7 @@
return pick(turfs)
/// Validates that the teleport being attempted is valid or not
/proc/check_teleport_valid(atom/teleported_atom, atom/destination, channel)
/proc/check_teleport_valid(atom/teleported_atom, atom/destination, channel, atom/original_destination = null)
var/area/origin_area = get_area(teleported_atom)
var/turf/origin_turf = get_turf(teleported_atom)
@@ -195,6 +195,11 @@
if(HAS_TRAIT(teleported_atom, TRAIT_NO_TELEPORT))
return FALSE
// prevent unprecise teleports from landing you outside of the destination's reserved area
if(is_reserved_level(destination_turf.z) && istype(original_destination) \
&& SSmapping.get_reservation_from_turf(destination_turf) != SSmapping.get_reservation_from_turf(get_turf(original_destination)))
return FALSE
if((origin_area.area_flags & NOTELEPORT) || (destination_area.area_flags & NOTELEPORT))
return FALSE