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
+8 -2
View File
@@ -61,13 +61,19 @@
if(!target)
qdel(src)
return
var/has_teleported = FALSE
if(istype(M, /atom/movable))
if(has_failed) //oh dear a problem, put em in deep space
icon_state = "portal1" // only tell people the portal failed after a teleport has been done
desc = "A bluespace tear in space, reaching directly to another point within this region. Definitely unstable."
do_teleport(M, locate(rand(5, world.maxx - 5), rand(5, world.maxy -5), 3), 0)
if(do_teleport(M, locate(rand(5, world.maxx - 5), rand(5, world.maxy -5), 3), 0))
has_teleported = TRUE
else
do_teleport(M, target, precision)
if(do_teleport(M, target, precision))
has_teleported = TRUE
if(!has_teleported)
visible_message(SPAN_WARNING("\The [src] oscillates violently as \the [M] comes into contact with it, and collapses! Seems like the rift was unstable..."))
qdel(src)
/obj/effect/portal/Destroy()
if(istype(creator, /obj/item/hand_tele))
@@ -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
@@ -157,8 +157,8 @@
return
var/did_teleport = FALSE
for(var/mob/M in contents)
did_teleport = TRUE
linked_teleporter.do_teleport(M)
if(linked_teleporter.do_teleport(M))
did_teleport = TRUE
if(did_teleport)
linked_teleporter.last_use = world.time