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 21:37:40 +01:00
parent 8d8312a64a
commit 6a3e80e862
5 changed files with 47 additions and 9 deletions

View File

@@ -185,21 +185,24 @@ Pipelines + Other Objects -> Pipe network
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) && src.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
/obj/machinery/atmospherics/proc/can_crawl_through()
return 1

View File

@@ -313,6 +313,9 @@
</ul>
"}
/obj/machinery/atmospherics/unary/vent_pump/can_crawl_through()
return !welded
/obj/machinery/atmospherics/unary/vent_pump/attackby(var/obj/item/W as obj, var/mob/user as mob)
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W

View File

@@ -22,6 +22,7 @@
var/volume_rate = 1000 // 120
var/panic = 0 //is this scrubber panicked?
var/welded = 0
var/area_uid
var/radio_filter_out
@@ -41,6 +42,9 @@
var/hidden=""
if(level == 1 && istype(loc, /turf/simulated))
hidden="h"
if(welded)
icon_state = "[hidden]weld"
return
var/suffix=""
if(scrub_O2)
suffix="1"
@@ -108,6 +112,8 @@
return
if (!node)
return 0 // Let's not shut it off, for now.
if(welded)
return 0
//broadcast_status()
if(!on)
return 0
@@ -279,10 +285,33 @@
stat |= NOPOWER
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)
if(istype(W, /obj/item/device/multitool))
update_multitool_menu(user)
return 1
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)

View File

@@ -260,19 +260,22 @@
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
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))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 16 KiB