This commit is contained in:
SkyMarshal
2015-08-23 10:34:59 -07:00
parent 491bb6931a
commit 772c320303
14 changed files with 258 additions and 286 deletions

View File

@@ -1410,6 +1410,8 @@
#include "code\modules\mob\new_player\preferences_setup.dm" #include "code\modules\mob\new_player\preferences_setup.dm"
#include "code\modules\mob\new_player\skill.dm" #include "code\modules\mob\new_player\skill.dm"
#include "code\modules\mob\new_player\sprite_accessories.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.dm"
#include "code\modules\nano\JSON Reader.dm" #include "code\modules\nano\JSON Reader.dm"
#include "code\modules\nano\JSON Writer.dm" #include "code\modules\nano\JSON Writer.dm"
@@ -1783,8 +1785,6 @@
#include "code\modules\virus2\items_devices.dm" #include "code\modules\virus2\items_devices.dm"
#include "code\modules\xgm\xgm_gas_data.dm" #include "code\modules\xgm\xgm_gas_data.dm"
#include "code\modules\xgm\xgm_gas_mixture.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\Movement.dm"
#include "code\TriDimension\Pipes.dm" #include "code\TriDimension\Pipes.dm"
#include "code\TriDimension\Structures.dm" #include "code\TriDimension\Structures.dm"

View File

@@ -1,52 +1,51 @@
/obj/item/weapon/tank/jetpack/verb/moveup() /obj/item/weapon/tank/jetpack/verb/moveup()
set name = "Move Upwards" set name = "Move Upwards"
set category = "Object" set category = "Object"
. = 1
if(allow_thrust(0.01, usr)) if(allow_thrust(0.01, usr))
var/turf/controllerlocation = locate(1, 1, usr.z) usr << "<span class='warning'>Your [src] is disabled.</span>"
var/legal = 0 return
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
legal = controller.up var/turf/above = GetAbove(src)
if (controller.up) if(!istype(above))
var/turf/T = locate(usr.x, usr.y, controller.up_target) usr << "<span class='notice'>There is nothing of interest in this direction.</span>"
if(T && (istype(T, /turf/space) || istype(T, /turf/simulated/floor/open))) return
var/blocked = 0
for(var/atom/A in T.contents) if(!istype(above, /turf/space) && !istype(above, /turf/simulated/open))
if(A.density) usr << "<span class='warning'>You bump against \the [above].</span>"
blocked = 1 return
usr << "<span class='warning'>You bump into \the [A].</span>"
break for(var/atom/A in above)
if(!blocked) if(A.density)
usr.Move(T) usr << "<span class='warning'>\The [A] blocks you.</span>"
usr << "You move upwards." return
else
usr << "<span class='warning'>There is something in your way.</span>" usr.Move(above)
if (legal == 0) usr << "<span class='notice'>You move upwards.</span>"
usr << "There is nothing of interest in this direction."
return 1
/obj/item/weapon/tank/jetpack/verb/movedown() /obj/item/weapon/tank/jetpack/verb/movedown()
set name = "Move Downwards" set name = "Move Downwards"
set category = "Object" set category = "Object"
. = 1
if(allow_thrust(0.01, usr)) if(allow_thrust(0.01, usr))
var/turf/controllerlocation = locate(1, 1, usr.z) usr << "<span class='warning'>Your [src] is disabled.</span>"
var/legal = 0 return
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
legal = controller.down var/turf/above = GetBelow(src)
if (controller.down == 1) if(!istype(above))
var/turf/T = locate(usr.x, usr.y, controller.down_target) usr << "<span class='notice'>There is nothing of interest in this direction.</span>"
var/turf/S = locate(usr.x, usr.y, usr.z) return
if(T && (istype(S, /turf/space) || istype(S, /turf/simulated/floor/open)))
var/blocked = 0 if(!istype(above, /turf/space) && !istype(above, /turf/simulated/open))
for(var/atom/A in T.contents) usr << "<span class='warning'>You bump against \the [above].</span>"
if(A.density) return
blocked = 1
usr << "<span class='warning'>You bump into \the [A].</span>" for(var/atom/A in above)
break if(A.density)
if(!blocked) usr << "<span class='warning'>\The [A] blocks you.</span>"
usr.Move(T) return
usr << "You move downwards."
else usr.Move(above)
usr << "<span class='warning'>You cant move through the floor.</span>" usr << "<span class='notice'>You move upwards.</span>"
if (legal == 0)
usr << "There is nothing of interest in this direction."
return 1

View File

@@ -136,16 +136,13 @@ obj/machinery/atmospherics/pipe/zpipe/up/initialize()
node1 = target node1 = target
break break
var/turf/controllerlocation = locate(1, 1, src.z) var/turf/above = GetAbove(src)
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation) if(above)
if(controller.up) for(var/obj/machinery/atmospherics/target in above)
var/turf/above = locate(src.x, src.y, controller.up_target) if(target.initialize_directions && istype(target, /obj/machinery/atmospherics/pipe/zpipe/down))
if(above) if (check_connect_types(target,src))
for(var/obj/machinery/atmospherics/target in above) node2 = target
if(target.initialize_directions && istype(target, /obj/machinery/atmospherics/pipe/zpipe/down)) break
if (check_connect_types(target,src))
node2 = target
break
var/turf/T = src.loc // hide if turf is not intact var/turf/T = src.loc // hide if turf is not intact
@@ -177,16 +174,13 @@ obj/machinery/atmospherics/pipe/zpipe/down/initialize()
node1 = target node1 = target
break break
var/turf/controllerlocation = locate(1, 1, src.z) var/turf/below = GetBelow(src)
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation) if(below)
if(controller.down) for(var/obj/machinery/atmospherics/target in below)
var/turf/below = locate(src.x, src.y, controller.down_target) if(target.initialize_directions && istype(target, /obj/machinery/atmospherics/pipe/zpipe/up))
if(below) if (check_connect_types(target,src))
for(var/obj/machinery/atmospherics/target in below) node2 = target
if(target.initialize_directions && istype(target, /obj/machinery/atmospherics/pipe/zpipe/up)) break
if (check_connect_types(target,src))
node2 = target
break
var/turf/T = src.loc // hide if turf is not intact var/turf/T = src.loc // hide if turf is not intact

View File

@@ -25,17 +25,12 @@
proc/connect() proc/connect()
if(icon_state == "ladderdown") // the upper will connect to the lower if(icon_state == "ladderdown") // the upper will connect to the lower
d_state = 1 d_state = 1
var/turf/controllerlocation = locate(1, 1, z) for(var/obj/multiz/ladder/L in GetBelow(src))
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation) if(L.icon_state == "ladderup")
if(controller.down) target = L
var/turf/below = locate(src.x, src.y, controller.down_target) L.target = src
for(var/obj/multiz/ladder/L in below) d_state = 0
if(L.icon_state == "ladderup") return
target = L
L.target = src
d_state = 0
break
return
/* ex_act(severity) /* ex_act(severity)
switch(severity) switch(severity)
@@ -210,12 +205,9 @@
New() New()
..() ..()
var/turf/cl= locate(1, 1, src.z) var/turf/above = GetAbove(src)
for(var/obj/effect/landmark/zcontroller/c in cl) if(istype(above, /turf/space))
if(c.up) above.ChangeTurf(/turf/simulated/open)
var/turf/O = locate(src.x, src.y, c.up_target)
if(istype(O, /turf/space))
O.ChangeTurf(/turf/simulated/floor/open)
spawn(1) spawn(1)
var/turf/T var/turf/T
@@ -262,13 +254,10 @@
bottom.connected = top bottom.connected = top
top.icon_state = "ramptop" top.icon_state = "ramptop"
top.density = 1 top.density = 1
var/turf/controllerlocation = locate(1, 1, top.z) var/turf/above = GetAbove(top)
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation) if(istype(above,/turf/space) || istype(above,/turf/simulated/open))
if(controller.up) top.target = above
var/turf/above = locate(top.x, top.y, controller.up_target) above = GetAbove(bottom)
if(istype(above,/turf/space) || istype(above,/turf/simulated/floor/open)) if(istype(above, /turf/space) || istype(above,/turf/simulated/open))
top.target = above top.target2 = 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
return return

View File

@@ -1,114 +1,100 @@
/turf/simulated/floor/open /turf/simulated/open
name = "open space" name = "open space"
density = 0 density = 0
alpha = 0
icon_state = "black" icon_state = "black"
pathweight = 100000 //Seriously, don't try and path over this one numbnuts pathweight = 100000 //Seriously, don't try and path over this one numbnuts
var/icon/darkoverlays = null var/icon/darkoverlays
var/turf/floorbelow var/turf/below
var/list/overlay_references var/list/overlay_references
New() New()
..() ..()
getbelow() // Unhide shit.
for(var/obj/obj in src)
if(obj.level == 1)
obj.hide(0)
ASSERT(HasBelow(z))
below = GetBelow(src)
return return
Enter(var/atom/movable/AM) Entered(var/atom/movable/mover)
if (..()) //TODO make this check if gravity is active (future use) - Sukasa // only fall down in defined areas (read: areas with artificial gravitiy)
spawn(1) if(!istype(below)) //make sure that there is actually something below
// only fall down in defined areas (read: areas with artificial gravitiy) below = GetBelow(src)
if(!floorbelow) //make sure that there is actually something below if(!below)
if(!getbelow()) 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 return
if(AM) // Dont break here, since we still need to be sure that it isnt blocked
var/area/areacheck = get_area(src) if(istype(A, /obj/multiz/stairs))
var/blocked = 0 soft = 1
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
if (soft || (!blocked && !(areacheck.name == "Space"))) // We've made sure we can move, now.
AM.Move(floorbelow) mover.Move(below)
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 ..()
/turf/proc/hasbelow() if(!soft)
var/turf/controllerlocation = locate(1, 1, z) if(!istype(mover, /mob))
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation) if(istype(below, /turf/simulated/open))
if(controller.down) below.visible_message("\The [mover] falls from the deck above through \the [below]!", "You hear a whoosh of displaced air.")
return 1 else
return 0 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() // Handle people getting hurt, it's funny!
var/turf/controllerlocation = locate(1, 1, z) if (istype(mover, /mob/living/carbon/human))
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation) var/mob/living/carbon/human/H = mover
// check if there is something to draw below var/damage = 5
if(!controller.down) H.apply_damage(rand(0, damage), BRUTE, "head")
src.ChangeTurf(get_base_turf(src.z)) H.apply_damage(rand(0, damage), BRUTE, "chest")
return 0 H.apply_damage(rand(0, damage), BRUTE, "l_leg")
else H.apply_damage(rand(0, damage), BRUTE, "r_leg")
floorbelow = locate(src.x, src.y, controller.down_target) H.apply_damage(rand(0, damage), BRUTE, "l_arm")
return 1 H.apply_damage(rand(0, damage), BRUTE, "r_arm")
return 1 H.weakened = max(H.weakened,2)
H.updatehealth()
// override to make sure nothing is hidden // override to make sure nothing is hidden
/turf/simulated/floor/open/levelupdate() /turf/simulated/open/levelupdate()
for(var/obj/O in src) for(var/obj/O in src)
O.hide(0) O.hide(0)
//overwrite the attackby of space to transform it to openspace if necessary // Straight copy from space.
/turf/space/attackby(obj/item/C as obj, mob/user as mob) /turf/simulated/open/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
if (istype(C, /obj/item/stack/rods)) if (istype(C, /obj/item/stack/rods))
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src) var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
if(L) if(L)
return return
var/obj/item/stack/rods/R = C var/obj/item/stack/rods/R = C
if (R.use(1)) if (R.use(1))
user << "<span class='notice'>Constructing support lattice...</span>" user << "<span class='notice'>Constructing support lattice ...</span>"
playsound(src.loc, 'sound/weapons/Genhit.ogg', 50, 1) playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
ReplaceWithLattice() ReplaceWithLattice()
return return
@@ -119,7 +105,7 @@
if (S.get_amount() < 1) if (S.get_amount() < 1)
return return
qdel(L) qdel(L)
playsound(src.loc, 'sound/weapons/Genhit.ogg', 50, 1) playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
S.use(1) S.use(1)
ChangeTurf(/turf/simulated/floor/airless) ChangeTurf(/turf/simulated/floor/airless)
return return

View File

@@ -119,10 +119,10 @@ atom/movable/Move() //Hackish
T.overlays -= T.z_overlays T.overlays -= T.z_overlays
T.z_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) var/turf/below = locate(T.x, T.y, down_target)
if(below) 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() var/image/t_img = list()
new_list = 1 new_list = 1

View File

@@ -64,9 +64,9 @@ turf/c_airblock(turf/other)
#ifdef ZLEVELS #ifdef ZLEVELS
if(other.z != src.z) if(other.z != src.z)
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 else
if(!istype(other, /turf/simulated/floor/open)) return BLOCKED if(!istype(other, /turf/simulated/open)) return BLOCKED
#endif #endif
var/result = 0 var/result = 0

View File

@@ -1,8 +1,6 @@
//TODO: Flash range does nothing currently //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 = UP|DOWN)
proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1, z_transfer = 1)
///// Z-Level Stuff
src = null //so we don't abort once src is deleted src = null //so we don't abort once src is deleted
spawn(0) spawn(0)
if(config.use_recursive_explosions) if(config.use_recursive_explosions)
@@ -14,23 +12,19 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
epicenter = get_turf(epicenter) epicenter = get_turf(epicenter)
if(!epicenter) return if(!epicenter) return
///// Z-Level Stuff // Handles recursive propagation of explosions.
if(z_transfer && (devastation_range > 0 || heavy_impact_range > 0)) if(devastation_range > 2 || heavy_impact_range > 2)
//transfer the explosion in both directions if(HasAbove(epicenter.z) && z_transfer & UP)
explosion_z_transfer(epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range) 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)
///// Z-Level Stuff 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) 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. // 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!
// 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
// 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 var/far_dist = 0
far_dist += heavy_impact_range * 5 far_dist += heavy_impact_range * 5
far_dist += devastation_range * 20 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]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[epicenter.x];Y=[epicenter.y];Z=[epicenter.z]'>JMP</a>)") message_admins("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ([epicenter.x],[epicenter.y],[epicenter.z]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[epicenter.x];Y=[epicenter.y];Z=[epicenter.z]'>JMP</a>)")
log_game("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ") 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/approximate_intensity = (devastation_range * 3) + (heavy_impact_range * 2) + light_impact_range
var/powernet_rebuild_was_deferred_already = defer_powernet_rebuild var/powernet_rebuild_was_deferred_already = defer_powernet_rebuild
// Large enough explosion. For performance reasons, powernets will be rebuilt manually // 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) sleep(8)
// if(!lighting_controller.processing) lighting_controller.processing = lighting_controller_was_processing
if(!powernet_rebuild_was_deferred_already && defer_powernet_rebuild) if(!powernet_rebuild_was_deferred_already && defer_powernet_rebuild)
makepowernets() makepowernets()
defer_powernet_rebuild = 0 defer_powernet_rebuild = 0
@@ -119,20 +108,3 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
proc/secondaryexplosion(turf/epicenter, range) proc/secondaryexplosion(turf/epicenter, range)
for(var/turf/tile in range(range, epicenter)) for(var/turf/tile in range(range, epicenter))
tile.ex_act(2) 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

View File

@@ -11,7 +11,7 @@
/obj/structure/lattice/New() /obj/structure/lattice/New()
..() ..()
///// Z-Level Stuff ///// 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 ///// Z-Level Stuff
qdel(src) qdel(src)
for(var/obj/structure/lattice/LAT in src.loc) for(var/obj/structure/lattice/LAT in src.loc)

View File

@@ -14,19 +14,11 @@
if (!N) if (!N)
return 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) if(N == /turf/space)
var/turf/controller = locate(1, 1, src.z) var/turf/below = GetBelow(src)
for(var/obj/effect/landmark/zcontroller/c in controller) if(istype(below) && (air_master.has_valid_zone(below) || air_master.has_valid_zone(src)))
if(c.down) N = /turf/simulated/open
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/obj/fire/old_fire = fire var/obj/fire/old_fire = fire
var/old_opacity = opacity var/old_opacity = opacity
@@ -46,11 +38,11 @@
if(S.zone) S.zone.rebuild() if(S.zone) S.zone.rebuild()
if(ispath(N, /turf/simulated/floor)) 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) if(old_fire)
fire = old_fire fire = old_fire
if (istype(W)) if (istype(W,/turf/simulated/floor))
W.RemoveLattice() W.RemoveLattice()
if(tell_universe) if(tell_universe)

View File

@@ -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

View File

@@ -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)

View File

@@ -126,11 +126,10 @@ By design, d1 is the smallest direction and d2 is the highest
return return
if(istype(W, /obj/item/weapon/wirecutters)) if(istype(W, /obj/item/weapon/wirecutters))
///// Z-Level Stuff if(d1 == 12 || d2 == 12)
if(src.d1 == 12 || src.d2 == 12)
user << "<span class='warning'>You must cut this cable from above.</span>" user << "<span class='warning'>You must cut this cable from above.</span>"
return return
///// Z-Level Stuff
if(breaker_box) if(breaker_box)
user << "\red This cable is connected to nearby breaker box. Use breaker box to interact with it." user << "\red This cable is connected to nearby breaker box. Use breaker box to interact with it."
return 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)) for(var/mob/O in viewers(src, null))
O.show_message("<span class='warning'>[user] cuts the cable.</span>", 1) O.show_message("<span class='warning'>[user] cuts the cable.</span>", 1)
///// Z-Level Stuff if(d1 == 11 || d2 == 11)
if(src.d1 == 11 || src.d2 == 11) var/turf/turf = GetBelow(src)
var/turf/controllerlocation = locate(1, 1, z) if(turf)
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation) for(var/obj/structure/cable/c in turf)
if(controller.down) if(c.d1 == 12 || c.d2 == 12)
var/turf/below = locate(src.x, src.y, controller.down_target) qdel(c)
for(var/obj/structure/cable/c in below)
if(c.d1 == 12 || c.d2 == 12)
qdel(c)
///// Z-Level Stuff
investigate_log("was cut by [key_name(usr, usr.client)] in [user.loc.loc]","wires") investigate_log("was cut by [key_name(usr, usr.client)] in [user.loc.loc]","wires")
qdel(src) qdel(src)
@@ -347,19 +343,20 @@ obj/structure/cable/proc/cableColor(var/colorC)
. = list() // this will be a list of all connected power objects . = list() // this will be a list of all connected power objects
var/turf/T var/turf/T
///// Z-Level Stuff // Handle z-level connections.
if (d1 == 11 || d1 == 12) if(d1 == 11 || d1 == 12)
var/turf/controllerlocation = locate(1, 1, z) // Connections below.
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation) if(d1 == 11)
if(controller.up && d1 == 12) var/turf/turf = GetBelow(src)
T = locate(src.x, src.y, controller.up_target) if(turf)
if(T) . += power_list(turf, src, 12, 1)
. += power_list(T, src, 11, 1)
if(controller.down && d1 == 11) // Connections above.
T = locate(src.x, src.y, controller.down_target) if(d1 == 12)
if(T) var/turf/turf = GetAbove(src)
. += power_list(T, src, 12, 1) if(turf)
///// Z-Level Stuff . += power_list(turf, src, 11, 1)
//get matching cables from the first direction //get matching cables from the first direction
else if(d1) //if not a node cable else if(d1) //if not a node cable
T = get_step(src, d1) 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 . += 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) if(d2 == 11 || d2 == 12)
var/turf/controllerlocation = locate(1, 1, z) // Connections below.
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation) if(d2 == 11)
if(controller.up && d2 == 12) var/turf/turf = GetBelow(src)
T = locate(src.x, src.y, controller.up_target) if(turf)
if(T) . += power_list(turf, src, 12, 1)
. += power_list(T, src, 11, 1)
if(controller.down && d2 == 11) // Connections above.
T = locate(src.x, src.y, controller.down_target) if(d2 == 12)
if(T) var/turf/turf = GetAbove(src)
. += power_list(T, src, 12, 1) if(turf)
///// Z-Level Stuff . += power_list(turf, src, 11, 1)
else else
//do the same on the second direction (which can't be 0) //do the same on the second direction (which can't be 0)
T = get_step(src, d2) T = get_step(src, d2)
@@ -672,15 +672,14 @@ obj/structure/cable/proc/cableColor(var/colorC)
return return
///// Z-Level Stuff ///// Z-Level Stuff
// check if the target is open space // 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) for(var/obj/structure/cable/LC in F)
if((LC.d1 == dirn && LC.d2 == 11 ) || ( LC.d2 == dirn && LC.d1 == 11)) if((LC.d1 == dirn && LC.d2 == 11 ) || ( LC.d2 == dirn && LC.d1 == 11))
user << "<span class='warning'>There's already a cable at that position.</span>" user << "<span class='warning'>There's already a cable at that position.</span>"
return return
var/turf/simulated/floor/open/temp = F
var/obj/structure/cable/C = new(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) C.cableColor(color)

View File

@@ -985,12 +985,9 @@
var/obj/structure/disposalpipe/P var/obj/structure/disposalpipe/P
if(nextdir == 12) if(nextdir == 12)
var/turf/controllerlocation = locate(1, 1, src.z) T = GetAbove(src)
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
if(controller.up)
T = locate(src.x, src.y, controller.up_target)
if(!T) if(!T)
H.loc = src.loc H.loc = loc
return return
else else
for(var/obj/structure/disposalpipe/down/F in T) for(var/obj/structure/disposalpipe/down/F in T)
@@ -1038,10 +1035,7 @@
var/obj/structure/disposalpipe/P var/obj/structure/disposalpipe/P
if(nextdir == 11) if(nextdir == 11)
var/turf/controllerlocation = locate(1, 1, src.z) T = GetBelow(src)
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
if(controller.down)
T = locate(src.x, src.y, controller.down_target)
if(!T) if(!T)
H.loc = src.loc H.loc = src.loc
return return