diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index ed8aaaf401..e46e664eb8 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -388,3 +388,11 @@
/turf/proc/process()
return PROCESS_KILL
+
+/turf/proc/contains_dense_objects()
+ if(density)
+ return 1
+ for(var/atom/A in src)
+ if(A.density && !(A.flags & ON_BORDER))
+ return 1
+ return 0
diff --git a/code/modules/clothing/spacesuits/rig/modules/ninja.dm b/code/modules/clothing/spacesuits/rig/modules/ninja.dm
index ef2dff6738..6b1362a766 100644
--- a/code/modules/clothing/spacesuits/rig/modules/ninja.dm
+++ b/code/modules/clothing/spacesuits/rig/modules/ninja.dm
@@ -119,10 +119,8 @@
H << "You cannot use your teleporter on this Z-level."
return 0
- for(var/atom/A in T)
- if(A.density && !(A.flags & ON_BORDER))
- H << "You cannot teleport to a location with solid objects."
- return 0
+ if(T.contains_dense_objects())
+ H << "You cannot teleport to a location with solid objects."
phase_out(H,get_turf(H))
H.loc = T
diff --git a/code/modules/spells/spell_code.dm b/code/modules/spells/spell_code.dm
index 0847146c9a..ba631391b4 100644
--- a/code/modules/spells/spell_code.dm
+++ b/code/modules/spells/spell_code.dm
@@ -189,7 +189,11 @@ var/list/spells = typesof(/spell) //needed for the badmin verb for now
if(silenced > 0)
return
- if(user.z == 2 && spell_flags & Z2NOCAST) //Certain spells are not allowed on the centcomm zlevel
+ var/turf/Turf = get_turf(user)
+ if(!Turf)
+ user << "You cannot cast spells in null space!"
+
+ if(spell_flags & Z2NOCAST && (Turf.z in config.admin_levels)) //Certain spells are not allowed on the centcomm zlevel
return 0
if(spell_flags & CONSTRUCT_CHECK)
diff --git a/code/modules/spells/targeted/ethereal_jaunt.dm b/code/modules/spells/targeted/ethereal_jaunt.dm
index 12dfd55caa..d553b16553 100644
--- a/code/modules/spells/targeted/ethereal_jaunt.dm
+++ b/code/modules/spells/targeted/ethereal_jaunt.dm
@@ -36,7 +36,7 @@
target.monkeyizing=0 //mob is safely inside holder now, no need for protection.
jaunt_steam(mobloc)
sleep(duration)
- mobloc = get_turf(target.loc)
+ mobloc = holder.last_valid_turf
animation.loc = mobloc
jaunt_steam(mobloc)
target.canmove = 0
@@ -75,6 +75,11 @@
var/reappearing = 0
density = 0
anchored = 1
+ var/turf/last_valid_turf
+
+/obj/effect/dummy/spell_jaunt/New(var/location)
+ ..()
+ last_valid_turf = get_turf(location)
/obj/effect/dummy/spell_jaunt/Destroy()
// Eject contents if deleted somehow
@@ -87,6 +92,9 @@
var/turf/newLoc = get_step(src,direction)
if(!(newLoc.flags & NOJAUNT))
loc = newLoc
+ var/turf/T = get_turf(loc)
+ if(!T.contains_dense_objects())
+ last_valid_turf = T
else
user << "Some strange aura is blocking the way!"
src.canmove = 0