Merge pull request #9303 from Kyep/teleport_fixes

Teleportation Fixes
This commit is contained in:
Crazy Lemon
2018-08-22 22:44:18 -07:00
committed by GitHub
10 changed files with 84 additions and 27 deletions
+19 -4
View File
@@ -1,5 +1,5 @@
//wrapper
/proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null)
/proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null, bypass_area_flag=FALSE)
var/datum/teleport/instant/science/D = new
if(D.start(arglist(args)))
return 1
@@ -14,14 +14,15 @@
var/soundin //soundfile to play before teleportation
var/soundout //soundfile to play after teleportation
var/force_teleport = 1 //if false, teleport will use Move() proc (dense objects will prevent teleportation)
var/ignore_area_flag = FALSE
/datum/teleport/proc/start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null)
/datum/teleport/proc/start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null, bypass_area_flag=FALSE)
if(!initTeleport(arglist(args)))
return 0
return 1
/datum/teleport/proc/initTeleport(ateleatom,adestination,aprecision,afteleport,aeffectin,aeffectout,asoundin,asoundout)
/datum/teleport/proc/initTeleport(ateleatom, adestination, aprecision, afteleport, aeffectin, aeffectout, asoundin, asoundout, bypass_area_flag=FALSE)
if(!setTeleatom(ateleatom))
return 0
if(!setDestination(adestination))
@@ -31,6 +32,7 @@
setEffects(aeffectin,aeffectout)
setForceTeleport(afteleport)
setSounds(asoundin,asoundout)
ignore_area_flag = bypass_area_flag
return 1
//must succeed
@@ -97,7 +99,8 @@
var/turf/destturf
var/turf/curturf = get_turf(teleatom)
var/area/destarea = get_area(destination)
var/area/curarea = get_area(curturf)
if(precision)
var/list/posturfs = list()
var/center = get_turf(destination)
@@ -109,6 +112,18 @@
else
destturf = get_turf(destination)
if(!is_teleport_allowed(destturf.z))
return 0
// Only check the destination zlevel for is_teleport_allowed. Checking origin as well breaks ERT teleporters.
var/area/destarea = get_area(destturf)
if(!ignore_area_flag)
if(curarea.tele_proof)
return 0
if(destarea.tele_proof)
return 0
if(!destturf || !curturf)
return 0
+3
View File
@@ -9,6 +9,7 @@
use_power = 1
idle_power_usage = 0
var/syndicate = 0
var/area_bypass = FALSE
var/obj/item/radio/beacon/Beacon
var/enabled = TRUE
@@ -22,6 +23,7 @@
Beacon.invisibility = INVISIBILITY_MAXIMUM
Beacon.loc = T
Beacon.syndicate = syndicate
Beacon.area_bypass = area_bypass
hide(T.intact)
/obj/machinery/bluespace_beacon/proc/destroy_beacon()
@@ -64,6 +66,7 @@
/obj/machinery/bluespace_beacon/syndicate
syndicate = TRUE
enabled = FALSE
area_bypass = TRUE // This enables teleports to this beacon to bypass the tele_proof flag of /area/s. Intended for depot syndi teleport computer.
var/obj/machinery/computer/syndicate_depot/teleporter/mycomputer
/obj/machinery/bluespace_beacon/syndicate/New()
+2 -4
View File
@@ -351,7 +351,7 @@
icon_screen = "telesci"
icon_keyboard = "teleport_key"
var/obj/machinery/bluespace_beacon/syndicate/mybeacon
var/obj/effect/portal/myportal
var/obj/effect/portal/redspace/myportal
var/portal_enabled = FALSE
var/portaldir = WEST
@@ -405,10 +405,8 @@
if(!tele_target)
return
var/turf/portal_turf = get_step(src, portaldir)
var/obj/effect/portal/P = new(portal_turf, tele_target, src, 0)
var/obj/effect/portal/redspace/P = new(portal_turf, tele_target, src, 0)
myportal = P
P.failchance = 0
P.icon_state = "portal1"
var/area/A = get_area(tele_target)
P.name = "[A] portal"
else if(!portal_enabled && myportal)
+4 -1
View File
@@ -132,6 +132,7 @@
playsound(get_turf(src), 'sound/weapons/emitter2.ogg', 25, 1, extrarange = 3, falloff = 5)
flick("qpad-beam", linked_pad)
playsound(get_turf(linked_pad), 'sound/weapons/emitter2.ogg', 25, 1, extrarange = 3, falloff = 5)
var/tele_success = TRUE
for(var/atom/movable/ROI in get_turf(src))
// if is anchored, don't let through
if(ROI.anchored)
@@ -145,4 +146,6 @@
continue
else if(!isobserver(ROI))
continue
do_teleport(ROI, get_turf(linked_pad))
tele_success = do_teleport(ROI, get_turf(linked_pad))
if(!tele_success)
to_chat(user, "<span class='warning'>Teleport failed due to bluespace interference.</span>")
+17 -8
View File
@@ -11,6 +11,7 @@
var/calibrating
var/turf/target //Used for one-time-use teleport cards (such as clown planet coordinates.)
//Setting this to 1 will set src.locked to null after a player enters the portal and will not allow hand-teles to open portals to that location.
var/area_bypass = FALSE
/obj/machinery/computer/teleporter/New()
src.id = "[rand(1000, 9999)]"
@@ -87,7 +88,7 @@
data["accurate"] = null
data["regime"] = regime_set
var/area/targetarea = get_area(target)
data["target"] = (!target) ? "None" : sanitize(targetarea.name)
data["target"] = (!target || !targetarea) ? "None" : sanitize(targetarea.name)
data["calibrating"] = calibrating
data["locked"] = locked
return data
@@ -172,6 +173,7 @@
locked = null
/obj/machinery/computer/teleporter/proc/set_target(mob/user)
area_bypass = FALSE
if(regime_set == "Teleporter")
var/list/L = list()
var/list/areaindex = list()
@@ -211,7 +213,10 @@
var/desc = input("Please select a location to lock in.", "Locking Computer") in L
target = L[desc]
if(istype(target, /obj/item/radio/beacon))
var/obj/item/radio/beacon/B = target
if(B.area_bypass)
area_bypass = TRUE
else
var/list/L = list()
var/list/areaindex = list()
@@ -335,7 +340,11 @@
to_chat(T, "[pick(TPError)]")
return
else
teleport(M)
if(!teleport(M) && isliving(M)) // the isliving(M) is needed to avoid triggering errors if a spark bumps the telehub
visible_message("<span class='warning'>[src] emits a loud buzz, as its teleport portal flickers and fails!</span>")
playsound(loc, 'sound/machines/buzz-sigh.ogg', 50, 0)
power_station.toggle() // turn off the portal.
use_power(5000)
//--FalseIncarnate
return
@@ -353,6 +362,7 @@
return ..()
/obj/machinery/teleport/hub/proc/teleport(atom/movable/M as mob|obj, turf/T)
. = TRUE
var/obj/machinery/computer/teleporter/com = power_station.teleporter_console
if(!com)
return
@@ -361,11 +371,10 @@
return
if(istype(M, /atom/movable))
if(!calibrated && prob(25 - ((accurate) * 10))) //oh dear a problem
do_teleport(M, locate(rand((2*TRANSITIONEDGE), world.maxx - (2*TRANSITIONEDGE)), rand((2*TRANSITIONEDGE), world.maxy - (2*TRANSITIONEDGE)), 3), 2)
. = do_teleport(M, locate(rand((2*TRANSITIONEDGE), world.maxx - (2*TRANSITIONEDGE)), rand((2*TRANSITIONEDGE), world.maxy - (2*TRANSITIONEDGE)), 3), 2, bypass_area_flag = com.area_bypass)
else
do_teleport(M, com.target)
. = do_teleport(M, com.target, bypass_area_flag = com.area_bypass)
calibrated = 0
return
/obj/machinery/teleport/hub/update_icon()
if(panel_open)
@@ -574,8 +583,8 @@
visible_message("<span class='alert'>No target detected.</span>")
src.engaged = 0
teleporter_hub.update_icon()
src.add_fingerprint(user)
return
if(istype(user))
add_fingerprint(user)
/obj/machinery/teleport/station/power_change()
..()
+22 -4
View File
@@ -11,6 +11,7 @@
anchored = 1
var/precision = 1 // how close to the portal you will teleport. 0 = on the portal, 1 = adjacent
var/can_multitool_to_remove = 0
var/ignore_tele_proof_area_setting = FALSE
/obj/effect/portal/Bumped(mob/M as mob|obj)
teleport(M)
@@ -42,12 +43,29 @@
qdel(src)
return
if(istype(M, /atom/movable))
if(prob(failchance)) //oh dear a problem, put em in deep space
if(prob(failchance))
src.icon_state = "portal1"
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, bypass_area_flag = ignore_tele_proof_area_setting)) // Try to send them to deep space.
invalid_teleport()
else
do_teleport(M, target, precision) ///You will appear adjacent to the beacon
if(!do_teleport(M, target, precision, bypass_area_flag = ignore_tele_proof_area_setting)) // Try to send them to a turf adjacent to target.
invalid_teleport()
/obj/effect/portal/attackby(obj/item/A, mob/user)
if(istype(A, /obj/item/multitool) && can_multitool_to_remove)
qdel(src)
qdel(src)
/obj/effect/portal/proc/invalid_teleport()
visible_message("<span class='warning'>[src] flickers and fails due to bluespace interference!</span>")
var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread()
spark_system.set_up(5, 0, loc)
spark_system.start()
qdel(src)
/obj/effect/portal/redspace
name = "redspace portal"
desc = "A portal capable of bypassing bluespace interference."
icon_state = "portal1"
failchance = 0
ignore_tele_proof_area_setting = TRUE
@@ -7,6 +7,7 @@
origin_tech = "bluespace=1"
var/emagged = 0
var/syndicate = 0
var/area_bypass = FALSE
/obj/item/radio/beacon/New()
..()
+9 -5
View File
@@ -315,12 +315,16 @@
/datum/plant_gene/trait/teleport/on_slip(obj/item/reagent_containers/food/snacks/grown/G, mob/living/carbon/C)
var/teleport_radius = max(round(G.seed.potency / 10), 1)
var/turf/T = get_turf(C)
to_chat(C, "<span class='warning'>You slip through spacetime!</span>")
do_teleport(C, T, teleport_radius)
if(prob(50))
do_teleport(G, T, teleport_radius)
if(do_teleport(C, T, teleport_radius))
to_chat(C, "<span class='warning'>You slip through spacetime!</span>")
if(prob(50))
do_teleport(G, T, teleport_radius)
else
new /obj/effect/decal/cleanable/molten_object(T) //Leave a pile of goo behind for dramatic effect...
qdel(G)
else
new /obj/effect/decal/cleanable/molten_object(T) //Leave a pile of goo behind for dramatic effect...
to_chat(C, "<span class='warning'>[src] sparks, and burns up!</span>")
new /obj/effect/decal/cleanable/molten_object(T)
qdel(G)
+3
View File
@@ -664,6 +664,9 @@
var/turf/T = get_turf(H)
T.add_vomit_floor(H)
playsound(H, 'sound/effects/splat.ogg', 50, 1)
else
visible_message("<span class='warning'>[src] flickers and fails, due to bluespace interference!</span>")
qdel(src)
/**********************Resonator**********************/
+4 -1
View File
@@ -311,7 +311,10 @@
return
if(teles_left > 0)
doteleport(user)
if(!doteleport(user))
telefail()
temp_msg = "ERROR! Target destination unreachable due to interference."
return
else
telefail()
temp_msg = "ERROR!<BR>Calibration required."