diff --git a/code/modules/multiz/movement.dm b/code/modules/multiz/movement.dm index 1641f30fd06..7ba7f2228c2 100644 --- a/code/modules/multiz/movement.dm +++ b/code/modules/multiz/movement.dm @@ -36,7 +36,7 @@ return eyeobj.zMove(direction) // Check if we can actually travel a Z-level. - if (!can_ztravel()) + if (!can_ztravel(direction)) to_chat(src, "You lack means of travel in that direction.") return FALSE @@ -72,6 +72,14 @@ // Actually move. Move(destination) return TRUE + +/mob/living/zMove(direction) + if (is_ventcrawling) + var/obj/machinery/atmospherics/pipe/zpipe/P = loc + if (istype(P) && P.can_z_crawl(src, direction)) + return P.handle_z_crawl(src, direction) + + return ..() /mob/eye/zMove(direction) var/turf/destination = (direction == UP) ? GetAbove(src) : GetBelow(src) @@ -102,13 +110,13 @@ * @return TRUE if the mob can move a Z-level of its own volition. * FALSE otherwise. */ -/mob/proc/can_ztravel() +/mob/proc/can_ztravel(var/direction) return FALSE -/mob/dead/observer/can_ztravel() +/mob/dead/observer/can_ztravel(var/direction) return TRUE -/mob/living/carbon/human/can_ztravel() +/mob/living/carbon/human/can_ztravel(var/direction) if(incapacitated()) return FALSE @@ -120,7 +128,7 @@ if(T.density) return TRUE -/mob/living/silicon/robot/can_ztravel() +/mob/living/silicon/robot/can_ztravel(var/direction) if(incapacitated() || is_dead()) return FALSE diff --git a/code/modules/multiz/pipes.dm b/code/modules/multiz/pipes.dm index a801203abba..4e281641485 100644 --- a/code/modules/multiz/pipes.dm +++ b/code/modules/multiz/pipes.dm @@ -19,7 +19,11 @@ var/maximum_pressure = 70*ONE_ATMOSPHERE var/fatigue_pressure = 55*ONE_ATMOSPHERE alert_pressure = 55*ONE_ATMOSPHERE - + + var/travel_verbname = "UNDEFINED" + var/travel_direction_verb = "UNDEFINED" + var/travel_direction_name = "UNDEFINED" + var/travel_direction = "UNDEFINED" level = 1 @@ -43,6 +47,11 @@ if(SOUTHWEST) initialize_directions = SOUTH +/obj/machinery/atmospherics/pipe/zpipe/Entered(mob/living/M) + if(istype(M)) + M << span("notice", "You are in a vertical pipe section. Use [travel_verbname] from the IC menu to [travel_direction_verb] a level.") + . = ..() + /obj/machinery/atmospherics/pipe/zpipe/hide(var/i) if(istype(loc, /turf/simulated)) invisibility = i ? 101 : 0 @@ -118,6 +127,11 @@ name = "upwards pipe" desc = "A pipe segment to connect upwards." + travel_verbname = "Move Upwards" + travel_direction_verb = "ascend" + travel_direction_name = "up" + travel_direction = UP + /obj/machinery/atmospherics/pipe/zpipe/up/initialize() normalize_dir() var/node1_dir @@ -156,6 +170,11 @@ name = "downwards pipe" desc = "A pipe segment to connect downwards." + travel_verbname = "Move Downwards" + travel_direction_verb = "descend" + travel_direction_name = "down" + travel_direction = DOWN + /obj/machinery/atmospherics/pipe/zpipe/down/initialize() normalize_dir() var/node1_dir diff --git a/code/modules/ventcrawl/ventcrawl_atmospherics.dm b/code/modules/ventcrawl/ventcrawl_atmospherics.dm index 8fbe09de014..032a24757c9 100644 --- a/code/modules/ventcrawl/ventcrawl_atmospherics.dm +++ b/code/modules/ventcrawl/ventcrawl_atmospherics.dm @@ -95,4 +95,24 @@ obj/machinery/atmospherics/trinary/isConnectable(var/obj/machinery/atmospherics/ return (target == node || ..()) /obj/machinery/atmospherics/unary/isConnectable(var/obj/machinery/atmospherics/target) - return (target == node || ..()) \ No newline at end of file + return (target == node || ..()) + +/obj/machinery/atmospherics/proc/can_z_crawl(var/mob/living/L, var/direction) + return FALSE + +/obj/machinery/atmospherics/pipe/zpipe/can_z_crawl(var/mob/living/L, var/direction) + if(L.is_ventcrawling && L.loc == src) + if(node2 && check_connect_types(node2,src)) + if(direction == travel_direction) + return TRUE + +/obj/machinery/atmospherics/proc/handle_z_crawl(var/mob/living/L, var/direction) + return + +/obj/machinery/atmospherics/pipe/zpipe/handle_z_crawl(var/mob/living/L, var/direction) + L << span("notice", "You start climbing [travel_direction_name] the pipe. This will take a while...") + playsound(loc, 'sound/machines/ventcrawl.ogg', 100, 1, 3) + if(!do_after(L, 100, needhand = 0, act_target = get_turf(src)) || !can_z_crawl(L, direction)) + L << span("danger", "You gave up on climbing [travel_direction_name] the pipe.") + return FALSE + return ventcrawl_to(L, node2, null) \ No newline at end of file