mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 19:22:20 +00:00
Fixes eigen lockers bypassing TP protection (#74722)
## About The Pull Request Fixes eigenlockers bypassing teleport protections.  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:
@@ -76,8 +76,10 @@
|
||||
#define COMSIG_ATOM_CREATEDBY_PROCESSING "atom_createdby_processing"
|
||||
///when an atom is processed (mob/living/user, obj/item/I, list/atom/results)
|
||||
#define COMSIG_ATOM_PROCESSED "atom_processed"
|
||||
///called when teleporting into a protected turf: (channel, turf/origin)
|
||||
#define COMSIG_ATOM_INTERCEPT_TELEPORT "intercept_teleport"
|
||||
///called when teleporting into a possibly protected turf: (channel, turf/origin, turf/destination)
|
||||
#define COMSIG_ATOM_INTERCEPT_TELEPORTING "intercept_teleporting"
|
||||
///called after teleporting into a protected turf: (channel, turf/origin)
|
||||
#define COMSIG_ATOM_INTERCEPT_TELEPORTED "intercept_teleported"
|
||||
#define COMPONENT_BLOCK_TELEPORT (1<<0)
|
||||
///called when an atom is added to the hearers on get_hearers_in_view(): (list/processing_list, list/hearers)
|
||||
#define COMSIG_ATOM_HEARER_IN_VIEW "atom_hearer_in_view"
|
||||
|
||||
@@ -78,6 +78,8 @@
|
||||
#define COMSIG_MOVABLE_UPDATE_GLIDE_SIZE "movable_glide_size"
|
||||
///Called when a movable is hit by a plunger in layer mode, from /obj/item/plunger/attack_atom()
|
||||
#define COMSIG_MOVABLE_CHANGE_DUCT_LAYER "movable_change_duct_layer"
|
||||
///Called before a movable is being teleported from `check_teleport_valid()`: (destination, channel)
|
||||
#define COMSIG_MOVABLE_TELEPORTING "movable_teleporting"
|
||||
///Called when a movable is being teleported from `do_teleport()`: (destination, channel)
|
||||
#define COMSIG_MOVABLE_TELEPORTED "movable_teleported"
|
||||
///Called after a movable is teleported from `do_teleport()`: ()
|
||||
|
||||
@@ -109,6 +109,8 @@ GLOBAL_VAR_INIT(glide_size_multiplier, 1.0)
|
||||
#define TELEPORT_CHANNEL_MAGIC "magic"
|
||||
/// Cult teleportation, does whatever it wants (unless there's holiness)
|
||||
#define TELEPORT_CHANNEL_CULT "cult"
|
||||
/// Eigenstate teleportation, can do most things (that aren't in a teleport-prevented zone)
|
||||
#define TELEPORT_CHANNEL_EIGENSTATE "eigenstate"
|
||||
/// Anything else
|
||||
#define TELEPORT_CHANNEL_FREE "free"
|
||||
|
||||
|
||||
@@ -101,7 +101,11 @@ SUBSYSTEM_DEF(eigenstates)
|
||||
if(!eigen_target)
|
||||
stack_trace("No eigen target set for the eigenstate component!")
|
||||
return FALSE
|
||||
if(check_teleport_valid(thing_to_send, eigen_target, TELEPORT_CHANNEL_EIGENSTATE))
|
||||
thing_to_send.forceMove(get_turf(eigen_target))
|
||||
else
|
||||
object_sent_from.balloon_alert(thing_to_send, "nothing happens!")
|
||||
return FALSE
|
||||
//Create ONE set of sparks for ALL times in iteration
|
||||
if(spark_time != world.time)
|
||||
do_sparks(5, FALSE, eigen_target)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
I.alpha = 64
|
||||
I.appearance_flags = RESET_ALPHA
|
||||
add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/blessed_aware, "blessing", I)
|
||||
RegisterSignal(loc, COMSIG_ATOM_INTERCEPT_TELEPORT, PROC_REF(block_cult_teleport))
|
||||
RegisterSignal(loc, COMSIG_ATOM_INTERCEPT_TELEPORTING, PROC_REF(block_cult_teleport))
|
||||
|
||||
/obj/effect/blessing/Destroy()
|
||||
UnregisterSignal(loc, COMSIG_ATOM_INTERCEPT_TELEPORT)
|
||||
UnregisterSignal(loc, COMSIG_ATOM_INTERCEPT_TELEPORTING)
|
||||
return ..()
|
||||
|
||||
/obj/effect/blessing/proc/block_cult_teleport(datum/source, channel, turf/origin, turf/destination)
|
||||
|
||||
@@ -144,13 +144,13 @@
|
||||
/datum/status_effect/eldritch/blade/on_apply()
|
||||
. = ..()
|
||||
RegisterSignal(owner, COMSIG_MOVABLE_PRE_THROW, PROC_REF(on_pre_throw))
|
||||
RegisterSignal(owner, COMSIG_MOVABLE_TELEPORTED, PROC_REF(on_teleport))
|
||||
RegisterSignal(owner, COMSIG_MOVABLE_TELEPORTING, PROC_REF(on_teleport))
|
||||
RegisterSignal(owner, COMSIG_MOVABLE_MOVED, PROC_REF(on_move))
|
||||
|
||||
/datum/status_effect/eldritch/blade/on_remove()
|
||||
UnregisterSignal(owner, list(
|
||||
COMSIG_MOVABLE_PRE_THROW,
|
||||
COMSIG_MOVABLE_TELEPORTED,
|
||||
COMSIG_MOVABLE_TELEPORTING,
|
||||
COMSIG_MOVABLE_MOVED,
|
||||
))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user