diff --git a/baystation12.dme b/baystation12.dme
index 32628ed0aec..81354ef603a 100644
--- a/baystation12.dme
+++ b/baystation12.dme
@@ -1410,6 +1410,8 @@
#include "code\modules\mob\new_player\preferences_setup.dm"
#include "code\modules\mob\new_player\skill.dm"
#include "code\modules\mob\new_player\sprite_accessories.dm"
+#include "code\modules\multiz\basic.dm"
+#include "code\modules\multiz\stubs.dm"
#include "code\modules\nano\_JSON.dm"
#include "code\modules\nano\JSON Reader.dm"
#include "code\modules\nano\JSON Writer.dm"
@@ -1783,8 +1785,6 @@
#include "code\modules\virus2\items_devices.dm"
#include "code\modules\xgm\xgm_gas_data.dm"
#include "code\modules\xgm\xgm_gas_mixture.dm"
-#include "code\TriDimension\controller.dm"
-#include "code\TriDimension\controller_presets.dm"
#include "code\TriDimension\Movement.dm"
#include "code\TriDimension\Pipes.dm"
#include "code\TriDimension\Structures.dm"
diff --git a/code/TriDimension/Movement.dm b/code/TriDimension/Movement.dm
index 3637184d31a..6029e2a7c24 100644
--- a/code/TriDimension/Movement.dm
+++ b/code/TriDimension/Movement.dm
@@ -1,52 +1,51 @@
/obj/item/weapon/tank/jetpack/verb/moveup()
set name = "Move Upwards"
set category = "Object"
+
+ . = 1
if(allow_thrust(0.01, usr))
- var/turf/controllerlocation = locate(1, 1, usr.z)
- var/legal = 0
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- legal = controller.up
- if (controller.up)
- var/turf/T = locate(usr.x, usr.y, controller.up_target)
- if(T && (istype(T, /turf/space) || istype(T, /turf/simulated/floor/open)))
- var/blocked = 0
- for(var/atom/A in T.contents)
- if(A.density)
- blocked = 1
- usr << "You bump into \the [A]."
- break
- if(!blocked)
- usr.Move(T)
- usr << "You move upwards."
- else
- usr << "There is something in your way."
- if (legal == 0)
- usr << "There is nothing of interest in this direction."
- return 1
+ usr << "Your [src] is disabled."
+ return
+
+ var/turf/above = GetAbove(src)
+ if(!istype(above))
+ usr << "There is nothing of interest in this direction."
+ return
+
+ if(!istype(above, /turf/space) && !istype(above, /turf/simulated/open))
+ usr << "You bump against \the [above]."
+ return
+
+ for(var/atom/A in above)
+ if(A.density)
+ usr << "\The [A] blocks you."
+ return
+
+ usr.Move(above)
+ usr << "You move upwards."
/obj/item/weapon/tank/jetpack/verb/movedown()
set name = "Move Downwards"
set category = "Object"
+
+ . = 1
if(allow_thrust(0.01, usr))
- var/turf/controllerlocation = locate(1, 1, usr.z)
- var/legal = 0
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- legal = controller.down
- if (controller.down == 1)
- var/turf/T = locate(usr.x, usr.y, controller.down_target)
- var/turf/S = locate(usr.x, usr.y, usr.z)
- if(T && (istype(S, /turf/space) || istype(S, /turf/simulated/floor/open)))
- var/blocked = 0
- for(var/atom/A in T.contents)
- if(A.density)
- blocked = 1
- usr << "You bump into \the [A]."
- break
- if(!blocked)
- usr.Move(T)
- usr << "You move downwards."
- else
- usr << "You cant move through the floor."
- if (legal == 0)
- usr << "There is nothing of interest in this direction."
- return 1
+ usr << "Your [src] is disabled."
+ return
+
+ var/turf/above = GetBelow(src)
+ if(!istype(above))
+ usr << "There is nothing of interest in this direction."
+ return
+
+ if(!istype(above, /turf/space) && !istype(above, /turf/simulated/open))
+ usr << "You bump against \the [above]."
+ return
+
+ for(var/atom/A in above)
+ if(A.density)
+ usr << "\The [A] blocks you."
+ return
+
+ usr.Move(above)
+ usr << "You move upwards."
diff --git a/code/TriDimension/Pipes.dm b/code/TriDimension/Pipes.dm
index 2a4771744e4..85e23b6797f 100644
--- a/code/TriDimension/Pipes.dm
+++ b/code/TriDimension/Pipes.dm
@@ -136,16 +136,13 @@ obj/machinery/atmospherics/pipe/zpipe/up/initialize()
node1 = target
break
- var/turf/controllerlocation = locate(1, 1, src.z)
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- if(controller.up)
- var/turf/above = locate(src.x, src.y, controller.up_target)
- if(above)
- for(var/obj/machinery/atmospherics/target in above)
- if(target.initialize_directions && istype(target, /obj/machinery/atmospherics/pipe/zpipe/down))
- if (check_connect_types(target,src))
- node2 = target
- break
+ var/turf/above = GetAbove(src)
+ if(above)
+ for(var/obj/machinery/atmospherics/target in above)
+ if(target.initialize_directions && istype(target, /obj/machinery/atmospherics/pipe/zpipe/down))
+ if (check_connect_types(target,src))
+ node2 = target
+ break
var/turf/T = src.loc // hide if turf is not intact
@@ -177,16 +174,13 @@ obj/machinery/atmospherics/pipe/zpipe/down/initialize()
node1 = target
break
- var/turf/controllerlocation = locate(1, 1, src.z)
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- if(controller.down)
- var/turf/below = locate(src.x, src.y, controller.down_target)
- if(below)
- for(var/obj/machinery/atmospherics/target in below)
- if(target.initialize_directions && istype(target, /obj/machinery/atmospherics/pipe/zpipe/up))
- if (check_connect_types(target,src))
- node2 = target
- break
+ var/turf/below = GetBelow(src)
+ if(below)
+ for(var/obj/machinery/atmospherics/target in below)
+ if(target.initialize_directions && istype(target, /obj/machinery/atmospherics/pipe/zpipe/up))
+ if (check_connect_types(target,src))
+ node2 = target
+ break
var/turf/T = src.loc // hide if turf is not intact
diff --git a/code/TriDimension/Structures.dm b/code/TriDimension/Structures.dm
index 99151936f5f..1790dc1786d 100644
--- a/code/TriDimension/Structures.dm
+++ b/code/TriDimension/Structures.dm
@@ -25,17 +25,12 @@
proc/connect()
if(icon_state == "ladderdown") // the upper will connect to the lower
d_state = 1
- var/turf/controllerlocation = locate(1, 1, z)
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- if(controller.down)
- var/turf/below = locate(src.x, src.y, controller.down_target)
- for(var/obj/multiz/ladder/L in below)
- if(L.icon_state == "ladderup")
- target = L
- L.target = src
- d_state = 0
- break
- return
+ for(var/obj/multiz/ladder/L in GetBelow(src))
+ if(L.icon_state == "ladderup")
+ target = L
+ L.target = src
+ d_state = 0
+ return
/* ex_act(severity)
switch(severity)
@@ -210,12 +205,9 @@
New()
..()
- var/turf/cl= locate(1, 1, src.z)
- for(var/obj/effect/landmark/zcontroller/c in cl)
- if(c.up)
- var/turf/O = locate(src.x, src.y, c.up_target)
- if(istype(O, /turf/space))
- O.ChangeTurf(/turf/simulated/floor/open)
+ var/turf/above = GetAbove(src)
+ if(istype(above, /turf/space))
+ above.ChangeTurf(/turf/simulated/open)
spawn(1)
var/turf/T
@@ -262,13 +254,10 @@
bottom.connected = top
top.icon_state = "ramptop"
top.density = 1
- var/turf/controllerlocation = locate(1, 1, top.z)
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- if(controller.up)
- var/turf/above = locate(top.x, top.y, controller.up_target)
- if(istype(above,/turf/space) || istype(above,/turf/simulated/floor/open))
- top.target = above
- var/turf/above2 = locate(bottom.x, bottom.y, controller.up_target)
- if(istype(above2, /turf/space) || istype(above,/turf/simulated/floor/open))
- top.target2 = above2
+ var/turf/above = GetAbove(top)
+ if(istype(above,/turf/space) || istype(above,/turf/simulated/open))
+ top.target = above
+ above = GetAbove(bottom)
+ if(istype(above, /turf/space) || istype(above,/turf/simulated/open))
+ top.target2 = above
return
diff --git a/code/TriDimension/Turfs.dm b/code/TriDimension/Turfs.dm
index c601e36b992..f1385038941 100644
--- a/code/TriDimension/Turfs.dm
+++ b/code/TriDimension/Turfs.dm
@@ -1,114 +1,100 @@
-/turf/simulated/floor/open
+/turf/simulated/open
name = "open space"
density = 0
+ alpha = 0
icon_state = "black"
pathweight = 100000 //Seriously, don't try and path over this one numbnuts
- var/icon/darkoverlays = null
- var/turf/floorbelow
+ var/icon/darkoverlays
+ var/turf/below
var/list/overlay_references
New()
..()
- getbelow()
+ // Unhide shit.
+ for(var/obj/obj in src)
+ if(obj.level == 1)
+ obj.hide(0)
+
+ ASSERT(HasBelow(z))
+ below = GetBelow(src)
return
- Enter(var/atom/movable/AM)
- if (..()) //TODO make this check if gravity is active (future use) - Sukasa
- spawn(1)
- // only fall down in defined areas (read: areas with artificial gravitiy)
- if(!floorbelow) //make sure that there is actually something below
- if(!getbelow())
+ Entered(var/atom/movable/mover)
+ // only fall down in defined areas (read: areas with artificial gravitiy)
+ if(!istype(below)) //make sure that there is actually something below
+ below = GetBelow(src)
+ if(!below)
+ return
+
+ // No gravity in space, apparently.
+ var/area/area = get_area(src)
+ if(area.name == "Space")
+ return
+
+ // Prevent pipes from falling into the void... if there is a pipe to support it.
+ if(istype(mover, /obj/item/pipe) && \
+ (locate(/obj/structure/disposalpipe/up) in below) || \
+ locate(/obj/machinery/atmospherics/pipe/zpipe/up in below))
+ return
+
+ // See if something prevents us from falling.
+ var/soft = 0
+ for(var/atom/A in below)
+ if(A.density)
+ if(!istype(A, /obj/structure/window))
+ return
+ else
+ var/obj/structure/window/W = A
+ if(W.is_fulltile())
return
- if(AM)
- var/area/areacheck = get_area(src)
- var/blocked = 0
- var/soft = 0
- for(var/atom/A in floorbelow.contents)
- if(A.density)
- if(istype(A, /obj/structure/window))
- var/obj/structure/window/W = A
- blocked = W.is_fulltile()
- if(blocked)
- break
- else
- blocked = 1
- break
- if(istype(A, /obj/machinery/atmospherics/pipe/zpipe/up) && istype(AM,/obj/item/pipe))
- blocked = 1
- break
- if(istype(A, /obj/structure/disposalpipe/up) && istype(AM,/obj/item/pipe))
- blocked = 1
- break
- if(istype(A, /obj/multiz/stairs))
- soft = 1
- //dont break here, since we still need to be sure that it isnt blocked
+ // Dont break here, since we still need to be sure that it isnt blocked
+ if(istype(A, /obj/multiz/stairs))
+ soft = 1
- if (soft || (!blocked && !(areacheck.name == "Space")))
- AM.Move(floorbelow)
- if (!soft && istype(AM, /mob/living/carbon/human))
- var/mob/living/carbon/human/H = AM
- var/damage = 5
- H.apply_damage(min(rand(-damage,damage),0), BRUTE, "head")
- H.apply_damage(min(rand(-damage,damage),0), BRUTE, "chest")
- H.apply_damage(min(rand(-damage,damage),0), BRUTE, "l_leg")
- H.apply_damage(min(rand(-damage,damage),0), BRUTE, "r_leg")
- H.apply_damage(min(rand(-damage,damage),0), BRUTE, "l_arm")
- H.apply_damage(min(rand(-damage,damage),0), BRUTE, "r_arm")
- H:weakened = max(H:weakened,2)
- H:updatehealth()
- return ..()
+ // We've made sure we can move, now.
+ mover.Move(below)
-/turf/proc/hasbelow()
- var/turf/controllerlocation = locate(1, 1, z)
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- if(controller.down)
- return 1
- return 0
+ if(!soft)
+ if(!istype(mover, /mob))
+ if(istype(below, /turf/simulated/open))
+ below.visible_message("\The [mover] falls from the deck above through \the [below]!", "You hear a whoosh of displaced air.")
+ else
+ below.visible_message("\The [mover] falls from the deck above and slams into \the [below]!", "You hear something slam into the deck.")
+ else
+ var/mob/M = mover
+ if(istype(below, /turf/simulated/open))
+ below.visible_message("\The [mover] falls from the deck above through \the [below]!", "You hear a soft whoosh.[M.stat ? "" : ".. and some screaming."]")
+ else
+ M.visible_message("\The [mover] falls from the deck above and slams into \the [below]!", "You land on \the [below].", "You hear a soft whoosh and a crunch")
-/turf/simulated/floor/open/proc/getbelow()
- var/turf/controllerlocation = locate(1, 1, z)
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- // check if there is something to draw below
- if(!controller.down)
- src.ChangeTurf(get_base_turf(src.z))
- return 0
- else
- floorbelow = locate(src.x, src.y, controller.down_target)
- return 1
- return 1
+ // Handle people getting hurt, it's funny!
+ if (istype(mover, /mob/living/carbon/human))
+ var/mob/living/carbon/human/H = mover
+ var/damage = 5
+ H.apply_damage(rand(0, damage), BRUTE, "head")
+ H.apply_damage(rand(0, damage), BRUTE, "chest")
+ H.apply_damage(rand(0, damage), BRUTE, "l_leg")
+ H.apply_damage(rand(0, damage), BRUTE, "r_leg")
+ H.apply_damage(rand(0, damage), BRUTE, "l_arm")
+ H.apply_damage(rand(0, damage), BRUTE, "r_arm")
+ H.weakened = max(H.weakened,2)
+ H.updatehealth()
// override to make sure nothing is hidden
-/turf/simulated/floor/open/levelupdate()
+/turf/simulated/open/levelupdate()
for(var/obj/O in src)
O.hide(0)
-//overwrite the attackby of space to transform it to openspace if necessary
-/turf/space/attackby(obj/item/C as obj, mob/user as mob)
- if (istype(C, /obj/item/stack/cable_coil) && src.hasbelow())
- var/turf/simulated/floor/open/W = src.ChangeTurf(/turf/simulated/floor/open)
- W.attackby(C, user)
- return
- ..()
-
-/turf/simulated/floor/open/ex_act(severity)
- // cant destroy empty space with an ordinary bomb
- return
-
-/turf/simulated/floor/open/attackby(obj/item/C as obj, mob/user as mob)
- (..)
- if (istype(C, /obj/item/stack/cable_coil))
- var/obj/item/stack/cable_coil/cable = C
- cable.turf_place(src, user)
- return
-
+// Straight copy from space.
+/turf/simulated/open/attackby(obj/item/C as obj, mob/user as mob)
if (istype(C, /obj/item/stack/rods))
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
if(L)
return
var/obj/item/stack/rods/R = C
if (R.use(1))
- user << "Constructing support lattice..."
- playsound(src.loc, 'sound/weapons/Genhit.ogg', 50, 1)
+ user << "Constructing support lattice ..."
+ playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
ReplaceWithLattice()
return
@@ -119,7 +105,7 @@
if (S.get_amount() < 1)
return
qdel(L)
- playsound(src.loc, 'sound/weapons/Genhit.ogg', 50, 1)
+ playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
S.use(1)
ChangeTurf(/turf/simulated/floor/airless)
return
diff --git a/code/TriDimension/controller.dm b/code/TriDimension/controller.dm
index c8b81d0d499..70f9cbbd59c 100644
--- a/code/TriDimension/controller.dm
+++ b/code/TriDimension/controller.dm
@@ -119,10 +119,10 @@ atom/movable/Move() //Hackish
T.overlays -= T.z_overlays
T.z_overlays -= T.z_overlays
- if(down && (istype(T, /turf/space) || istype(T, /turf/simulated/floor/open)))
+ if(down && (istype(T, /turf/space) || istype(T, /turf/simulated/open)))
var/turf/below = locate(T.x, T.y, down_target)
if(below)
- if(!(istype(below, /turf/space) || istype(below, /turf/simulated/floor/open)))
+ if(!(istype(below, /turf/space) || istype(below, /turf/simulated/open)))
var/image/t_img = list()
new_list = 1
diff --git a/code/ZAS/Atom.dm b/code/ZAS/Atom.dm
index e655295f783..ce69ad71622 100644
--- a/code/ZAS/Atom.dm
+++ b/code/ZAS/Atom.dm
@@ -64,9 +64,9 @@ turf/c_airblock(turf/other)
#ifdef ZLEVELS
if(other.z != src.z)
if(other.z < src.z)
- if(!istype(src, /turf/simulated/floor/open)) return BLOCKED
+ if(!istype(src, /turf/simulated/open)) return BLOCKED
else
- if(!istype(other, /turf/simulated/floor/open)) return BLOCKED
+ if(!istype(other, /turf/simulated/open)) return BLOCKED
#endif
var/result = 0
diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm
index 1b32185ace3..b081530e10b 100644
--- a/code/game/objects/explosion.dm
+++ b/code/game/objects/explosion.dm
@@ -1,8 +1,6 @@
//TODO: Flash range does nothing currently
-///// Z-Level Stuff
-proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1, z_transfer = 1)
-///// Z-Level Stuff
+proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1, z_transfer = UP|DOWN)
src = null //so we don't abort once src is deleted
spawn(0)
if(config.use_recursive_explosions)
@@ -14,23 +12,19 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
epicenter = get_turf(epicenter)
if(!epicenter) return
-///// Z-Level Stuff
- if(z_transfer && (devastation_range > 0 || heavy_impact_range > 0))
- //transfer the explosion in both directions
- explosion_z_transfer(epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range)
-///// Z-Level Stuff
+ // Handles recursive propagation of explosions.
+ if(devastation_range > 2 || heavy_impact_range > 2)
+ if(HasAbove(epicenter.z) && z_transfer & UP)
+ explosion(GetAbove(epicenter), max(0, devastation_range - 2), max(0, heavy_impact_range - 2), max(0, light_impact_range - 2), max(0, flash_range - 2), 0, UP)
+ if(HasBelow(epicenter.z) && z_transfer & DOWN)
+ explosion(GetAbove(epicenter), max(0, devastation_range - 2), max(0, heavy_impact_range - 2), max(0, light_impact_range - 2), max(0, flash_range - 2), 0, DOWN)
var/max_range = max(devastation_range, heavy_impact_range, light_impact_range, flash_range)
- //playsound(epicenter, 'sound/effects/explosionfar.ogg', 100, 1, round(devastation_range*2,1) )
- //playsound(epicenter, "explosion", 100, 1, round(devastation_range,1) )
-// Play sounds; we want sounds to be different depending on distance so we will manually do it ourselves.
-
-// Stereo users will also hear the direction of the explosion!
-
-// Calculate far explosion sound range. Only allow the sound effect for heavy/devastating explosions.
-
-// 3/7/14 will calculate to 80 + 35
+ // Play sounds; we want sounds to be different depending on distance so we will manually do it ourselves.
+ // Stereo users will also hear the direction of the explosion!
+ // Calculate far explosion sound range. Only allow the sound effect for heavy/devastating explosions.
+ // 3/7/14 will calculate to 80 + 35
var/far_dist = 0
far_dist += heavy_impact_range * 5
far_dist += devastation_range * 20
@@ -62,10 +56,6 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
message_admins("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ([epicenter.x],[epicenter.y],[epicenter.z]) (JMP)")
log_game("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ")
-// var/lighting_controller_was_processing = lighting_controller.processing //Pause the lighting updates for a bit
-// lighting_controller.processing = 0
-
-
var/approximate_intensity = (devastation_range * 3) + (heavy_impact_range * 2) + light_impact_range
var/powernet_rebuild_was_deferred_already = defer_powernet_rebuild
// Large enough explosion. For performance reasons, powernets will be rebuilt manually
@@ -107,7 +97,6 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
sleep(8)
-// if(!lighting_controller.processing) lighting_controller.processing = lighting_controller_was_processing
if(!powernet_rebuild_was_deferred_already && defer_powernet_rebuild)
makepowernets()
defer_powernet_rebuild = 0
@@ -119,20 +108,3 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
proc/secondaryexplosion(turf/epicenter, range)
for(var/turf/tile in range(range, epicenter))
tile.ex_act(2)
-
-///// Z-Level Stuff
-proc/explosion_z_transfer(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, up = 1, down = 1)
- var/turf/controllerlocation = locate(1, 1, epicenter.z)
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- if(controller.down)
- //start the child explosion, no admin log and no additional transfers
- explosion(locate(epicenter.x, epicenter.y, controller.down_target), max(devastation_range - 2, 0), max(heavy_impact_range - 2, 0), max(light_impact_range - 2, 0), max(flash_range - 2, 0), 0, 0)
- if(devastation_range - 2 > 0 || heavy_impact_range - 2 > 0) //only transfer further if the explosion is still big enough
- explosion(locate(epicenter.x, epicenter.y, controller.down_target), max(devastation_range - 2, 0), max(heavy_impact_range - 2, 0), max(light_impact_range - 2, 0), max(flash_range - 2, 0), 0, 1)
-
- if(controller.up)
- //start the child explosion, no admin log and no additional transfers
- explosion(locate(epicenter.x, epicenter.y, controller.up_target), max(devastation_range - 2, 0), max(heavy_impact_range - 2, 0), max(light_impact_range - 2, 0), max(flash_range - 2, 0), 0, 0)
- if(devastation_range - 2 > 0 || heavy_impact_range - 2 > 0) //only transfer further if the explosion is still big enough
- explosion(locate(epicenter.x, epicenter.y, controller.up_target), max(devastation_range - 2, 0), max(heavy_impact_range - 2, 0), max(light_impact_range - 2, 0), max(flash_range - 2, 0), 1, 0)
-///// Z-Level Stuff
diff --git a/code/game/objects/structures/lattice.dm b/code/game/objects/structures/lattice.dm
index f69407b0c92..cc87be62fab 100644
--- a/code/game/objects/structures/lattice.dm
+++ b/code/game/objects/structures/lattice.dm
@@ -11,7 +11,7 @@
/obj/structure/lattice/New()
..()
///// Z-Level Stuff
- if(!(istype(src.loc, /turf/space) || istype(src.loc, /turf/simulated/floor/open)))
+ if(!(istype(src.loc, /turf/space) || istype(src.loc, /turf/simulated/open)))
///// Z-Level Stuff
qdel(src)
for(var/obj/structure/lattice/LAT in src.loc)
diff --git a/code/game/turfs/turf_changing.dm b/code/game/turfs/turf_changing.dm
index 4962ddadb51..f6aabc5ce60 100644
--- a/code/game/turfs/turf_changing.dm
+++ b/code/game/turfs/turf_changing.dm
@@ -14,19 +14,11 @@
if (!N)
return
-///// Z-Level Stuff ///// This makes sure that turfs are not changed to space when one side is part of a zone
+ // This makes sure that turfs are not changed to space when one side is part of a zone
if(N == /turf/space)
- var/turf/controller = locate(1, 1, src.z)
- for(var/obj/effect/landmark/zcontroller/c in controller)
- if(c.down)
- var/turf/below = locate(src.x, src.y, c.down_target)
- if((air_master.has_valid_zone(below) || air_master.has_valid_zone(src)) && !istype(below, /turf/space)) // dont make open space into space, its pointless and makes people drop out of the station
- var/turf/W = src.ChangeTurf(/turf/simulated/floor/open)
- var/list/temp = list()
- temp += W
- c.add(temp,3,1) // report the new open space to the zcontroller
- return W
-///// Z-Level Stuff
+ var/turf/below = GetBelow(src)
+ if(istype(below) && (air_master.has_valid_zone(below) || air_master.has_valid_zone(src)))
+ N = /turf/simulated/open
var/obj/fire/old_fire = fire
var/old_opacity = opacity
@@ -46,11 +38,11 @@
if(S.zone) S.zone.rebuild()
if(ispath(N, /turf/simulated/floor))
- var/turf/simulated/floor/W = new N( locate(src.x, src.y, src.z) )
+ var/turf/simulated/W = new N( locate(src.x, src.y, src.z) )
if(old_fire)
fire = old_fire
- if (istype(W))
+ if (istype(W,/turf/simulated/floor))
W.RemoveLattice()
if(tell_universe)
diff --git a/code/modules/multiz/basic.dm b/code/modules/multiz/basic.dm
new file mode 100644
index 00000000000..941711b5d44
--- /dev/null
+++ b/code/modules/multiz/basic.dm
@@ -0,0 +1,31 @@
+// If you add a more comprehensive system, just untick this file.
+// WARNING: Only works for up to 17 z-levels!
+var/z_levels = 0 // Each bit represents a connection between adjacent levels. So the first bit means levels 1 and 2 are connected.
+
+// If the height is more than 1, we mark all contained levels as connected.
+/obj/effect/landmark/map_data/New()
+ for(var/i = z - 1 to height - 2)
+ z_levels |= 1 << i
+ del src
+
+HasAbove(z)
+ if(z > world.maxz || z > 17 || z < 2)
+ return 0
+ return z_levels & (1 << (z - 1))
+
+HasBelow(z)
+ if(z >= world.maxz || z > 16 || z < 1)
+ return 0
+ return z_levels & (1 << z)
+
+GetAbove(var/atom/thing)
+ var/turf/turf = get_turf(thing)
+ if(!istype(turf))
+ return null
+ return HasBelow(turf.z) ? locate(turf.z, turf.y, turf.z - 1) : null
+
+GetBelow(var/atom/thing)
+ var/turf/turf = get_turf(thing)
+ if(!istype(turf))
+ return null
+ return HasBelow(turf.z) ? locate(turf.z, turf.y, turf.z + 1) : null
\ No newline at end of file
diff --git a/code/modules/multiz/stubs.dm b/code/modules/multiz/stubs.dm
new file mode 100644
index 00000000000..cae24af0051
--- /dev/null
+++ b/code/modules/multiz/stubs.dm
@@ -0,0 +1,16 @@
+/obj/effect/landmark/map_data
+ name = "Unknown"
+ desc = "An unknown location."
+ invisibility = 101
+
+ var/height = 1 ///< The number of Z-Levels in the map.
+ var/turf/edge_type ///< What the map edge should be formed with. (null = world.turf)
+
+// FOR THE LOVE OF GOD USE THESE. DO NOT FUCKING SPAGHETTIFY THIS.
+// Use the Has*() functions if you ONLY need to check.
+// If you need to do something, use Get*().
+proc/HasAbove(var/z)
+proc/HasBelow(var/z)
+// These give either the turf or null.
+proc/GetAbove(var/turf/turf)
+proc/GetBelow(var/turf/turf)
\ No newline at end of file
diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm
index 7e35d2a9cfd..b5aa43077f9 100644
--- a/code/modules/power/cable.dm
+++ b/code/modules/power/cable.dm
@@ -126,11 +126,10 @@ By design, d1 is the smallest direction and d2 is the highest
return
if(istype(W, /obj/item/weapon/wirecutters))
-///// Z-Level Stuff
- if(src.d1 == 12 || src.d2 == 12)
+ if(d1 == 12 || d2 == 12)
user << "You must cut this cable from above."
return
-///// Z-Level Stuff
+
if(breaker_box)
user << "\red This cable is connected to nearby breaker box. Use breaker box to interact with it."
return
@@ -146,16 +145,13 @@ By design, d1 is the smallest direction and d2 is the highest
for(var/mob/O in viewers(src, null))
O.show_message("[user] cuts the cable.", 1)
-///// Z-Level Stuff
- if(src.d1 == 11 || src.d2 == 11)
- var/turf/controllerlocation = locate(1, 1, z)
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- if(controller.down)
- var/turf/below = locate(src.x, src.y, controller.down_target)
- for(var/obj/structure/cable/c in below)
- if(c.d1 == 12 || c.d2 == 12)
- qdel(c)
-///// Z-Level Stuff
+ if(d1 == 11 || d2 == 11)
+ var/turf/turf = GetBelow(src)
+ if(turf)
+ for(var/obj/structure/cable/c in turf)
+ if(c.d1 == 12 || c.d2 == 12)
+ qdel(c)
+
investigate_log("was cut by [key_name(usr, usr.client)] in [user.loc.loc]","wires")
qdel(src)
@@ -347,19 +343,20 @@ obj/structure/cable/proc/cableColor(var/colorC)
. = list() // this will be a list of all connected power objects
var/turf/T
-///// Z-Level Stuff
- if (d1 == 11 || d1 == 12)
- var/turf/controllerlocation = locate(1, 1, z)
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- if(controller.up && d1 == 12)
- T = locate(src.x, src.y, controller.up_target)
- if(T)
- . += power_list(T, src, 11, 1)
- if(controller.down && d1 == 11)
- T = locate(src.x, src.y, controller.down_target)
- if(T)
- . += power_list(T, src, 12, 1)
-///// Z-Level Stuff
+ // Handle z-level connections.
+ if(d1 == 11 || d1 == 12)
+ // Connections below.
+ if(d1 == 11)
+ var/turf/turf = GetBelow(src)
+ if(turf)
+ . += power_list(turf, src, 12, 1)
+
+ // Connections above.
+ if(d1 == 12)
+ var/turf/turf = GetAbove(src)
+ if(turf)
+ . += power_list(turf, src, 11, 1)
+
//get matching cables from the first direction
else if(d1) //if not a node cable
T = get_step(src, d1)
@@ -376,19 +373,22 @@ obj/structure/cable/proc/cableColor(var/colorC)
. += power_list(loc, src, d1, powernetless_only) //get on turf matching cables
-///// Z-Level Stuff
+
+ // Second direction.
+ // Handle z-level connections.
if(d2 == 11 || d2 == 12)
- var/turf/controllerlocation = locate(1, 1, z)
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- if(controller.up && d2 == 12)
- T = locate(src.x, src.y, controller.up_target)
- if(T)
- . += power_list(T, src, 11, 1)
- if(controller.down && d2 == 11)
- T = locate(src.x, src.y, controller.down_target)
- if(T)
- . += power_list(T, src, 12, 1)
-///// Z-Level Stuff
+ // Connections below.
+ if(d2 == 11)
+ var/turf/turf = GetBelow(src)
+ if(turf)
+ . += power_list(turf, src, 12, 1)
+
+ // Connections above.
+ if(d2 == 12)
+ var/turf/turf = GetAbove(src)
+ if(turf)
+ . += power_list(turf, src, 11, 1)
+
else
//do the same on the second direction (which can't be 0)
T = get_step(src, d2)
@@ -672,15 +672,14 @@ obj/structure/cable/proc/cableColor(var/colorC)
return
///// Z-Level Stuff
// check if the target is open space
- if(istype(F, /turf/simulated/floor/open))
+ if(istype(F, /turf/simulated/open))
for(var/obj/structure/cable/LC in F)
if((LC.d1 == dirn && LC.d2 == 11 ) || ( LC.d2 == dirn && LC.d1 == 11))
user << "There's already a cable at that position."
return
- var/turf/simulated/floor/open/temp = F
var/obj/structure/cable/C = new(F)
- var/obj/structure/cable/D = new(temp.floorbelow)
+ var/obj/structure/cable/D = new(GetBelow(F))
C.cableColor(color)
diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm
index dcf58713e61..d764d56e555 100644
--- a/code/modules/recycling/disposal.dm
+++ b/code/modules/recycling/disposal.dm
@@ -985,12 +985,9 @@
var/obj/structure/disposalpipe/P
if(nextdir == 12)
- var/turf/controllerlocation = locate(1, 1, src.z)
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- if(controller.up)
- T = locate(src.x, src.y, controller.up_target)
+ T = GetAbove(src)
if(!T)
- H.loc = src.loc
+ H.loc = loc
return
else
for(var/obj/structure/disposalpipe/down/F in T)
@@ -1038,10 +1035,7 @@
var/obj/structure/disposalpipe/P
if(nextdir == 11)
- var/turf/controllerlocation = locate(1, 1, src.z)
- for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
- if(controller.down)
- T = locate(src.x, src.y, controller.down_target)
+ T = GetBelow(src)
if(!T)
H.loc = src.loc
return