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>
This commit is contained in:
matttheficus
2023-01-19 15:10:13 -05:00
committed by GitHub
co-authored by S34N
parent c4bab6ff13
commit 9d199a8f64
3 changed files with 9 additions and 7 deletions
@@ -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])
@@ -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.