From 98ee507de8a51bc592d8211bec6d3a199e47cae8 Mon Sep 17 00:00:00 2001 From: nullbear Date: Thu, 9 Jun 2016 01:33:25 -0700 Subject: [PATCH] Adds noteleport variable This is mostly a pre-setup for my greater-bag-of-holding stuff. You can't use bluespace crystals/jaunters/hand teleporters to access bluespace-proofed areas. at the moment, this only applies to shuttles and centcomm. Teleport beacons placed in bluespace proofed rooms can't be teleported to, except via teleporter station hub. A little concerned because now 'hijack' antags cant use teleprods to fling everyone out of the shuttle while in transit. q_q could easily just make the shuttle non-bluespace proof though. Note for mappers: This means you can create ruins that can't be teleported into using bspace crystals by setting the area "noteleport" to 1. This can be used to force players to travel through the ruin the way they're intended to. Or to prevent them from gaining access to areas they shouldnt normally be able to. (ie. the wishgranter ruin) --- code/datums/helper_datums/teleport.dm | 9 ++++++++- code/game/area/Space_Station_13_areas.dm | 7 ++++++- code/game/objects/effects/portals.dm | 4 ++++ code/game/objects/items/weapons/teleportation.dm | 15 +++++++++++++-- code/game/objects/items/weapons/teleprod.dm | 9 ++++++--- code/modules/projectiles/guns/magic/wand.dm | 10 +++++----- code/modules/projectiles/projectile/magic.dm | 10 +++++----- 7 files changed, 47 insertions(+), 17 deletions(-) diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index 1ad6ec8e32f..b8b6aa0cacb 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -103,7 +103,10 @@ if(!center) center = destination for(var/turf/T in range(precision,center)) - posturfs.Add(T) + var/area/A = T.loc + if(!A.noteleport) + posturfs.Add(T) + destturf = safepick(posturfs) else destturf = get_turf(destination) @@ -111,6 +114,10 @@ if(!destturf || !curturf) return 0 + var/area/A = get_area(curturf) + if(A.noteleport) + return 0 + playSpecials(curturf,effectin,soundin) if(force_teleport) diff --git a/code/game/area/Space_Station_13_areas.dm b/code/game/area/Space_Station_13_areas.dm index 1077f37946c..b00faf21ed4 100644 --- a/code/game/area/Space_Station_13_areas.dm +++ b/code/game/area/Space_Station_13_areas.dm @@ -54,6 +54,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station var/static_environ var/has_gravity = 0 + var/noteleport = 0 //Are you forbidden from teleporting to the area? (centcomm, mobs, wizard, hand teleporter) var/safe = 0 //Is the area teleport-safe: no space / radiation / aggresive mobs / other dangers var/no_air = null @@ -67,7 +68,7 @@ var/list/teleportlocs = list() /proc/process_teleport_locs() for(var/area/AR in world) - if(istype(AR, /area/shuttle) || istype(AR, /area/wizard_station)) continue + if(istype(AR, /area/shuttle) || istype(AR, /area/wizard_station) || AR.noteleport) continue if(teleportlocs.Find(AR.name)) continue var/turf/picked = safepick(get_area_turfs(AR.type)) if (picked && (picked.z == ZLEVEL_STATION)) @@ -175,6 +176,7 @@ var/list/teleportlocs = list() icon_state = "centcom" requires_power = 0 has_gravity = 1 + noteleport = 1 blob_allowed = 0 //Should go without saying, no blobs should take over centcom as a win condition. /area/centcom/control @@ -202,6 +204,7 @@ var/list/teleportlocs = list() icon_state = "syndie-ship" requires_power = 0 has_gravity = 1 + noteleport = 1 blob_allowed = 0 //Not... entirely sure this will ever come up... but if the bus makes blobs AND ops, it shouldn't aim for the ops to win. /area/syndicate_mothership/control @@ -284,12 +287,14 @@ var/list/teleportlocs = list() icon_state = "yellow" requires_power = 0 has_gravity = 1 + noteleport = 1 //Abductors /area/abductor_ship name = "Abductor Ship" icon_state = "yellow" requires_power = 0 + noteleport = 1 has_gravity = 1 diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm index c44eb8d5356..b1776e58c52 100644 --- a/code/game/objects/effects/portals.dm +++ b/code/game/objects/effects/portals.dm @@ -22,6 +22,10 @@ src.loc = loc src.target = target src.creator = creator + var/area/A = target.loc + if(A.noteleport) // No point in persisting if the target is unreachable. + qdel(src) + return for(var/mob/M in src.loc) src.teleport(M) if(lifespan > 0) diff --git a/code/game/objects/items/weapons/teleportation.dm b/code/game/objects/items/weapons/teleportation.dm index 0e3496cbfc7..010e07df9a7 100644 --- a/code/game/objects/items/weapons/teleportation.dm +++ b/code/game/objects/items/weapons/teleportation.dm @@ -138,12 +138,16 @@ Frequency: /obj/item/weapon/hand_tele/attack_self(mob/user) var/turf/current_location = get_turf(user)//What turf is the user on? - if(!current_location||current_location.z==2||current_location.z>=7 || !istype(user.loc, /turf))//If turf was not found or they're on z level 2 or >7 which does not currently exist. or if user is not located on a turf + var/area/current_area = current_location.loc + if(!current_location||current_area.noteleport||current_location.z>=7 || !istype(user.loc, /turf))//If turf was not found or they're on z level 2 or >7 which does not currently exist. or if user is not located on a turf user << "\The [src] is malfunctioning." return var/list/L = list( ) for(var/obj/machinery/computer/teleporter/com in machines) if(com.target) + var/area/A = get_area(com.target) + if(A.noteleport) + continue if(com.power_station && com.power_station.teleporter_hub && com.power_station.engaged) L["[get_area(com.target)] (Active)"] = com.target else @@ -154,6 +158,9 @@ Frequency: continue //putting them at the edge is dumb if(T.y>world.maxy-8 || T.y<8) continue + var/area/A = T.loc + if(A.noteleport) + continue turfs += T if(turfs.len) L["None (Dangerous)"] = pick(turfs) @@ -163,7 +170,11 @@ Frequency: if(active_portals >= 3) user.show_message("\The [src] is recharging!") return - var/T = L[t1] + var/atom/T = L[t1] + var/area/A = get_area(T) + if(A.noteleport) + user << "\The [src] is malfunctioning." + return user.show_message("Locked In.", 2) var/obj/effect/portal/P = new /obj/effect/portal(get_turf(src), T, src) try_move_adjacent(P) diff --git a/code/game/objects/items/weapons/teleprod.dm b/code/game/objects/items/weapons/teleprod.dm index b36fade0feb..8ac8b9ebaf9 100644 --- a/code/game/objects/items/weapons/teleprod.dm +++ b/code/game/objects/items/weapons/teleprod.dm @@ -10,9 +10,12 @@ if(status && user.disabilities & CLUMSY && prob(50)) user.visible_message("[user] accidentally hits themself with [src]!", \ "You accidentally hit yourself with [src]!") - user.Weaken(stunforce*3) - deductcharge(hitcost) - do_teleport(user, get_turf(user), 50)//honk honk + if(do_teleport(user, get_turf(user), 50))//honk honk + user.Weaken(stunforce*3) + deductcharge(hitcost) + else + user.Weaken(stunforce*3) + deductcharge(hitcost/4) return else if(status) diff --git a/code/modules/projectiles/guns/magic/wand.dm b/code/modules/projectiles/guns/magic/wand.dm index e6bcc070ea9..1262c57d5bd 100644 --- a/code/modules/projectiles/guns/magic/wand.dm +++ b/code/modules/projectiles/guns/magic/wand.dm @@ -125,11 +125,11 @@ no_den_usage = 1 /obj/item/weapon/gun/magic/wand/teleport/zap_self(mob/living/user) - do_teleport(user, user, 10) - var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(3, user.loc) - smoke.start() - charges-- + if(do_teleport(user, user, 10)) + var/datum/effect_system/smoke_spread/smoke = new + smoke.set_up(3, user.loc) + smoke.start() + charges-- ..() ///////////////////////////////////// diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index 0b7de405d28..9df7b5a5140 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -84,11 +84,11 @@ teleloc = target.loc for(var/atom/movable/stuff in teleloc) if(!stuff.anchored && stuff.loc) - teleammount++ - do_teleport(stuff, stuff, 10) - var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(max(round(4 - teleammount),0), stuff.loc) //Smoke drops off if a lot of stuff is moved for the sake of sanity - smoke.start() + if(do_teleport(stuff, stuff, 10)) + teleammount++ + var/datum/effect_system/smoke_spread/smoke = new + smoke.set_up(max(round(4 - teleammount),0), stuff.loc) //Smoke drops off if a lot of stuff is moved for the sake of sanity + smoke.start() /obj/item/projectile/magic/door name = "bolt of door creation"