Teleportation Fixes and Tweaks (#12103)

This commit is contained in:
Doxxmedearly
2021-06-29 12:49:23 +02:00
committed by GitHub
parent 52934f9153
commit 2843ee8db8
5 changed files with 104 additions and 46 deletions
@@ -3,11 +3,26 @@
* Locator
* Hand-tele
* Closet Teleporter
* Inhibitor handling proc for above
*/
/*
* Special inhibitor handling. Different from the one used by teleport datums.
*/
/proc/check_inhibitors(var/turf/T)
for(var/found_inhibitor in bluespace_inhibitors)
var/obj/machinery/anti_bluespace/AB = found_inhibitor
if(T.z != AB.z || get_dist(T, AB) > 8 || (AB.stat & (NOPOWER | BROKEN)))
continue
else
return FALSE
return TRUE
/*
* Locator
*/
/obj/item/locator
name = "locator"
desc = "A device that can be used to track those with locator implants."
@@ -147,6 +162,11 @@ Frequency:
to_chat(user, SPAN_WARNING("\The [src] can't get a bearing on anything right now."))
return
//Cannot make one if too close to an inhibitor
if(!check_inhibitors(current_location))
to_chat(user, SPAN_DANGER("\The [src] can't seem to find a lock. Something in the area must be preventing the portal from opening..."))
return
var/list/teleport_options = list()
for(var/obj/machinery/teleport/station/S in SSmachinery.all_machines)
if(S.locked_obj)
@@ -164,6 +184,9 @@ Frequency:
continue
if(T.density || turf_contains_dense_objects(T))
continue
if(!check_inhibitors(T))
continue
potential_turfs += T
if(length(potential_turfs))
@@ -207,17 +230,21 @@ Frequency:
/obj/item/closet_teleporter/proc/do_teleport(var/mob/user)
if(!attached_closet)
to_chat(user, SPAN_WARNING("\The [src] doesn't have an attached closet!"))
return
return FALSE
if(!linked_teleporter)
to_chat(user, SPAN_WARNING("\The [src] doesn't have a linked teleporter!"))
return
return FALSE
if(!linked_teleporter.attached_closet)
to_chat(user, SPAN_WARNING("The linked teleporter doesn't have an attached closet!"))
return
return FALSE
if(last_use + 600 > world.time)
return
return FALSE
if(!check_inhibitors(get_turf(attached_closet)) || !check_inhibitors(get_turf(linked_teleporter.attached_closet)))
to_chat(user, SPAN_WARNING("Something near you or your destination is destabilizing the bluespace network between the closets. \The [src] can't get a clear link to the other side!"))
return FALSE
var/obj/structure/closet/target_closet = linked_teleporter.attached_closet
user.forceMove(target_closet)
user.forceMove(target_closet.opened ? get_turf(target_closet) : target_closet)
if(target_closet.opened)
user.visible_message(SPAN_NOTICE("\The [user] steps out of the back of \the [target_closet]."), SPAN_NOTICE("You teleport into the linked closet, stepping out of it."))
else
@@ -225,6 +252,7 @@ Frequency:
to_chat(user, SPAN_NOTICE("You teleport into the target closet, bumping into the closed door."))
target_closet.shake_animation()
playsound(get_turf(src), 'sound/effects/grillehit.ogg', 100, TRUE)
return TRUE
/obj/item/closet_teleporter/Destroy()
attached_closet = null