mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-07-21 05:02:40 +01:00
Pipe Clamps, Shutoff Valves, and Leaking Tubes, oh my. (#6279)
* Pipe Clamps, Shutoff Valves, and Leaking Tubes, oh my. * Fix processing fuckery. * Deal with Forever-Seals, and Infini-clamps. * Update clamp.dm
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
/obj/machinery/atmospherics/valve/shutoff
|
||||
icon = 'icons/atmos/clamp.dmi'
|
||||
icon_state = "map_vclamp0"
|
||||
|
||||
name = "automatic shutoff valve"
|
||||
desc = "An automatic valve with control circuitry and pipe integrity sensor, capable of automatically isolating damaged segments of the pipe network."
|
||||
var/close_on_leaks = TRUE // If false it will be always open
|
||||
level = 1
|
||||
connect_types = CONNECT_TYPE_SCRUBBER | CONNECT_TYPE_SUPPLY | CONNECT_TYPE_REGULAR
|
||||
|
||||
/obj/machinery/atmospherics/valve/shutoff/update_icon()
|
||||
icon_state = "vclamp[open]"
|
||||
|
||||
/obj/machinery/atmospherics/valve/shutoff/examine(var/mob/user)
|
||||
..()
|
||||
to_chat(user, "The automatic shutoff circuit is [close_on_leaks ? "enabled" : "disabled"].")
|
||||
|
||||
/obj/machinery/atmospherics/valve/shutoff/Initialize()
|
||||
. = ..()
|
||||
open()
|
||||
hide(1)
|
||||
|
||||
/obj/machinery/atmospherics/valve/shutoff/attack_ai(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/atmospherics/valve/shutoff/attack_hand(var/mob/user)
|
||||
src.add_fingerprint(usr)
|
||||
update_icon(1)
|
||||
close_on_leaks = !close_on_leaks
|
||||
to_chat(user, "You [close_on_leaks ? "enable" : "disable"] the automatic shutoff circuit.")
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/atmospherics/valve/shutoff/process()
|
||||
..()
|
||||
|
||||
if (!network_node1 || !network_node2)
|
||||
if(open)
|
||||
close()
|
||||
return
|
||||
|
||||
if (!close_on_leaks)
|
||||
if (!open)
|
||||
open()
|
||||
return
|
||||
|
||||
if (network_node1.leaks.len || network_node2.leaks.len)
|
||||
if (open)
|
||||
close()
|
||||
else if (!open)
|
||||
open()
|
||||
Reference in New Issue
Block a user