Ventcrawl Overhaul

Ventcrawling mobs now no longer get a teleportation menu, instead, they
are put inside the vents, the client gets an overlay of the pipes in the
pipe network, and it is up to them to navigate.
This commit is contained in:
ComicIronic
2015-04-20 13:09:04 -07:00
committed by Tigercat2000
parent 35664b8708
commit 65ea7e07d9
15 changed files with 181 additions and 222 deletions
+50 -11
View File
@@ -15,26 +15,38 @@ Pipelines + Other Objects -> Pipe network
active_power_usage = 0
power_channel = ENVIRON
var/nodealert = 0
layer = 2.4 //under wires with their 2.44
layer = 2.4 //under wires with their 2.44
var/connect_types[] = list(1) //1=regular, 2=supply, 3=scrubber
var/connected_to = 1 //same as above, currently not used for anything
var/icon_connect_type = "" //"-supply" or "-scrubbers"
var/initialize_directions = 0
var/pipe_color
var/global/datum/pipe_icon_manager/icon_manager
/obj/machinery/atmospherics/Destroy()
for(var/mob/living/M in src) //ventcrawling is serious business
M.remove_ventcrawl()
M.loc = src.loc
..()
// Find a connecting /obj/machinery/atmospherics in specified direction.
/obj/machinery/atmospherics/proc/findConnecting(var/direction)
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
return target
/obj/machinery/atmospherics/New()
if(!icon_manager)
icon_manager = new()
if(!pipe_color)
pipe_color = color
color = null
if(!pipe_color_check(pipe_color))
pipe_color = null
..()
@@ -84,22 +96,22 @@ obj/machinery/atmospherics/proc/check_connect_types_construction(obj/machinery/a
if(list1[i] == list2[j])
var/n = list1[i]
return n
return 0
return 0
/obj/machinery/atmospherics/proc/check_icon_cache(var/safety = 0)
if(!istype(icon_manager))
if(!safety) //to prevent infinite loops
icon_manager = new()
check_icon_cache(1)
return 0
return 1
/obj/machinery/atmospherics/proc/color_cache_name(var/obj/machinery/atmospherics/node)
//Don't use this for standard pipes
if(!istype(node))
return null
return node.pipe_color
/obj/machinery/atmospherics/process()
@@ -134,4 +146,31 @@ obj/machinery/atmospherics/proc/check_connect_types_construction(obj/machinery/a
/obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference)
/obj/machinery/atmospherics/update_icon()
return null
return null
#define VENT_SOUND_DELAY 30
/obj/machinery/atmospherics/relaymove(mob/living/user, direction)
if(!(direction & initialize_directions)) //can't go in a way we aren't connecting to
return
var/obj/machinery/atmospherics/target_move = findConnecting(direction)
if(target_move)
if(is_type_in_list(target_move, ventcrawl_machinery))
user.remove_ventcrawl()
user.forceMove(target_move.loc) //handles entering and so on
user.visible_message("You hear something squeezing through the ducts.", "You climb out the ventilation system.")
else
user.loc = target_move
user.client.eye = target_move //if we don't do this, Byond only updates the eye every tick - required for smooth movement
if(world.time - user.last_played_vent > VENT_SOUND_DELAY)
user.last_played_vent = world.time
playsound(src, 'sound/machines/ventcrawl.ogg', 50, 1, -3)
else
if((direction & initialize_directions) || is_type_in_list(src, ventcrawl_machinery)) //if we move in a way the pipe can connect, but doesn't - or we're in a vent
user.remove_ventcrawl()
user.forceMove(src.loc)
user.visible_message("You hear something squeezing through the pipes.", "You climb out the ventilation system.")
user.canmove = 0
spawn(1)
user.canmove = 1
@@ -39,7 +39,7 @@
var/radio_filter_out
var/radio_filter_in
connect_types = list(1,2) //connects to regular and supply pipes
/obj/machinery/atmospherics/unary/vent_pump/on
@@ -80,7 +80,7 @@
return
overlays.Cut()
var/vent_icon = "vent"
var/turf/T = get_turf(src)
@@ -89,7 +89,7 @@
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
vent_icon += "h"
if(welded)
vent_icon += "weld"
else if(!powered())
@@ -375,16 +375,3 @@
initial_loc.air_vent_names -= id_tag
..()
return
/*
Alt-click to ventcrawl - Monkeys, aliens, slimes and mice.
This is a little buggy but somehow that just seems to plague ventcrawl.
I am sorry, I don't know why.
*/
/obj/machinery/atmospherics/unary/vent_pump/AltClick(var/mob/living/ML)
if(istype(ML))
var/list/ventcrawl_verbs = list(/mob/living/carbon/monkey/verb/ventcrawl, /mob/living/carbon/alien/verb/alien_ventcrawl, /mob/living/carbon/slime/verb/ventcrawl,/mob/living/simple_animal/mouse/verb/ventcrawl)
if(length(ML.verbs & ventcrawl_verbs)) // alien queens have this removed, an istype would be complicated
ML.handle_ventcrawl(src)
return
..()