From 9d199a8f64b620a6a0db4d1e9eccf893ec63de21 Mon Sep 17 00:00:00 2001 From: matttheficus <57759731+matttheficus@users.noreply.github.com> Date: Thu, 19 Jan 2023 15:10:13 -0500 Subject: [PATCH] Limits Telegun to Current Z-Level (Unless a Beacon is Emagged) (#20097) * Update telegun.dm * i am bad at logic I got a 72% in the class * im bad two electric boogaloo * Caps Moment * Update telegun.dm * I cant code, this finally worked * TC update * Update special.dm * it works, yipee * Sirryan review * safety is good Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> --- code/datums/uplink_item.dm | 4 ++-- code/modules/projectiles/guns/energy/telegun.dm | 5 +++-- code/modules/projectiles/projectile/special.dm | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/code/datums/uplink_item.dm b/code/datums/uplink_item.dm index 2d0d191d96a..373b989c0db 100644 --- a/code/datums/uplink_item.dm +++ b/code/datums/uplink_item.dm @@ -356,10 +356,10 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item)) /datum/uplink_item/jobspecific/telegun name = "Telegun" - desc = "An extremely high-tech energy gun that utilizes bluespace technology to teleport away living targets. Select the target beacon on the telegun itself; projectiles will send targets to the beacon locked onto." + desc = "An extremely high-tech energy gun that utilizes bluespace technology to teleport away living targets. Select the target beacon on the telegun itself; projectiles will send targets to the beacon locked onto. Can only send targets to beacons in-sector unless they are emagged!" reference = "TG" item = /obj/item/gun/energy/telegun - cost = 12 + cost = 10 job = list("Research Director") //Roboticist diff --git a/code/modules/projectiles/guns/energy/telegun.dm b/code/modules/projectiles/guns/energy/telegun.dm index 17b1aca227b..8b50d2db786 100644 --- a/code/modules/projectiles/guns/energy/telegun.dm +++ b/code/modules/projectiles/guns/energy/telegun.dm @@ -2,7 +2,7 @@ /obj/item/gun/energy/telegun name = "teleporter gun" - desc = "An extremely high-tech bluespace energy gun capable of teleporting targets to far off locations." + desc = "An extremely high-tech bluespace energy gun capable of teleporting targets to Bluespace Beacons." icon_state = "telegun" item_state = "ionrifle" origin_tech = "combat=6;materials=7;powerstorage=5;bluespace=5;syndicate=4" @@ -20,11 +20,12 @@ for(var/obj/item/radio/beacon/R in GLOB.beacons) var/turf/T = get_turf(R) + var/turf/M = get_turf(user) if(!T) continue if(!is_teleport_allowed(T.z)) continue - if(R.syndicate) + if(T.z != M.z && !R.emagged) continue var/tmpname = T.loc.name if(areaindex[tmpname]) diff --git a/code/modules/projectiles/projectile/special.dm b/code/modules/projectiles/projectile/special.dm index c7874734724..86e0a7a6f1a 100644 --- a/code/modules/projectiles/projectile/special.dm +++ b/code/modules/projectiles/projectile/special.dm @@ -244,7 +244,7 @@ damage = 0 nodamage = 1 alwayslog = TRUE - var/teleport_target = null + var/obj/item/radio/beacon/teleport_target = null /obj/item/projectile/energy/teleport/New(loc, tele_target) ..(loc) @@ -252,8 +252,9 @@ teleport_target = tele_target /obj/item/projectile/energy/teleport/on_hit(atom/target, blocked = 0) - if(isliving(target)) - if(teleport_target) + var/turf/target_turf = get_turf(teleport_target) + if(isliving(target) && istype(target_turf)) + if(target_turf.z == target.z || teleport_target.emagged) do_teleport(target, teleport_target, 0)//teleport what's in the tile to the beacon else do_teleport(target, target, 15) //Otherwise it just warps you off somewhere.