OOP pipe-crawling procs

You can now weld scrubbers, which stops their airflow and also crawling
through them. There is now a proc for if a mob can ventcrawl through a pipe.
This commit is contained in:
ComicIronic
2015-04-20 14:44:52 -07:00
committed by Tigercat2000
parent 65ea7e07d9
commit b96f5ea7ef
5 changed files with 50 additions and 13 deletions
+7 -4
View File
@@ -156,21 +156,24 @@ obj/machinery/atmospherics/proc/check_connect_types_construction(obj/machinery/a
var/obj/machinery/atmospherics/target_move = findConnecting(direction)
if(target_move)
if(is_type_in_list(target_move, ventcrawl_machinery))
if(is_type_in_list(target_move, ventcrawl_machinery) && target_move.can_crawl_through())
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
else if(target_move.can_crawl_through())
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
if((direction & initialize_directions) || is_type_in_list(src, ventcrawl_machinery) && target_move.can_crawl_through()) //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
user.canmove = 1
/obj/machinery/atmospherics/proc/can_crawl_through()
return 1
@@ -307,6 +307,9 @@
update_icon()
return
/obj/machinery/atmospherics/unary/vent_pump/can_crawl_through()
return !welded
/obj/machinery/atmospherics/unary/vent_pump/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
@@ -23,13 +23,14 @@
var/volume_rate = 120
var/panic = 0 //is this scrubber panicked?
var/welded = 0
var/area_uid
var/radio_filter_out
var/radio_filter_in
connect_types = list(1,3) //connects to regular and scrubber pipes
/obj/machinery/atmospherics/unary/vent_scrubber/New()
icon = null
@@ -50,7 +51,7 @@
return
overlays.Cut()
var/scrubber_icon = "scrubber"
var/turf/T = get_turf(src)
@@ -61,6 +62,8 @@
scrubber_icon += "off"
else
scrubber_icon += "[on ? "[scrubbing ? "on" : "in"]" : "off"]"
if(welded)
scrubber_icon = "scrubberweld"
overlays += icon_manager.get_atmos_icon("device", , , scrubber_icon)
@@ -127,6 +130,8 @@
return
if (!node)
on = 0
if(welded)
return 0
//broadcast_status()
if(!on)
return 0
@@ -151,7 +156,7 @@
removed.oxygen = 0
if(scrub_N2)
filtered_out.nitrogen = removed.nitrogen
removed.nitrogen = 0
removed.nitrogen = 0
if(scrub_Toxins)
filtered_out.toxins = removed.toxins
removed.toxins = 0
@@ -229,7 +234,7 @@
scrubbing = text2num(signal.data["scrubbing"])
if(signal.data["toggle_scrubbing"])
scrubbing = !scrubbing
if(signal.data["o2_scrub"] != null)
scrub_O2 = text2num(signal.data["o2_scrub"])
if(signal.data["toggle_o2_scrub"])
@@ -276,7 +281,30 @@
if(old_stat != stat)
update_icon()
/obj/machinery/atmospherics/unary/vent_scrubber/can_crawl_through()
return !welded
/obj/machinery/atmospherics/unary/vent_scrubber/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if (WT.remove_fuel(0,user))
user << "<span class='notice'>Now welding the scrubber.</span>"
if(do_after(user, 20))
if(!src || !WT.isOn()) return
playsound(get_turf(src), 'sound/items/Welder2.ogg', 50, 1)
if(!welded)
user.visible_message("[user] welds the scrubber shut.", "You weld the vent scrubber.", "You hear welding.")
welded = 1
update_icon()
else
user.visible_message("[user] unwelds the scrubber.", "You unweld the scrubber.", "You hear welding.")
welded = 0
update_icon()
else
user << "<span class='notice'>The welding tool needs to be on to start this task.</span>"
else
user << "<span class='notice'>You need more welding fuel to complete this task.</span>"
return 1
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && on)
+8 -5
View File
@@ -271,19 +271,22 @@ mob/living
var/obj/machinery/atmospherics/unary/vent_found
if(clicked_on && Adjacent(clicked_on))
var/obj/machinery/atmospherics/unary/vent_pump/v = clicked_on
if(!istype(v) || !v.welded)
vent_found = clicked_on
vent_found = clicked_on
if(!istype(vent_found) || !vent_found.can_crawl_through())
vent_found = null
if(!vent_found)
for(var/obj/machinery/atmospherics/machine in range(1,src))
if(is_type_in_list(machine, ventcrawl_machinery))
vent_found = machine
var/obj/machinery/atmospherics/unary/vent_pump/v = machine
if(istype(v) && v.welded)
if(!vent_found.can_crawl_through())
vent_found = null
if(vent_found)
break
if(vent_found)
if(vent_found.network && (vent_found.network.normal_members.len || vent_found.network.line_members.len))