Rework of Multi Z vent crawling PR (#2775)

Reworks #2689
Includes: Vent crawling up and down.

Quote from original PR:

Main feature is that ventcrawling between Z levels now works perfectly. It takes 10 seconds to climb up or down a pipe...
This commit is contained in:
Ron
2017-06-23 15:55:41 +03:00
committed by skull132
parent bec02b1524
commit 1dc0fee3cd
3 changed files with 54 additions and 7 deletions
+13 -5
View File
@@ -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, "<span class='warning'>You lack means of travel in that direction.</span>")
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
+20 -1
View File
@@ -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
@@ -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 || ..())
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)