Fixes eigen lockers bypassing TP protection (#74722)

## About The Pull Request
Fixes eigenlockers bypassing teleport protections.


![image](https://user-images.githubusercontent.com/41448081/231939450-42287185-48f4-4a3b-ac7a-38adc0600633.png)

Tested w/ one and multiple lockers, prevents entering or exiting from a
tp-prot eigenlocker

## Why It's Good For The Game
This came up in an away mission designed to be a "one-way-trip", the
only exit being at the very end of the away mission. However, people are
able to bypass this with eigenlockers, thanks to them performing no
teleportation checks, which I believe is an oversight.

## Changelog
🆑
fix: Eigenstasium lockers no longer bypass teleport protection
/🆑

---------

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: san7890 <the@san7890.com>
This commit is contained in:
Zonespace
2023-04-16 15:03:19 -07:00
committed by GitHub
parent aff3095ad9
commit fa644f7aee
7 changed files with 45 additions and 21 deletions

View File

@@ -64,19 +64,8 @@
if(!destturf || !curturf || destturf.is_transition_turf())
return FALSE
var/area/from_area = get_area(curturf)
var/area/to_area = get_area(destturf)
if(!forced)
if(HAS_TRAIT(teleatom, TRAIT_NO_TELEPORT))
return FALSE
if((from_area.area_flags & NOTELEPORT) || (to_area.area_flags & NOTELEPORT))
return FALSE
if(SEND_SIGNAL(teleatom, COMSIG_MOVABLE_TELEPORTED, destination, channel) & COMPONENT_BLOCK_TELEPORT)
return FALSE
if(SEND_SIGNAL(destturf, COMSIG_ATOM_INTERCEPT_TELEPORT, channel, curturf, destturf) & COMPONENT_BLOCK_TELEPORT)
if(!check_teleport_valid(teleatom, destination, channel))
return FALSE
if(isobserver(teleatom))
@@ -202,3 +191,28 @@
var/list/turfs = get_teleport_turfs(center, precision)
if (length(turfs))
return pick(turfs)
/// Validates that the teleport being attempted is valid or not
/proc/check_teleport_valid(atom/teleported_atom, atom/destination, channel)
var/area/origin_area = get_area(teleported_atom)
var/turf/origin_turf = get_turf(teleported_atom)
var/area/destination_area = get_area(destination)
var/turf/destination_turf = get_turf(destination)
if(HAS_TRAIT(teleported_atom, TRAIT_NO_TELEPORT))
return FALSE
if((origin_area.area_flags & NOTELEPORT) || (destination_area.area_flags & NOTELEPORT))
return FALSE
if(SEND_SIGNAL(teleported_atom, COMSIG_MOVABLE_TELEPORTING, destination, channel) & COMPONENT_BLOCK_TELEPORT)
return FALSE
if(SEND_SIGNAL(destination_turf, COMSIG_ATOM_INTERCEPT_TELEPORTING, channel, origin_turf, destination_turf) & COMPONENT_BLOCK_TELEPORT)
return FALSE
SEND_SIGNAL(teleported_atom, COMSIG_MOVABLE_TELEPORTED, destination, channel)
SEND_SIGNAL(destination_turf, COMSIG_ATOM_INTERCEPT_TELEPORTED, channel, origin_turf, destination_turf)
return TRUE