Merge pull request #1478 from tigercat2000/cleanpipecodehahahaha

Clean up pipecode and split huge file into folder structure
This commit is contained in:
Fox-McCloud
2015-07-09 00:44:37 -04:00
41 changed files with 2382 additions and 2387 deletions
+5 -5
View File
@@ -62,13 +62,13 @@
C.loc = src
C.add_fingerprint(usr)
user.visible_message("\blue [user] inserts a power cell into [src].", "\blue You insert the power cell into [src].")
user.visible_message("<span class='notice'>[user] inserts a power cell into [src].</span>", "<span class='notice'>You insert the power cell into [src].</span>")
else
user << "The hatch must be open to insert a power cell."
return
else if(istype(I, /obj/item/weapon/screwdriver))
open = !open
user.visible_message("\blue [user] [open ? "opens" : "closes"] the hatch on the [src].", "\blue You [open ? "open" : "close"] the hatch on the [src].")
user.visible_message("<span class='notice'>[user] [open ? "opens" : "closes"] the hatch on the [src].</span>", "<span class='notice'>You [open ? "open" : "close"] the hatch on the [src].</span>")
update_icon()
if(!open && user.machine == src)
user << browse(null, "window=aircond")
@@ -106,7 +106,7 @@
onclose(user, "aircond")
else
on = !on
user.visible_message("\blue [user] switches [on ? "on" : "off"] the [src].","\blue You switch [on ? "on" : "off"] the [src].")
user.visible_message("<span class='notice'>[user] switches [on ? "on" : "off"] the [src].</span>","<span class='notice'>You switch [on ? "on" : "off"] the [src].</span>")
update_icon()
return
@@ -131,7 +131,7 @@
usr.put_in_hands(cell)
cell.add_fingerprint(usr)
cell = null
usr.visible_message("\blue [usr] removes the power cell from \the [src].", "\blue You remove the power cell from \the [src].")
usr.visible_message("<span class='notice'>[usr] removes the power cell from \the [src].</span>", "<span class='notice'>You remove the power cell from \the [src].</span>")
if("cellinstall")
@@ -143,7 +143,7 @@
C.loc = src
C.add_fingerprint(usr)
usr.visible_message("\blue [usr] inserts a power cell into \the [src].", "\blue You insert the power cell into \the [src].")
usr.visible_message("<span class='notice'>[usr] inserts a power cell into \the [src].</span>", "<span class='notice'>You insert the power cell into \the [src].</span>")
src.updateDialog()
else
@@ -1,4 +1,4 @@
obj/machinery/atmospherics/binary
/obj/machinery/atmospherics/binary
dir = SOUTH
initialize_directions = SOUTH|NORTH
use_power = 1
@@ -12,131 +12,131 @@ obj/machinery/atmospherics/binary
var/datum/pipe_network/network1
var/datum/pipe_network/network2
New()
..()
switch(dir)
if(NORTH)
initialize_directions = NORTH|SOUTH
if(SOUTH)
initialize_directions = NORTH|SOUTH
if(EAST)
initialize_directions = EAST|WEST
if(WEST)
initialize_directions = EAST|WEST
air1 = new
air2 = new
/obj/machinery/atmospherics/binary/New()
..()
switch(dir)
if(NORTH)
initialize_directions = NORTH|SOUTH
if(SOUTH)
initialize_directions = NORTH|SOUTH
if(EAST)
initialize_directions = EAST|WEST
if(WEST)
initialize_directions = EAST|WEST
air1 = new
air2 = new
air1.volume = 200
air2.volume = 200
air1.volume = 200
air2.volume = 200
/obj/machinery/atmospherics/binary/Destroy()
loc = null
if(node1)
node1.disconnect(src)
qdel(network1)
if(node2)
node2.disconnect(src)
qdel(network2)
node1 = null
node2 = null
return ..()
// Housekeeping and pipe network stuff below
network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node1)
network1 = new_network
/obj/machinery/atmospherics/binary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node1)
network1 = new_network
else if(reference == node2)
network2 = new_network
else if(reference == node2)
network2 = new_network
if(new_network.normal_members.Find(src))
return 0
if(new_network.normal_members.Find(src))
return 0
new_network.normal_members += src
new_network.normal_members += src
return null
return null
Destroy()
loc = null
/obj/machinery/atmospherics/binary/initialize()
if(node1 && node2) return
if(node1)
node1.disconnect(src)
qdel(network1)
if(node2)
node2.disconnect(src)
qdel(network2)
var/node2_connect = dir
var/node1_connect = turn(dir, 180)
for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node2 = target
break
update_icon()
update_underlays()
/obj/machinery/atmospherics/binary/build_network()
if(!network1 && node1)
network1 = new /datum/pipe_network()
network1.normal_members += src
network1.build_network(node1, src)
if(!network2 && node2)
network2 = new /datum/pipe_network()
network2.normal_members += src
network2.build_network(node2, src)
/obj/machinery/atmospherics/binary/return_network(obj/machinery/atmospherics/reference)
build_network()
if(reference==node1)
return network1
if(reference==node2)
return network2
return null
/obj/machinery/atmospherics/binary/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
if(network1 == old_network)
network1 = new_network
if(network2 == old_network)
network2 = new_network
return 1
/obj/machinery/atmospherics/binary/return_network_air(datum/pipe_network/reference)
var/list/results = list()
if(network1 == reference)
results += air1
if(network2 == reference)
results += air2
return results
/obj/machinery/atmospherics/binary/disconnect(obj/machinery/atmospherics/reference)
if(reference==node1)
qdel(network1)
node1 = null
else if(reference==node2)
qdel(network2)
node2 = null
return ..()
update_icon()
update_underlays()
initialize()
if(node1 && node2) return
var/node2_connect = dir
var/node1_connect = turn(dir, 180)
for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node2 = target
break
update_icon()
update_underlays()
build_network()
if(!network1 && node1)
network1 = new /datum/pipe_network()
network1.normal_members += src
network1.build_network(node1, src)
if(!network2 && node2)
network2 = new /datum/pipe_network()
network2.normal_members += src
network2.build_network(node2, src)
return_network(obj/machinery/atmospherics/reference)
build_network()
if(reference==node1)
return network1
if(reference==node2)
return network2
return null
reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
if(network1 == old_network)
network1 = new_network
if(network2 == old_network)
network2 = new_network
return 1
return_network_air(datum/pipe_network/reference)
var/list/results = list()
if(network1 == reference)
results += air1
if(network2 == reference)
results += air2
return results
disconnect(obj/machinery/atmospherics/reference)
if(reference==node1)
del(network1)
node1 = null
else if(reference==node2)
del(network2)
node2 = null
update_icon()
update_underlays()
return null
return null
@@ -73,7 +73,7 @@
/obj/machinery/atmospherics/binary/circulator/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/wrench))
anchored = !anchored
user << "\blue You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor."
user << "<span class='notice'>You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.</span>"
if(anchored)
if(dir & (NORTH|SOUTH))
@@ -265,7 +265,7 @@
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if (WT.remove_fuel(0,user))
user << "\blue Now welding the vent."
user << "<span class='notice'>Now welding the vent.</span>"
if(do_after(user, 20))
if(!src || !WT.isOn()) return
playsound(get_turf(src), 'sound/items/Welder2.ogg', 50, 1)
@@ -278,9 +278,9 @@
welded = 0
update_icon()
else
user << "\blue The welding tool needs to be on to start this task."
user << "<span class='notice'>The welding tool needs to be on to start this task.</span>"
else
user << "\blue You need more welding fuel to complete this task."
user << "<span class='notice'>You need more welding fuel to complete this task.</span>"
return 1*/
if(istype(W, /obj/item/device/multitool))
update_multitool_menu(user)
@@ -288,24 +288,24 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && on)
user << "\red You cannot unwrench this [src], turn it off first."
user << "<span class='alert'>You cannot unwrench this [src], turn it off first.</span>"
return 1
var/turf/T = src.loc
if (level==1 && isturf(T) && T.intact)
user << "\red You must remove the plating first."
user << "<span class='alert'>You must remove the plating first.</span>"
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
@@ -134,7 +134,7 @@
return
src.add_fingerprint(usr)
if(!src.allowed(user))
user << "\red Access denied."
user << "<span class='alert'>Access denied.</span>"
return
usr.set_machine(src)
interact(user)
@@ -156,20 +156,20 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (on)
user << "\red You cannot unwrench this [src], turn it off first."
user << "<span class='alert'>You cannot unwrench this [src], turn it off first.</span>"
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
@@ -160,7 +160,7 @@ Thus, the two variables affect pump operation are set in New():
return
src.add_fingerprint(usr)
if(!src.allowed(user))
user << "\red Access denied."
user << "<span class='alert'>Access denied.</span>"
return
usr.set_machine(src)
interact(user)
@@ -188,20 +188,20 @@ Thus, the two variables affect pump operation are set in New():
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && on)
user << "\red You cannot unwrench this [src], turn it off first."
user << "<span class='alert'>You cannot unwrench this [src], turn it off first.</span>"
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
@@ -147,7 +147,7 @@ Thus, the two variables affect pump operation are set in New():
return
src.add_fingerprint(usr)
if(!src.allowed(user))
user << "\red Access denied."
user << "<span class='alert'>Access denied.</span>"
return
usr.set_machine(src)
interact(user)
@@ -175,20 +175,20 @@ Thus, the two variables affect pump operation are set in New():
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && on)
user << "\red You cannot unwrench this [src], turn it off first."
user << "<span class='alert'>You cannot unwrench this [src], turn it off first.</span>"
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
@@ -79,15 +79,15 @@
int_pressure += P.air.return_pressure()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_pressure - env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "<span class='warning'>You cannot unwrench [src], it is too exerted due to internal pressure.</span>"
user << "<span class='alert'>You cannot unwrench [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
user << "\blue You begin to unfasten \the [src]..."
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
if(do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
@@ -137,22 +137,22 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (connected_device)
user << "\red You cannot unwrench this [src], detach [connected_device] first."
user << "<span class='alert'>You cannot unwrench this [src], detach [connected_device] first.</span>"
return 1
if (locate(/obj/machinery/portable_atmospherics, src.loc))
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
@@ -41,7 +41,7 @@ Filter types:
icon_state = "m"
else
icon_state = ""
if(!powered())
icon_state += "off"
else if(node2 && node3 && node1)
@@ -162,16 +162,16 @@ Filter types:
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
@@ -181,7 +181,7 @@ Filter types:
return
if(!src.allowed(user))
user << "\red Access denied."
user << "<span class='alert'>Access denied.</span>"
return
var/dat
@@ -272,7 +272,7 @@ obj/machinery/atmospherics/trinary/filter/m_filter/New()
/obj/machinery/atmospherics/trinary/filter/m_filter/initialize()
set_frequency(frequency)
if(node1 && node2 && node3) return
var/node1_connect = turn(dir, -180)
@@ -19,7 +19,7 @@
icon_state = "t"
else
icon_state = ""
if(!powered())
icon_state += "off"
else if(node2 && node3 && node1)
@@ -120,16 +120,16 @@
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
@@ -138,7 +138,7 @@
return
src.add_fingerprint(usr)
if(!src.allowed(user))
user << "\red Access denied."
user << "<span class='alert'>Access denied.</span>"
return
usr.set_machine(src)
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
@@ -183,7 +183,7 @@
src.updateUsrDialog()
return
obj/machinery/atmospherics/trinary/mixer/t_mixer
/obj/machinery/atmospherics/trinary/mixer/t_mixer
icon_state = "tmap"
dir = SOUTH
@@ -191,7 +191,7 @@ obj/machinery/atmospherics/trinary/mixer/t_mixer
//node 3 is the outlet, nodes 1 & 2 are intakes
obj/machinery/atmospherics/trinary/mixer/t_mixer/New()
/obj/machinery/atmospherics/trinary/mixer/t_mixer/New()
..()
switch(dir)
if(NORTH)
@@ -203,7 +203,7 @@ obj/machinery/atmospherics/trinary/mixer/t_mixer/New()
if(WEST)
initialize_directions = WEST|NORTH|SOUTH
obj/machinery/atmospherics/trinary/mixer/t_mixer/initialize()
/obj/machinery/atmospherics/trinary/mixer/t_mixer/initialize()
if(node1 && node2 && node3) return
var/node1_connect = turn(dir, -90)
@@ -228,7 +228,7 @@ obj/machinery/atmospherics/trinary/mixer/t_mixer/initialize()
update_icon()
update_underlays()
obj/machinery/atmospherics/trinary/mixer/m_mixer
/obj/machinery/atmospherics/trinary/mixer/m_mixer
icon_state = "mmap"
dir = SOUTH
@@ -236,7 +236,7 @@ obj/machinery/atmospherics/trinary/mixer/m_mixer
//node 3 is the outlet, nodes 1 & 2 are intakes
obj/machinery/atmospherics/trinary/mixer/m_mixer/New()
/obj/machinery/atmospherics/trinary/mixer/m_mixer/New()
..()
switch(dir)
if(NORTH)
@@ -248,7 +248,7 @@ obj/machinery/atmospherics/trinary/mixer/m_mixer/New()
if(WEST)
initialize_directions = WEST|SOUTH|EAST
obj/machinery/atmospherics/trinary/mixer/m_mixer/initialize()
/obj/machinery/atmospherics/trinary/mixer/m_mixer/initialize()
if(node1 && node2 && node3) return
var/node1_connect = turn(dir, -180)
@@ -1,4 +1,4 @@
obj/machinery/atmospherics/trinary
/obj/machinery/atmospherics/trinary
dir = SOUTH
initialize_directions = SOUTH|NORTH|WEST
use_power = 1
@@ -17,153 +17,153 @@ obj/machinery/atmospherics/trinary
var/datum/pipe_network/network2
var/datum/pipe_network/network3
New()
..()
switch(dir)
if(NORTH)
initialize_directions = EAST|NORTH|SOUTH
if(SOUTH)
initialize_directions = SOUTH|WEST|NORTH
if(EAST)
initialize_directions = EAST|WEST|SOUTH
if(WEST)
initialize_directions = WEST|NORTH|EAST
air1 = new
air2 = new
air3 = new
/obj/machinery/atmospherics/trinary/New()
..()
switch(dir)
if(NORTH)
initialize_directions = EAST|NORTH|SOUTH
if(SOUTH)
initialize_directions = SOUTH|WEST|NORTH
if(EAST)
initialize_directions = EAST|WEST|SOUTH
if(WEST)
initialize_directions = WEST|NORTH|EAST
air1 = new
air2 = new
air3 = new
air1.volume = 200
air2.volume = 200
air3.volume = 200
air1.volume = 200
air2.volume = 200
air3.volume = 200
/obj/machinery/atmospherics/trinary/Destroy()
loc = null
if(node1)
node1.disconnect(src)
qdel(network1)
if(node2)
node2.disconnect(src)
qdel(network2)
if(node3)
node3.disconnect(src)
qdel(network3)
node1 = null
node2 = null
node3 = null
return ..()
// Housekeeping and pipe network stuff below
network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node1)
network1 = new_network
/obj/machinery/atmospherics/trinary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node1)
network1 = new_network
else if(reference == node2)
network2 = new_network
else if(reference == node2)
network2 = new_network
else if (reference == node3)
network3 = new_network
else if (reference == node3)
network3 = new_network
if(new_network.normal_members.Find(src))
return 0
if(new_network.normal_members.Find(src))
return 0
new_network.normal_members += src
new_network.normal_members += src
return null
return null
Destroy()
loc = null
/obj/machinery/atmospherics/trinary/initialize()
if(node1 && node2 && node3) return
if(node1)
node1.disconnect(src)
qdel(network1)
if(node2)
node2.disconnect(src)
qdel(network2)
if(node3)
node3.disconnect(src)
qdel(network3)
var/node1_connect = turn(dir, -180)
var/node2_connect = turn(dir, -90)
var/node3_connect = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
if(target.initialize_directions & get_dir(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect))
if(target.initialize_directions & get_dir(target,src))
node2 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node3_connect))
if(target.initialize_directions & get_dir(target,src))
node3 = target
break
update_icon()
update_underlays()
/obj/machinery/atmospherics/trinary/build_network()
if(!network1 && node1)
network1 = new /datum/pipe_network()
network1.normal_members += src
network1.build_network(node1, src)
if(!network2 && node2)
network2 = new /datum/pipe_network()
network2.normal_members += src
network2.build_network(node2, src)
if(!network3 && node3)
network3 = new /datum/pipe_network()
network3.normal_members += src
network3.build_network(node3, src)
/obj/machinery/atmospherics/trinary/return_network(obj/machinery/atmospherics/reference)
build_network()
if(reference==node1)
return network1
if(reference==node2)
return network2
if(reference==node3)
return network3
return null
/obj/machinery/atmospherics/trinary/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
if(network1 == old_network)
network1 = new_network
if(network2 == old_network)
network2 = new_network
if(network3 == old_network)
network3 = new_network
return 1
/obj/machinery/atmospherics/trinary/return_network_air(datum/pipe_network/reference)
var/list/results = list()
if(network1 == reference)
results += air1
if(network2 == reference)
results += air2
if(network3 == reference)
results += air3
return results
/obj/machinery/atmospherics/trinary/disconnect(obj/machinery/atmospherics/reference)
if(reference==node1)
qdel(network1)
node1 = null
else if(reference==node2)
qdel(network2)
node2 = null
else if(reference==node3)
qdel(network3)
node3 = null
return ..()
update_underlays()
initialize()
if(node1 && node2 && node3) return
var/node1_connect = turn(dir, -180)
var/node2_connect = turn(dir, -90)
var/node3_connect = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
if(target.initialize_directions & get_dir(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect))
if(target.initialize_directions & get_dir(target,src))
node2 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node3_connect))
if(target.initialize_directions & get_dir(target,src))
node3 = target
break
update_icon()
update_underlays()
build_network()
if(!network1 && node1)
network1 = new /datum/pipe_network()
network1.normal_members += src
network1.build_network(node1, src)
if(!network2 && node2)
network2 = new /datum/pipe_network()
network2.normal_members += src
network2.build_network(node2, src)
if(!network3 && node3)
network3 = new /datum/pipe_network()
network3.normal_members += src
network3.build_network(node3, src)
return_network(obj/machinery/atmospherics/reference)
build_network()
if(reference==node1)
return network1
if(reference==node2)
return network2
if(reference==node3)
return network3
return null
reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
if(network1 == old_network)
network1 = new_network
if(network2 == old_network)
network2 = new_network
if(network3 == old_network)
network3 = new_network
return 1
return_network_air(datum/pipe_network/reference)
var/list/results = list()
if(network1 == reference)
results += air1
if(network2 == reference)
results += air2
if(network3 == reference)
results += air3
return results
disconnect(obj/machinery/atmospherics/reference)
if(reference==node1)
del(network1)
node1 = null
else if(reference==node2)
del(network2)
node2 = null
else if(reference==node3)
del(network3)
node3 = null
update_underlays()
return null
return null
+7 -7
View File
@@ -317,7 +317,7 @@
if(!powered())
return
if(!src.allowed(user))
user << "\red Access denied."
user << "<span class='alert'>Access denied.</span>"
return
..()
@@ -359,21 +359,21 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (istype(src, /obj/machinery/atmospherics/tvalve/digital))
user << "\red You cannot unwrench this [src], it's too complicated."
user << "<span class='alert'>You cannot unwrench this [src], it's too complicated.</span>"
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
@@ -457,7 +457,7 @@
if(!powered())
return
if(!src.allowed(user))
user << "\red Access denied."
user << "<span class='alert'>Access denied.</span>"
return
..()
+21 -21
View File
@@ -12,30 +12,30 @@
var/current_temperature = T20C
var/current_heat_capacity = 50000 //totally random
update_icon()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed"
/obj/machinery/atmospherics/unary/cold_sink/update_icon()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed"
on = 0
on = 0
return
return
process()
..()
if(!on || !network)
return 0
var/air_heat_capacity = air_contents.heat_capacity()
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
var/old_temperature = air_contents.temperature
/obj/machinery/atmospherics/unary/cold_sink/process()
..()
if(!on || !network)
return 0
var/air_heat_capacity = air_contents.heat_capacity()
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
var/old_temperature = air_contents.temperature
if(combined_heat_capacity > 0)
var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
air_contents.temperature = combined_energy/combined_heat_capacity
if(combined_heat_capacity > 0)
var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
air_contents.temperature = combined_energy/combined_heat_capacity
//todo: have current temperature affected. require power to bring down current temperature again
//todo: have current temperature affected. require power to bring down current temperature again
if(abs(old_temperature-air_contents.temperature) > 1)
network.update = 1
return 1
if(abs(old_temperature-air_contents.temperature) > 1)
network.update = 1
return 1
@@ -8,14 +8,13 @@
var/update_cycle
update_icon()
if(node)
icon_state = "intact"
else
icon_state = "exposed"
/obj/machinery/atmospherics/unary/generator_input/update_icon()
if(node)
icon_state = "intact"
else
icon_state = "exposed"
return
return
proc
return_exchange_air()
return air_contents
/obj/machinery/atmospherics/unary/generator_input/proc/return_exchange_air()
return air_contents
@@ -10,80 +10,80 @@
var/obj/machinery/atmospherics/unary/heat_exchanger/partner = null
var/update_cycle
update_icon()
if(node)
icon_state = "intact"
else
icon_state = "exposed"
/obj/machinery/atmospherics/unary/heat_exchanger/update_icon()
if(node)
icon_state = "intact"
else
icon_state = "exposed"
return
return
initialize()
if(!partner)
var/partner_connect = turn(dir,180)
/obj/machinery/atmospherics/unary/heat_exchanger/initialize()
if(!partner)
var/partner_connect = turn(dir,180)
for(var/obj/machinery/atmospherics/unary/heat_exchanger/target in get_step(src,partner_connect))
if(target.dir & get_dir(src,target))
partner = target
partner.partner = src
break
for(var/obj/machinery/atmospherics/unary/heat_exchanger/target in get_step(src,partner_connect))
if(target.dir & get_dir(src,target))
partner = target
partner.partner = src
break
..()
..()
process()
..()
if(!partner)
return 0
/obj/machinery/atmospherics/unary/heat_exchanger/process()
..()
if(!partner)
return 0
if(!air_master || air_master.current_cycle <= update_cycle)
return 0
if(!air_master || air_master.current_cycle <= update_cycle)
return 0
update_cycle = air_master.current_cycle
partner.update_cycle = air_master.current_cycle
update_cycle = air_master.current_cycle
partner.update_cycle = air_master.current_cycle
var/air_heat_capacity = air_contents.heat_capacity()
var/other_air_heat_capacity = partner.air_contents.heat_capacity()
var/combined_heat_capacity = other_air_heat_capacity + air_heat_capacity
var/air_heat_capacity = air_contents.heat_capacity()
var/other_air_heat_capacity = partner.air_contents.heat_capacity()
var/combined_heat_capacity = other_air_heat_capacity + air_heat_capacity
var/old_temperature = air_contents.temperature
var/other_old_temperature = partner.air_contents.temperature
var/old_temperature = air_contents.temperature
var/other_old_temperature = partner.air_contents.temperature
if(combined_heat_capacity > 0)
var/combined_energy = partner.air_contents.temperature*other_air_heat_capacity + air_heat_capacity*air_contents.temperature
if(combined_heat_capacity > 0)
var/combined_energy = partner.air_contents.temperature*other_air_heat_capacity + air_heat_capacity*air_contents.temperature
var/new_temperature = combined_energy/combined_heat_capacity
air_contents.temperature = new_temperature
partner.air_contents.temperature = new_temperature
var/new_temperature = combined_energy/combined_heat_capacity
air_contents.temperature = new_temperature
partner.air_contents.temperature = new_temperature
if(network)
if(abs(old_temperature-air_contents.temperature) > 1)
network.update = 1
if(network)
if(abs(old_temperature-air_contents.temperature) > 1)
network.update = 1
if(partner.network)
if(abs(other_old_temperature-partner.air_contents.temperature) > 1)
partner.network.update = 1
if(partner.network)
if(abs(other_old_temperature-partner.air_contents.temperature) > 1)
partner.network.update = 1
return 1
/obj/machinery/atmospherics/unary/heat_exchanger/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
var/turf/T = src.loc
if (level==1 && isturf(T) && T.intact)
user << "<span class='alert'>You must remove the plating first.</span>"
return 1
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
var/turf/T = src.loc
if (level==1 && isturf(T) && T.intact)
user << "\red You must remove the plating first."
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
add_fingerprint(user)
return 1
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
qdel(src)
@@ -14,30 +14,30 @@
var/current_temperature = T20C
var/current_heat_capacity = 50000 //totally random
update_icon()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed"
/obj/machinery/atmospherics/unary/heat_reservoir/update_icon()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed"
on = 0
on = 0
return
return
process()
..()
if(!on || !network)
return 0
var/air_heat_capacity = air_contents.heat_capacity()
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
var/old_temperature = air_contents.temperature
/obj/machinery/atmospherics/unary/heat_reservoir/process()
..()
if(!on || !network)
return 0
var/air_heat_capacity = air_contents.heat_capacity()
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
var/old_temperature = air_contents.temperature
if(combined_heat_capacity > 0)
var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
air_contents.temperature = combined_energy/combined_heat_capacity
if(combined_heat_capacity > 0)
var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
air_contents.temperature = combined_energy/combined_heat_capacity
//todo: have current temperature affected. require power to bring up current temperature again
//todo: have current temperature affected. require power to bring up current temperature again
if(abs(old_temperature-air_contents.temperature) > 1)
network.update = 1
return 1
if(abs(old_temperature-air_contents.temperature) > 1)
network.update = 1
return 1
@@ -174,27 +174,27 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && on)
user << "\red You cannot unwrench this [src], turn it off first."
user << "<span class='alert'>You cannot unwrench this [src], turn it off first.</span>"
return 1
var/turf/T = src.loc
if (level==1 && isturf(T) && T.intact)
user << "\red You must remove the plating first."
user << "<span class='alert'>You must remove the plating first.</span>"
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
qdel(src)
/obj/machinery/atmospherics/unary/outlet_injector/interact(mob/user as mob)
update_multitool_menu(user)
@@ -1,4 +1,4 @@
obj/machinery/atmospherics/unary/oxygen_generator
/obj/machinery/atmospherics/unary/oxygen_generator
icon = 'icons/obj/atmospherics/oxygen_generator.dmi'
icon_state = "intact_off"
density = 1
@@ -13,37 +13,37 @@ obj/machinery/atmospherics/unary/oxygen_generator
var/oxygen_content = 10
update_icon()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed_off"
/obj/machinery/atmospherics/unary/oxygen_generator/update_icon()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed_off"
on = 0
on = 0
return
return
New()
..()
/obj/machinery/atmospherics/unary/oxygen_generator/New()
..()
air_contents.volume = 50
air_contents.volume = 50
process()
..()
if(!on)
return 0
/obj/machinery/atmospherics/unary/oxygen_generator/process()
..()
if(!on)
return 0
var/total_moles = air_contents.total_moles()
var/total_moles = air_contents.total_moles()
if(total_moles < oxygen_content)
var/current_heat_capacity = air_contents.heat_capacity()
if(total_moles < oxygen_content)
var/current_heat_capacity = air_contents.heat_capacity()
var/added_oxygen = oxygen_content - total_moles
var/added_oxygen = oxygen_content - total_moles
air_contents.temperature = (current_heat_capacity*air_contents.temperature + 20*added_oxygen*T0C)/(current_heat_capacity+20*added_oxygen)
air_contents.oxygen += added_oxygen
air_contents.temperature = (current_heat_capacity*air_contents.temperature + 20*added_oxygen*T0C)/(current_heat_capacity+20*added_oxygen)
air_contents.oxygen += added_oxygen
if(network)
network.update = 1
if(network)
network.update = 1
return 1
return 1
@@ -12,102 +12,101 @@
name = "Thermal Transfer Plate"
desc = "Transfers heat to and from an area"
update_icon()
var/prefix=""
//var/suffix="_idle" // Also available: _heat, _cool
if(level == 1 && istype(loc, /turf/simulated))
prefix="h"
icon_state = "[prefix]off"
/obj/machinery/atmospherics/unary/thermal_plate/update_icon()
var/prefix=""
//var/suffix="_idle" // Also available: _heat, _cool
if(level == 1 && istype(loc, /turf/simulated))
prefix="h"
icon_state = "[prefix]off"
process()
..()
/obj/machinery/atmospherics/unary/thermal_plate/process()
..()
var/datum/gas_mixture/environment = loc.return_air()
var/datum/gas_mixture/environment = loc.return_air()
//Get processable air sample and thermal info from environment
//Get processable air sample and thermal info from environment
var/transfer_moles = 0.25 * environment.total_moles()
var/datum/gas_mixture/external_removed = environment.remove(transfer_moles)
var/transfer_moles = 0.25 * environment.total_moles()
var/datum/gas_mixture/external_removed = environment.remove(transfer_moles)
if (!external_removed)
return radiate()
if (!external_removed)
return radiate()
if (external_removed.total_moles() < 10)
return radiate()
if (external_removed.total_moles() < 10)
return radiate()
//Get same info from connected gas
//Get same info from connected gas
var/internal_transfer_moles = 0.25 * air_contents.total_moles()
var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles)
var/internal_transfer_moles = 0.25 * air_contents.total_moles()
var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles)
if (!internal_removed)
environment.merge(external_removed)
return 1
var/combined_heat_capacity = internal_removed.heat_capacity() + external_removed.heat_capacity()
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity() + external_removed.heat_capacity() * external_removed.temperature
if(!combined_heat_capacity) combined_heat_capacity = 1
var/final_temperature = combined_energy / combined_heat_capacity
external_removed.temperature = final_temperature
if (!internal_removed)
environment.merge(external_removed)
internal_removed.temperature = final_temperature
air_contents.merge(internal_removed)
network.update = 1
return 1
hide(var/i) //to make the little pipe section invisible, the icon changes.
var/prefix=""
//var/suffix="_idle" // Also available: _heat, _cool
if(i == 1 && istype(loc, /turf/simulated))
prefix="h"
icon_state = "[prefix]off"
return
var/combined_heat_capacity = internal_removed.heat_capacity() + external_removed.heat_capacity()
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity() + external_removed.heat_capacity() * external_removed.temperature
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
var/turf/T = src.loc
if (level==1 && isturf(T) && T.intact)
user << "\red You must remove the plating first."
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
add_fingerprint(user)
return 1
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
if(!combined_heat_capacity) combined_heat_capacity = 1
var/final_temperature = combined_energy / combined_heat_capacity
proc/radiate()
external_removed.temperature = final_temperature
environment.merge(external_removed)
var/internal_transfer_moles = 0.25 * air_contents.total_moles()
var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles)
internal_removed.temperature = final_temperature
air_contents.merge(internal_removed)
if (!internal_removed)
return 1
network.update = 1
var/combined_heat_capacity = internal_removed.heat_capacity() + RADIATION_CAPACITY
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity() + (RADIATION_CAPACITY * 6.4)
return 1
var/final_temperature = combined_energy / combined_heat_capacity
/obj/machinery/atmospherics/unary/thermal_plate/hide(var/i) //to make the little pipe section invisible, the icon changes.
var/prefix=""
//var/suffix="_idle" // Also available: _heat, _cool
if(i == 1 && istype(loc, /turf/simulated))
prefix="h"
icon_state = "[prefix]off"
return
internal_removed.temperature = final_temperature
air_contents.merge(internal_removed)
/obj/machinery/atmospherics/unary/thermal_plate/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
var/turf/T = src.loc
if (level==1 && isturf(T) && T.intact)
user << "<span class='alert'>You must remove the plating first.</span>"
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
qdel(src)
if (network)
network.update = 1
/obj/machinery/atmospherics/unary/thermal_plate/proc/radiate()
var/internal_transfer_moles = 0.25 * air_contents.total_moles()
var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles)
return 1
if (!internal_removed)
return 1
var/combined_heat_capacity = internal_removed.heat_capacity() + RADIATION_CAPACITY
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity() + (RADIATION_CAPACITY * 6.4)
var/final_temperature = combined_energy / combined_heat_capacity
internal_removed.temperature = final_temperature
air_contents.merge(internal_removed)
if (network)
network.update = 1
return 1
@@ -9,88 +9,88 @@
var/datum/pipe_network/network
New()
..()
initialize_directions = dir
air_contents = new
/obj/machinery/atmospherics/unary/New()
..()
initialize_directions = dir
air_contents = new
air_contents.volume = 200
air_contents.volume = 200
/obj/machinery/atmospherics/unary/Destroy()
loc = null
if(node)
node.disconnect(src)
qdel(network)
node = null
return ..()
// Housekeeping and pipe network stuff below
network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node)
network = new_network
/obj/machinery/atmospherics/unary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node)
network = new_network
if(new_network.normal_members.Find(src))
return 0
if(new_network.normal_members.Find(src))
return 0
new_network.normal_members += src
new_network.normal_members += src
return null
return null
Destroy()
loc = null
/obj/machinery/atmospherics/unary/initialize()
if(node) return
if(node)
node.disconnect(src)
qdel(network)
var/node_connect = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node = target
break
update_icon()
update_underlays()
/obj/machinery/atmospherics/unary/build_network()
if(!network && node)
network = new /datum/pipe_network()
network.normal_members += src
network.build_network(node, src)
/obj/machinery/atmospherics/unary/return_network(obj/machinery/atmospherics/reference)
build_network()
if(reference == node || reference == src)
return network
return null
/obj/machinery/atmospherics/unary/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
if(network == old_network)
network = new_network
return 1
/obj/machinery/atmospherics/unary/return_network_air(datum/pipe_network/reference)
var/list/results = list()
if(network == reference)
results += air_contents
return results
/obj/machinery/atmospherics/unary/disconnect(obj/machinery/atmospherics/reference)
if(reference==node)
qdel(network)
node = null
return ..()
update_icon()
update_underlays()
initialize()
if(node) return
var/node_connect = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node = target
break
update_icon()
update_underlays()
build_network()
if(!network && node)
network = new /datum/pipe_network()
network.normal_members += src
network.build_network(node, src)
return_network(obj/machinery/atmospherics/reference)
build_network()
if(reference == node || reference == src)
return network
return null
reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
if(network == old_network)
network = new_network
return 1
return_network_air(datum/pipe_network/reference)
var/list/results = list()
if(network == reference)
results += air_contents
return results
disconnect(obj/machinery/atmospherics/reference)
if(reference==node)
del(network)
node = null
update_icon()
update_underlays()
return null
return null
@@ -324,7 +324,7 @@
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if (WT.remove_fuel(0,user))
user << "\blue Now welding the vent."
user << "<span class='notice'>Now welding the vent.</span>"
if(do_after(user, 20))
if(!src || !WT.isOn()) return
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
@@ -338,9 +338,9 @@
update_icon()
else
user << "\blue The welding tool needs to be on to start this task."
user << "<span class='notice'>The welding tool needs to be on to start this task.</span>"
else
user << "\blue You need more welding fuel to complete this task."
user << "<span class='notice'>You need more welding fuel to complete this task.</span>"
return 1
else if(istype(W, /obj/item/device/multitool))
update_multitool_menu(user)
@@ -399,25 +399,25 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && on)
user << "\red You cannot unwrench this [src], turn it off first."
user << "<span class='alert'>You cannot unwrench this [src], turn it off first.</span>"
return 1
var/turf/T = src.loc
if (node && node.level==1 && isturf(T) && T.intact)
user << "\red You must remove the plating first."
user << "<span class='alert'>You must remove the plating first.</span>"
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
qdel(src)
@@ -348,25 +348,25 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && on)
user << "\red You cannot unwrench this [src], turn it off first."
user << "<span class='alert'>You cannot unwrench this [src], turn it off first.</span>"
return 1
var/turf/T = src.loc
if (node && node.level==1 && isturf(T) && T.intact)
user << "\red You must remove the plating first."
user << "<span class='alert'>You must remove the plating first.</span>"
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
qdel(src)
+5 -5
View File
@@ -250,7 +250,7 @@
if(!powered())
return
if(!src.allowed(user))
user << "\red Access denied."
user << "<span class='alert'>Access denied.</span>"
return
..()
@@ -319,16 +319,16 @@
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
+112 -112
View File
@@ -1,6 +1,6 @@
var/global/list/datum/pipe_network/pipe_networks = list()
datum/pipe_network
/datum/pipe_network
var/list/datum/gas_mixture/gases = list() //All of the gas_mixtures continuously connected in this network
var/list/obj/machinery/atmospherics/normal_members = list()
@@ -10,134 +10,134 @@ datum/pipe_network
var/update = 1
var/datum/gas_mixture/air_transient = null
New()
air_transient = new()
/datum/pipe_network/New()
air_transient = new()
..()
..()
proc/process()
//Equalize gases amongst pipe if called for
if(update)
update = 0
reconcile_air() //equalize_gases(gases)
/datum/pipe_network/proc/process()
//Equalize gases amongst pipe if called for
if(update)
update = 0
reconcile_air() //equalize_gases(gases)
//Give pipelines their process call for pressure checking and what not. Have to remove pressure checks for the time being as pipes dont radiate heat - Mport
//for(var/datum/pipeline/line_member in line_members)
// line_member.process()
//Give pipelines their process call for pressure checking and what not. Have to remove pressure checks for the time being as pipes dont radiate heat - Mport
//for(var/datum/pipeline/line_member in line_members)
// line_member.process()
proc/build_network(obj/machinery/atmospherics/start_normal, obj/machinery/atmospherics/reference)
//Purpose: Generate membership roster
//Notes: Assuming that members will add themselves to appropriate roster in network_expand()
/datum/pipe_network/proc/build_network(obj/machinery/atmospherics/start_normal, obj/machinery/atmospherics/reference)
//Purpose: Generate membership roster
//Notes: Assuming that members will add themselves to appropriate roster in network_expand()
if(!start_normal)
qdel(src)
if(!start_normal)
qdel(src)
start_normal.network_expand(src, reference)
start_normal.network_expand(src, reference)
update_network_gases()
update_network_gases()
if((normal_members.len>0)||(line_members.len>0))
pipe_networks += src
else
qdel(src)
/datum/pipe_network/proc/merge(datum/pipe_network/giver)
if(giver==src) return 0
normal_members |= giver.normal_members
line_members |= giver.line_members
for(var/obj/machinery/atmospherics/normal_member in giver.normal_members)
normal_member.reassign_network(giver, src)
for(var/datum/pipeline/line_member in giver.line_members)
line_member.network = src
update_network_gases()
return 1
/datum/pipe_network/proc/update_network_gases()
//Go through membership roster and make sure gases is up to date
gases = list()
for(var/obj/machinery/atmospherics/normal_member in normal_members)
var/result = normal_member.return_network_air(src)
if(result) gases += result
for(var/datum/pipeline/line_member in line_members)
gases += line_member.air
/datum/pipe_network/proc/reconcile_air()
//Perfectly equalize all gases members instantly
//Calculate totals from individual components
var/total_thermal_energy = 0
var/total_heat_capacity = 0
air_transient.volume = 0
air_transient.oxygen = 0
air_transient.nitrogen = 0
air_transient.toxins = 0
air_transient.carbon_dioxide = 0
air_transient.trace_gases = list()
for(var/datum/gas_mixture/gas in gases)
air_transient.volume += gas.volume
var/temp_heatcap = gas.heat_capacity()
total_thermal_energy += gas.temperature*temp_heatcap
total_heat_capacity += temp_heatcap
air_transient.oxygen += gas.oxygen
air_transient.nitrogen += gas.nitrogen
air_transient.toxins += gas.toxins
air_transient.carbon_dioxide += gas.carbon_dioxide
if(gas.trace_gases.len)
for(var/datum/gas/trace_gas in gas.trace_gases)
var/datum/gas/corresponding = locate(trace_gas.type) in air_transient.trace_gases
if(!corresponding)
corresponding = new trace_gas.type()
air_transient.trace_gases += corresponding
corresponding.moles += trace_gas.moles
if(air_transient.volume > 0)
if(total_heat_capacity > 0)
air_transient.temperature = total_thermal_energy/total_heat_capacity
//Allow air mixture to react
if(air_transient.react())
update = 1
if((normal_members.len>0)||(line_members.len>0))
pipe_networks += src
else
qdel(src)
proc/merge(datum/pipe_network/giver)
if(giver==src) return 0
normal_members |= giver.normal_members
line_members |= giver.line_members
for(var/obj/machinery/atmospherics/normal_member in giver.normal_members)
normal_member.reassign_network(giver, src)
for(var/datum/pipeline/line_member in giver.line_members)
line_member.network = src
update_network_gases()
return 1
proc/update_network_gases()
//Go through membership roster and make sure gases is up to date
gases = list()
for(var/obj/machinery/atmospherics/normal_member in normal_members)
var/result = normal_member.return_network_air(src)
if(result) gases += result
for(var/datum/pipeline/line_member in line_members)
gases += line_member.air
proc/reconcile_air()
//Perfectly equalize all gases members instantly
//Calculate totals from individual components
var/total_thermal_energy = 0
var/total_heat_capacity = 0
air_transient.volume = 0
air_transient.oxygen = 0
air_transient.nitrogen = 0
air_transient.toxins = 0
air_transient.carbon_dioxide = 0
air_transient.trace_gases = list()
air_transient.temperature = 0
//Update individual gas_mixtures by volume ratio
for(var/datum/gas_mixture/gas in gases)
air_transient.volume += gas.volume
var/temp_heatcap = gas.heat_capacity()
total_thermal_energy += gas.temperature*temp_heatcap
total_heat_capacity += temp_heatcap
gas.oxygen = air_transient.oxygen*gas.volume/air_transient.volume
gas.nitrogen = air_transient.nitrogen*gas.volume/air_transient.volume
gas.toxins = air_transient.toxins*gas.volume/air_transient.volume
gas.carbon_dioxide = air_transient.carbon_dioxide*gas.volume/air_transient.volume
air_transient.oxygen += gas.oxygen
air_transient.nitrogen += gas.nitrogen
air_transient.toxins += gas.toxins
air_transient.carbon_dioxide += gas.carbon_dioxide
gas.temperature = air_transient.temperature
if(gas.trace_gases.len)
for(var/datum/gas/trace_gas in gas.trace_gases)
var/datum/gas/corresponding = locate(trace_gas.type) in air_transient.trace_gases
if(air_transient.trace_gases.len)
for(var/datum/gas/trace_gas in air_transient.trace_gases)
var/datum/gas/corresponding = locate(trace_gas.type) in gas.trace_gases
if(!corresponding)
corresponding = new trace_gas.type()
air_transient.trace_gases += corresponding
gas.trace_gases += corresponding
corresponding.moles += trace_gas.moles
corresponding.moles = trace_gas.moles*gas.volume/air_transient.volume
return 1
if(air_transient.volume > 0)
if(total_heat_capacity > 0)
air_transient.temperature = total_thermal_energy/total_heat_capacity
//Allow air mixture to react
if(air_transient.react())
update = 1
else
air_transient.temperature = 0
//Update individual gas_mixtures by volume ratio
for(var/datum/gas_mixture/gas in gases)
gas.oxygen = air_transient.oxygen*gas.volume/air_transient.volume
gas.nitrogen = air_transient.nitrogen*gas.volume/air_transient.volume
gas.toxins = air_transient.toxins*gas.volume/air_transient.volume
gas.carbon_dioxide = air_transient.carbon_dioxide*gas.volume/air_transient.volume
gas.temperature = air_transient.temperature
if(air_transient.trace_gases.len)
for(var/datum/gas/trace_gas in air_transient.trace_gases)
var/datum/gas/corresponding = locate(trace_gas.type) in gas.trace_gases
if(!corresponding)
corresponding = new trace_gas.type()
gas.trace_gases += corresponding
corresponding.moles = trace_gas.moles*gas.volume/air_transient.volume
return 1
proc/equalize_gases(datum/gas_mixture/list/gases)
/proc/equalize_gases(datum/gas_mixture/list/gases)
//Perfectly equalize all gases members instantly
//Calculate totals from individual components
+144 -144
View File
@@ -1,6 +1,6 @@
#define STEFAN_BOLTZMANN_CONSTANT 0.0000000567
datum/pipeline
/datum/pipeline
var/datum/gas_mixture/air
var/list/obj/machinery/atmospherics/pipe/members
@@ -10,187 +10,187 @@ datum/pipeline
var/alert_pressure = 0
Destroy()
if(network)
qdel(network)
/datum/pipeline/Destroy()
if(network)
qdel(network)
if(air && air.volume)
temporarily_store_air()
qdel(air)
if(air && air.volume)
temporarily_store_air()
qdel(air)
return ..()
return ..()
proc/process()//This use to be called called from the pipe networks
//Check to see if pressure is within acceptable limits
var/pressure = air.return_pressure()
if(pressure > alert_pressure)
for(var/obj/machinery/atmospherics/pipe/member in members)
if(!member.check_pressure(pressure))
break //Only delete 1 pipe per process
//Allow for reactions
//air.react() //Should be handled by pipe_network now
proc/temporarily_store_air()
//Update individual gas_mixtures by volume ratio
/datum/pipeline/proc/process()//This use to be called called from the pipe networks
//Check to see if pressure is within acceptable limits
var/pressure = air.return_pressure()
if(pressure > alert_pressure)
for(var/obj/machinery/atmospherics/pipe/member in members)
member.air_temporary = new
member.air_temporary.volume = member.volume
if(!member.check_pressure(pressure))
break //Only delete 1 pipe per process
member.air_temporary.oxygen = air.oxygen*member.volume/air.volume
member.air_temporary.nitrogen = air.nitrogen*member.volume/air.volume
member.air_temporary.toxins = air.toxins*member.volume/air.volume
member.air_temporary.carbon_dioxide = air.carbon_dioxide*member.volume/air.volume
//Allow for reactions
//air.react() //Should be handled by pipe_network now
member.air_temporary.temperature = air.temperature
/datum/pipeline/proc/temporarily_store_air()
//Update individual gas_mixtures by volume ratio
if(air.trace_gases.len)
for(var/datum/gas/trace_gas in air.trace_gases)
var/datum/gas/corresponding = new trace_gas.type()
member.air_temporary.trace_gases += corresponding
for(var/obj/machinery/atmospherics/pipe/member in members)
member.air_temporary = new
member.air_temporary.volume = member.volume
corresponding.moles = trace_gas.moles*member.volume/air.volume
member.air_temporary.oxygen = air.oxygen*member.volume/air.volume
member.air_temporary.nitrogen = air.nitrogen*member.volume/air.volume
member.air_temporary.toxins = air.toxins*member.volume/air.volume
member.air_temporary.carbon_dioxide = air.carbon_dioxide*member.volume/air.volume
proc/build_pipeline(obj/machinery/atmospherics/pipe/base)
member.air_temporary.temperature = air.temperature
if(air.trace_gases.len)
for(var/datum/gas/trace_gas in air.trace_gases)
var/datum/gas/corresponding = new trace_gas.type()
member.air_temporary.trace_gases += corresponding
corresponding.moles = trace_gas.moles*member.volume/air.volume
/datum/pipeline/proc/build_pipeline(obj/machinery/atmospherics/pipe/base)
air = new
var/list/possible_expansions = list(base)
members = list(base)
edges = list()
var/volume = base.volume
base.parent = src
alert_pressure = base.alert_pressure
if(base.air_temporary)
air = base.air_temporary
base.air_temporary = null
else
air = new
var/list/possible_expansions = list(base)
members = list(base)
edges = list()
while(possible_expansions.len>0)
for(var/obj/machinery/atmospherics/pipe/borderline in possible_expansions)
var/volume = base.volume
base.parent = src
alert_pressure = base.alert_pressure
var/list/result = borderline.pipeline_expansion()
var/edge_check = result.len
if(base.air_temporary)
air = base.air_temporary
base.air_temporary = null
else
air = new
if(result.len>0)
for(var/obj/machinery/atmospherics/pipe/item in result)
if(!members.Find(item))
members += item
possible_expansions += item
while(possible_expansions.len>0)
for(var/obj/machinery/atmospherics/pipe/borderline in possible_expansions)
volume += item.volume
item.parent = src
var/list/result = borderline.pipeline_expansion()
var/edge_check = result.len
alert_pressure = min(alert_pressure, item.alert_pressure)
if(result.len>0)
for(var/obj/machinery/atmospherics/pipe/item in result)
if(!members.Find(item))
members += item
possible_expansions += item
if(item.air_temporary)
air.merge(item.air_temporary)
volume += item.volume
item.parent = src
edge_check--
alert_pressure = min(alert_pressure, item.alert_pressure)
if(edge_check>0)
edges += borderline
if(item.air_temporary)
air.merge(item.air_temporary)
possible_expansions -= borderline
edge_check--
air.volume = volume
if(edge_check>0)
edges += borderline
/datum/pipeline/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
possible_expansions -= borderline
if(new_network.line_members.Find(src))
return 0
air.volume = volume
new_network.line_members += src
proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
network = new_network
if(new_network.line_members.Find(src))
return 0
for(var/obj/machinery/atmospherics/pipe/edge in edges)
for(var/obj/machinery/atmospherics/result in edge.pipeline_expansion())
if(!istype(result,/obj/machinery/atmospherics/pipe) && (result!=reference))
result.network_expand(new_network, edge)
new_network.line_members += src
return 1
network = new_network
/datum/pipeline/proc/return_network(obj/machinery/atmospherics/reference)
if(!network)
network = new /datum/pipe_network()
network.build_network(src, null)
//technically passing these parameters should not be allowed
//however pipe_network.build_network(..) and pipeline.network_extend(...)
// were setup to properly handle this case
for(var/obj/machinery/atmospherics/pipe/edge in edges)
for(var/obj/machinery/atmospherics/result in edge.pipeline_expansion())
if(!istype(result,/obj/machinery/atmospherics/pipe) && (result!=reference))
result.network_expand(new_network, edge)
return network
return 1
/datum/pipeline/proc/mingle_with_turf(turf/simulated/target, mingle_volume)
var/datum/gas_mixture/air_sample = air.remove_ratio(mingle_volume/air.volume)
air_sample.volume = mingle_volume
proc/return_network(obj/machinery/atmospherics/reference)
if(!network)
network = new /datum/pipe_network()
network.build_network(src, null)
//technically passing these parameters should not be allowed
//however pipe_network.build_network(..) and pipeline.network_extend(...)
// were setup to properly handle this case
var/datum/gas_mixture/turf_air = target.return_air()
return network
equalize_gases(list(air_sample, turf_air))
air.merge(air_sample)
//turf_air already modified by equalize_gases()
proc/mingle_with_turf(turf/simulated/target, mingle_volume)
var/datum/gas_mixture/air_sample = air.remove_ratio(mingle_volume/air.volume)
air_sample.volume = mingle_volume
if(istype(target))
if(target.air)
if(target.air.check_tile_graphic())
target.update_visuals(target.air)
if(network)
network.update = 1
var/datum/gas_mixture/turf_air = target.return_air()
/datum/pipeline/proc/temperature_interact(turf/target, share_volume, thermal_conductivity)
var/total_heat_capacity = air.heat_capacity()
var/partial_heat_capacity = total_heat_capacity*(share_volume/air.volume)
equalize_gases(list(air_sample, turf_air))
air.merge(air_sample)
//turf_air already modified by equalize_gases()
if(istype(target, /turf/simulated))
var/turf/simulated/modeled_location = target
if(istype(target))
if(target.air)
if(target.air.check_tile_graphic())
target.update_visuals(target.air)
if(network)
network.update = 1
if(modeled_location.blocks_air)
proc/temperature_interact(turf/target, share_volume, thermal_conductivity)
var/total_heat_capacity = air.heat_capacity()
var/partial_heat_capacity = total_heat_capacity*(share_volume/air.volume)
if(istype(target, /turf/simulated))
var/turf/simulated/modeled_location = target
if(modeled_location.blocks_air)
if((modeled_location.heat_capacity>0) && (partial_heat_capacity>0))
var/delta_temperature = air.temperature - modeled_location.temperature
var/heat = thermal_conductivity*delta_temperature* \
(partial_heat_capacity*modeled_location.heat_capacity/(partial_heat_capacity+modeled_location.heat_capacity))
air.temperature -= heat/total_heat_capacity
modeled_location.temperature += heat/modeled_location.heat_capacity
else
var/delta_temperature = 0
var/sharer_heat_capacity = 0
delta_temperature = (air.temperature - modeled_location.air.temperature)
sharer_heat_capacity = modeled_location.air.heat_capacity()
var/self_temperature_delta = 0
var/sharer_temperature_delta = 0
if((sharer_heat_capacity>0) && (partial_heat_capacity>0))
var/heat = thermal_conductivity*delta_temperature* \
(partial_heat_capacity*sharer_heat_capacity/(partial_heat_capacity+sharer_heat_capacity))
self_temperature_delta = -heat/total_heat_capacity
sharer_temperature_delta = heat/sharer_heat_capacity
else
return 1
air.temperature += self_temperature_delta
modeled_location.air.temperature += sharer_temperature_delta
else
if((target.heat_capacity>0) && (partial_heat_capacity>0))
var/delta_temperature = air.temperature - target.temperature
if((modeled_location.heat_capacity>0) && (partial_heat_capacity>0))
var/delta_temperature = air.temperature - modeled_location.temperature
var/heat = thermal_conductivity*delta_temperature* \
(partial_heat_capacity*target.heat_capacity/(partial_heat_capacity+target.heat_capacity))
(partial_heat_capacity*modeled_location.heat_capacity/(partial_heat_capacity+modeled_location.heat_capacity))
air.temperature -= heat/total_heat_capacity
if(network)
network.update = 1
modeled_location.temperature += heat/modeled_location.heat_capacity
else
var/delta_temperature = 0
var/sharer_heat_capacity = 0
delta_temperature = (air.temperature - modeled_location.air.temperature)
sharer_heat_capacity = modeled_location.air.heat_capacity()
var/self_temperature_delta = 0
var/sharer_temperature_delta = 0
if((sharer_heat_capacity>0) && (partial_heat_capacity>0))
var/heat = thermal_conductivity*delta_temperature* \
(partial_heat_capacity*sharer_heat_capacity/(partial_heat_capacity+sharer_heat_capacity))
self_temperature_delta = -heat/total_heat_capacity
sharer_temperature_delta = heat/sharer_heat_capacity
else
return 1
air.temperature += self_temperature_delta
modeled_location.air.temperature += sharer_temperature_delta
else
if((target.heat_capacity>0) && (partial_heat_capacity>0))
var/delta_temperature = air.temperature - target.temperature
var/heat = thermal_conductivity*delta_temperature* \
(partial_heat_capacity*target.heat_capacity/(partial_heat_capacity+target.heat_capacity))
air.temperature -= heat/total_heat_capacity
if(network)
network.update = 1
-119
View File
@@ -1,119 +0,0 @@
/obj/machinery/atmospherics/pipe/simple/heat_exchanging
icon = 'icons/atmos/heat.dmi'
icon_state = "intact"
pipe_icon = "hepipe"
level = 2
var/initialize_directions_he
var/surface = 2
minimum_temperature_difference = 20
thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/process()
if(!parent)
..()
else
var/environment_temperature = 0
if(istype(loc, /turf/simulated/))
if(loc:blocks_air)
environment_temperature = loc:temperature
else
var/datum/gas_mixture/environment = loc.return_air()
environment_temperature = environment.temperature
else
environment_temperature = loc:temperature
var/datum/gas_mixture/pipe_air = return_air()
if(abs(environment_temperature-pipe_air.temperature) > minimum_temperature_difference)
parent.temperature_interact(loc, volume, thermal_conductivity)
// BubbleWrap
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/New()
..()
initialize_directions_he = initialize_directions // The auto-detection from /pipe is good enough for a simple HE pipe
// BubbleWrap END
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/initialize()
normalize_dir()
var/node1_dir
var/node2_dir
for(var/direction in cardinal)
if(direction&initialize_directions_he)
if (!node1_dir)
node1_dir = direction
else if (!node2_dir)
node2_dir = direction
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node1_dir))
if(target.initialize_directions_he & get_dir(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node2_dir))
if(target.initialize_directions_he & get_dir(target,src))
node2 = target
break
if(!node1 && !node2)
del(src)
return
update_icon()
return
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/hidden
level=1
icon_state="intact-f"
/////////////////////////////////
// JUNCTION
/////////////////////////////////
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction
icon = 'icons/atmos/junction.dmi'
icon_state = "intact"
pipe_icon = "hejunction"
level = 2
minimum_temperature_difference = 300
thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT
// BubbleWrap
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/New()
.. ()
switch ( dir )
if ( SOUTH )
initialize_directions = NORTH
initialize_directions_he = SOUTH
if ( NORTH )
initialize_directions = SOUTH
initialize_directions_he = NORTH
if ( EAST )
initialize_directions = WEST
initialize_directions_he = EAST
if ( WEST )
initialize_directions = EAST
initialize_directions_he = WEST
// BubbleWrap END
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/initialize()
for(var/obj/machinery/atmospherics/target in get_step(src,initialize_directions))
if(target.initialize_directions & get_dir(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,initialize_directions_he))
if(target.initialize_directions_he & get_dir(target,src))
node2 = target
break
if(!node1 && !node2)
qdel(src)
return
update_icon()
return
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/hidden
level=1
icon_state="intact-f"
+1 -1
View File
@@ -649,7 +649,7 @@ obj/machinery/atmospherics/mains_pipe/valve
attack_hand(mob/user as mob)
if(!src.allowed(user))
user << "\red Access denied."
user << "<span class='alert>Access denied.</span>"
return
..()
File diff suppressed because it is too large Load Diff
+122
View File
@@ -0,0 +1,122 @@
/obj/machinery/atmospherics/pipe/cap
name = "pipe endcap"
desc = "An endcap for pipes"
icon = 'icons/atmos/pipes.dmi'
icon_state = "cap"
level = 2
layer = 2.4 //under wires with their 2.44
volume = 35
dir = SOUTH
initialize_directions = SOUTH
var/obj/machinery/atmospherics/node
/obj/machinery/atmospherics/pipe/cap/New()
..()
initialize_directions = dir
/obj/machinery/atmospherics/pipe/cap/hide(var/i)
if(level == 1 && istype(loc, /turf/simulated))
invisibility = i ? 101 : 0
update_icon()
/obj/machinery/atmospherics/pipe/cap/pipeline_expansion()
return list(node)
/obj/machinery/atmospherics/pipe/cap/process()
if(!parent)
..()
else
. = PROCESS_KILL
/obj/machinery/atmospherics/pipe/cap/Destroy()
if(node)
node.disconnect(src)
return ..()
/obj/machinery/atmospherics/pipe/cap/disconnect(obj/machinery/atmospherics/reference)
if(reference == node)
if(istype(node, /obj/machinery/atmospherics/pipe))
qdel(parent)
node = null
update_icon()
..()
/obj/machinery/atmospherics/pipe/cap/change_color(var/new_color)
..()
//for updating connected atmos device pipes (i.e. vents, manifolds, etc)
if(node)
node.update_underlays()
/obj/machinery/atmospherics/pipe/cap/update_icon(var/safety = 0)
if(!check_icon_cache())
return
alpha = 255
overlays.Cut()
overlays += icon_manager.get_atmos_icon("pipe", , pipe_color, "cap" + icon_connect_type)
/obj/machinery/atmospherics/pipe/cap/initialize()
for(var/obj/machinery/atmospherics/target in get_step(src, dir))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node = target
break
var/turf/T = get_turf(src) // hide if turf is not intact
if(!istype(T)) return
hide(T.intact)
update_icon()
/obj/machinery/atmospherics/pipe/cap/visible
level = 2
icon_state = "cap"
/obj/machinery/atmospherics/pipe/cap/visible/scrubbers
name = "scrubbers pipe endcap"
desc = "An endcap for scrubbers pipes"
icon_state = "cap-scrubbers"
connect_types = list(3)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/cap/visible/supply
name = "supply pipe endcap"
desc = "An endcap for supply pipes"
icon_state = "cap-supply"
connect_types = list(2)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/cap/hidden
level = 1
icon_state = "cap"
alpha = 128
/obj/machinery/atmospherics/pipe/cap/hidden/scrubbers
name = "scrubbers pipe endcap"
desc = "An endcap for scrubbers pipes"
icon_state = "cap-scrubbers"
connect_types = list(3)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/cap/hidden/supply
name = "supply pipe endcap"
desc = "An endcap for supply pipes"
icon_state = "cap-supply"
connect_types = list(2)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
+251
View File
@@ -0,0 +1,251 @@
/obj/machinery/atmospherics/pipe/manifold
icon = 'icons/atmos/manifold.dmi'
icon_state = ""
name = "pipe manifold"
desc = "A manifold composed of regular pipes"
volume = 105
dir = SOUTH
initialize_directions = EAST|NORTH|WEST
var/obj/machinery/atmospherics/node1
var/obj/machinery/atmospherics/node2
var/obj/machinery/atmospherics/node3
level = 1
layer = 2.4 //under wires with their 2.44
/obj/machinery/atmospherics/pipe/manifold/New()
..()
alpha = 255
icon = null
switch(dir)
if(NORTH)
initialize_directions = EAST|SOUTH|WEST
if(SOUTH)
initialize_directions = WEST|NORTH|EAST
if(EAST)
initialize_directions = SOUTH|WEST|NORTH
if(WEST)
initialize_directions = NORTH|EAST|SOUTH
/obj/machinery/atmospherics/pipe/manifold/hide(var/i)
if(level == 1 && istype(loc, /turf/simulated))
invisibility = i ? 101 : 0
update_icon()
/obj/machinery/atmospherics/pipe/manifold/pipeline_expansion()
return list(node1, node2, node3)
/obj/machinery/atmospherics/pipe/manifold/process()
if(!parent)
..()
else
. = PROCESS_KILL
/obj/machinery/atmospherics/pipe/manifold/Destroy()
if(node1)
node1.disconnect(src)
if(node2)
node2.disconnect(src)
if(node3)
node3.disconnect(src)
return ..()
/obj/machinery/atmospherics/pipe/manifold/disconnect(obj/machinery/atmospherics/reference)
if(reference == node1)
if(istype(node1, /obj/machinery/atmospherics/pipe))
qdel(parent)
node1 = null
if(reference == node2)
if(istype(node2, /obj/machinery/atmospherics/pipe))
qdel(parent)
node2 = null
if(reference == node3)
if(istype(node3, /obj/machinery/atmospherics/pipe))
qdel(parent)
node3 = null
update_icon()
..()
/obj/machinery/atmospherics/pipe/manifold/change_color(var/new_color)
..()
//for updating connected atmos device pipes (i.e. vents, manifolds, etc)
if(node1)
node1.update_underlays()
if(node2)
node2.update_underlays()
if(node3)
node3.update_underlays()
/obj/machinery/atmospherics/pipe/manifold/update_icon(var/safety = 0)
if(!check_icon_cache())
return
alpha = 255
if(!node1 && !node2 && !node3)
var/turf/T = get_turf(src)
new /obj/item/pipe(loc, make_from=src)
for (var/obj/machinery/meter/meter in T)
if (meter.target == src)
new /obj/item/pipe_meter(T)
qdel(meter)
qdel(src)
else
overlays.Cut()
overlays += icon_manager.get_atmos_icon("manifold", , pipe_color, "core" + icon_connect_type)
overlays += icon_manager.get_atmos_icon("manifold", , , "clamps" + icon_connect_type)
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T)) return
var/list/directions = list(NORTH, SOUTH, EAST, WEST)
var/node1_direction = get_dir(src, node1)
var/node2_direction = get_dir(src, node2)
var/node3_direction = get_dir(src, node3)
directions -= dir
directions -= add_underlay(T,node1,node1_direction,icon_connect_type)
directions -= add_underlay(T,node2,node2_direction,icon_connect_type)
directions -= add_underlay(T,node3,node3_direction,icon_connect_type)
for(var/D in directions)
add_underlay(T,,D,icon_connect_type)
/obj/machinery/atmospherics/pipe/manifold/update_underlays()
..()
update_icon()
/obj/machinery/atmospherics/pipe/manifold/initialize()
var/connect_directions = (NORTH|SOUTH|EAST|WEST)&(~dir)
for(var/direction in cardinal)
if(direction&connect_directions)
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node1 = target
connect_directions &= ~direction
break
if (node1)
break
for(var/direction in cardinal)
if(direction&connect_directions)
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node2 = target
connect_directions &= ~direction
break
if (node2)
break
for(var/direction in cardinal)
if(direction&connect_directions)
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node3 = target
connect_directions &= ~direction
break
if (node3)
break
if(!node1 && !node2 && !node3)
qdel(src)
return
var/turf/T = get_turf(src)
if(istype(T))
hide(T.intact)
update_icon()
/obj/machinery/atmospherics/pipe/manifold/visible
icon_state = "map"
level = 2
/obj/machinery/atmospherics/pipe/manifold/visible/scrubbers
name="Scrubbers pipe manifold"
desc = "A manifold composed of scrubbers pipes"
icon_state = "map-scrubbers"
connect_types = list(3)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/manifold/visible/supply
name="Air supply pipe manifold"
desc = "A manifold composed of supply pipes"
icon_state = "map-supply"
connect_types = list(2)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/manifold/visible/yellow
color = PIPE_COLOR_YELLOW
/obj/machinery/atmospherics/pipe/manifold/visible/cyan
color = PIPE_COLOR_CYAN
/obj/machinery/atmospherics/pipe/manifold/visible/green
color = PIPE_COLOR_GREEN
/obj/machinery/atmospherics/pipe/manifold/visible/purple
color = PIPE_COLOR_PURPLE
/obj/machinery/atmospherics/pipe/manifold/hidden
icon_state = "map"
level = 1
alpha = 128 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game
/obj/machinery/atmospherics/pipe/manifold/hidden/scrubbers
name="Scrubbers pipe manifold"
desc = "A manifold composed of scrubbers pipes"
icon_state = "map-scrubbers"
connect_types = list(3)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/manifold/hidden/supply
name="Air supply pipe manifold"
desc = "A manifold composed of supply pipes"
icon_state = "map-supply"
connect_types = list(2)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/manifold/hidden/yellow
color = PIPE_COLOR_YELLOW
/obj/machinery/atmospherics/pipe/manifold/hidden/cyan
color = PIPE_COLOR_CYAN
/obj/machinery/atmospherics/pipe/manifold/hidden/green
color = PIPE_COLOR_GREEN
/obj/machinery/atmospherics/pipe/manifold/hidden/purple
color = PIPE_COLOR_PURPLE
+256
View File
@@ -0,0 +1,256 @@
/obj/machinery/atmospherics/pipe/manifold4w
icon = 'icons/atmos/manifold.dmi'
icon_state = ""
name = "4-way pipe manifold"
desc = "A manifold composed of regular pipes"
volume = 140
dir = SOUTH
initialize_directions = NORTH|SOUTH|EAST|WEST
var/obj/machinery/atmospherics/node1
var/obj/machinery/atmospherics/node2
var/obj/machinery/atmospherics/node3
var/obj/machinery/atmospherics/node4
level = 1
layer = 2.4 //under wires with their 2.44
/obj/machinery/atmospherics/pipe/manifold4w/New()
..()
alpha = 255
icon = null
/obj/machinery/atmospherics/pipe/manifold4w/pipeline_expansion()
return list(node1, node2, node3, node4)
/obj/machinery/atmospherics/pipe/manifold4w/process()
if(!parent)
..()
else
. = PROCESS_KILL
/obj/machinery/atmospherics/pipe/manifold4w/Destroy()
if(node1)
node1.disconnect(src)
if(node2)
node2.disconnect(src)
if(node3)
node3.disconnect(src)
if(node4)
node4.disconnect(src)
return ..()
/obj/machinery/atmospherics/pipe/manifold4w/disconnect(obj/machinery/atmospherics/reference)
if(reference == node1)
if(istype(node1, /obj/machinery/atmospherics/pipe))
qdel(parent)
node1 = null
if(reference == node2)
if(istype(node2, /obj/machinery/atmospherics/pipe))
qdel(parent)
node2 = null
if(reference == node3)
if(istype(node3, /obj/machinery/atmospherics/pipe))
qdel(parent)
node3 = null
if(reference == node4)
if(istype(node4, /obj/machinery/atmospherics/pipe))
qdel(parent)
node4 = null
update_icon()
..()
/obj/machinery/atmospherics/pipe/manifold4w/change_color(var/new_color)
..()
//for updating connected atmos device pipes (i.e. vents, manifolds, etc)
if(node1)
node1.update_underlays()
if(node2)
node2.update_underlays()
if(node3)
node3.update_underlays()
if(node4)
node4.update_underlays()
/obj/machinery/atmospherics/pipe/manifold4w/update_icon(var/safety = 0)
if(!check_icon_cache())
return
alpha = 255
if(!node1 && !node2 && !node3 && !node4)
var/turf/T = get_turf(src)
new /obj/item/pipe(loc, make_from=src)
for (var/obj/machinery/meter/meter in T)
if (meter.target == src)
new /obj/item/pipe_meter(T)
qdel(meter)
qdel(src)
else
overlays.Cut()
overlays += icon_manager.get_atmos_icon("manifold", , pipe_color, "4way" + icon_connect_type)
overlays += icon_manager.get_atmos_icon("manifold", , , "clamps_4way" + icon_connect_type)
underlays.Cut()
/*
var/list/directions = list(NORTH, SOUTH, EAST, WEST)
directions -= add_underlay(node1)
directions -= add_underlay(node2)
directions -= add_underlay(node3)
directions -= add_underlay(node4)
for(var/D in directions)
add_underlay(,D)
*/
var/turf/T = get_turf(src)
if(!istype(T)) return
var/list/directions = list(NORTH, SOUTH, EAST, WEST)
var/node1_direction = get_dir(src, node1)
var/node2_direction = get_dir(src, node2)
var/node3_direction = get_dir(src, node3)
var/node4_direction = get_dir(src, node4)
directions -= dir
directions -= add_underlay(T,node1,node1_direction,icon_connect_type)
directions -= add_underlay(T,node2,node2_direction,icon_connect_type)
directions -= add_underlay(T,node3,node3_direction,icon_connect_type)
directions -= add_underlay(T,node4,node4_direction,icon_connect_type)
for(var/D in directions)
add_underlay(T,,D,icon_connect_type)
/obj/machinery/atmospherics/pipe/manifold4w/update_underlays()
..()
update_icon()
/obj/machinery/atmospherics/pipe/manifold4w/hide(var/i)
if(level == 1 && istype(loc, /turf/simulated))
invisibility = i ? 101 : 0
update_icon()
/obj/machinery/atmospherics/pipe/manifold4w/initialize()
for(var/obj/machinery/atmospherics/target in get_step(src,1))
if(target.initialize_directions & 2)
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,2))
if(target.initialize_directions & 1)
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node2 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,4))
if(target.initialize_directions & 8)
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node3 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,8))
if(target.initialize_directions & 4)
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node4 = target
break
if(!node1 && !node2 && !node3&& !node4)
qdel(src)
return
var/turf/T = get_turf(src)
if(istype(T))
hide(T.intact)
update_icon()
/obj/machinery/atmospherics/pipe/manifold4w/visible
icon_state = "map_4way"
level = 2
/obj/machinery/atmospherics/pipe/manifold4w/visible/scrubbers
name="4-way scrubbers pipe manifold"
desc = "A manifold composed of scrubbers pipes"
icon_state = "map_4way-scrubbers"
connect_types = list(3)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/manifold4w/visible/supply
name="4-way air supply pipe manifold"
desc = "A manifold composed of supply pipes"
icon_state = "map_4way-supply"
connect_types = list(2)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/manifold4w/visible/yellow
color = PIPE_COLOR_YELLOW
/obj/machinery/atmospherics/pipe/manifold4w/visible/cyan
color = PIPE_COLOR_CYAN
/obj/machinery/atmospherics/pipe/manifold4w/visible/green
color = PIPE_COLOR_GREEN
/obj/machinery/atmospherics/pipe/manifold4w/visible/purple
color = PIPE_COLOR_PURPLE
/obj/machinery/atmospherics/pipe/manifold4w/hidden
icon_state = "map_4way"
level = 1
alpha = 128 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game
/obj/machinery/atmospherics/pipe/manifold4w/hidden/scrubbers
name="4-way scrubbers pipe manifold"
desc = "A manifold composed of scrubbers pipes"
icon_state = "map_4way-scrubbers"
connect_types = list(3)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/manifold4w/hidden/supply
name="4-way air supply pipe manifold"
desc = "A manifold composed of supply pipes"
icon_state = "map_4way-supply"
connect_types = list(2)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/manifold4w/hidden/yellow
color = PIPE_COLOR_YELLOW
/obj/machinery/atmospherics/pipe/manifold4w/hidden/cyan
color = PIPE_COLOR_CYAN
/obj/machinery/atmospherics/pipe/manifold4w/hidden/green
color = PIPE_COLOR_GREEN
/obj/machinery/atmospherics/pipe/manifold4w/hidden/purple
color = PIPE_COLOR_PURPLE
+138
View File
@@ -0,0 +1,138 @@
/obj/machinery/atmospherics/pipe
var/datum/gas_mixture/air_temporary //used when reconstructing a pipeline that broke
var/datum/pipeline/parent
var/volume = 0
var/frozen = 0 // used by the pipe freezer
force = 20
layer = 2.4 //under wires with their 2.44
use_power = 0
var/alert_pressure = 80*ONE_ATMOSPHERE
//minimum pressure before check_pressure(...) should be called
/obj/machinery/atmospherics/pipe/New()
..()
//so pipes under walls are hidden
if(istype(get_turf(src), /turf/simulated/wall) || istype(get_turf(src), /turf/simulated/shuttle/wall) || istype(get_turf(src), /turf/unsimulated/wall))
level = 1
/obj/machinery/atmospherics/pipe/proc/pipeline_expansion()
return null
/obj/machinery/atmospherics/pipe/proc/check_pressure(pressure)
//Return 1 if parent should continue checking other pipes
//Return null if parent should stop checking other pipes. Recall: del(src) will by default return null
return 1
/obj/machinery/atmospherics/pipe/return_air()
if(!parent)
parent = new /datum/pipeline()
parent.build_pipeline(src)
return parent.air
/obj/machinery/atmospherics/pipe/build_network()
if(!parent)
parent = new /datum/pipeline()
parent.build_pipeline(src)
return parent.return_network()
/obj/machinery/atmospherics/pipe/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(!parent)
parent = new /datum/pipeline()
parent.build_pipeline(src)
return parent.network_expand(new_network, reference)
/obj/machinery/atmospherics/pipe/return_network(obj/machinery/atmospherics/reference)
if(!parent)
parent = new /datum/pipeline()
parent.build_pipeline(src)
return parent.return_network(reference)
/obj/machinery/atmospherics/pipe/Destroy()
qdel(parent)
if(air_temporary && loc)
loc.assume_air(air_temporary)
return ..()
/obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if (istype(src, /obj/machinery/atmospherics/pipe/tank))
return ..()
if (istype(src, /obj/machinery/atmospherics/pipe/vent))
return ..()
if(istype(W,/obj/item/device/pipe_painter))
return 0
if (istype(W, /obj/item/device/pipe_freezer))
if(!src.frozen) // If the pipe is not already frozen
user << "<span class='alert'>You begin to freeze the [src].</span>"
if (do_after(user, 60))
user.visible_message( \
"[user] freezes \the [src].", \
"<span class='notice'>You finished freezing \the [src].</span>", \
"You hear the hiss of gas.")
src.frozen = 1
spawn (200)
src.frozen = 0
src.visible_message( \
"\The ice arounds \the [src] melts.", \
"<span class='notice'>Your frozen [src] has thawed.</span>", \
"You hear dripping water.")
add_fingerprint(user)
return 1
if (!istype(W, /obj/item/weapon/wrench))
return ..()
var/turf/T = src.loc
if (level==1 && isturf(T) && T.intact)
user << "<span class='alert'>You must remove the plating first.</span>"
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
if (!src.frozen) // If the pipe is not frozen
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
var/obj/item/P = new /obj/item/pipe(loc, make_from=src)
for (var/obj/machinery/meter/meter in T)
if (meter.target == src)
new /obj/item/pipe_meter(T)
qdel(meter)
if(P)
transfer_fingerprints_to(P)
P.add_fingerprint(user)
qdel(src)
return 1
/obj/machinery/atmospherics/pipe/color_cache_name(var/obj/machinery/atmospherics/node)
if(istype(src, /obj/machinery/atmospherics/pipe/tank))
return ..()
if(istype(node, /obj/machinery/atmospherics/pipe/manifold) || istype(node, /obj/machinery/atmospherics/pipe/manifold4w))
if(pipe_color == node.pipe_color)
return node.pipe_color
else
return null
else if(istype(node, /obj/machinery/atmospherics/pipe/simple))
return node.pipe_color
else
return pipe_color
@@ -0,0 +1,181 @@
/obj/machinery/atmospherics/pipe/simple
icon = 'icons/atmos/pipes.dmi'
icon_state = ""
var/pipe_icon = "" //what kind of pipe it is and from which dmi is the icon manager getting its icons, "" for simple pipes, "hepipe" for HE pipes, "hejunction" for HE junctions
name = "pipe"
desc = "A one meter section of regular pipe"
volume = 70
dir = SOUTH
initialize_directions = SOUTH|NORTH
var/obj/machinery/atmospherics/node1
var/obj/machinery/atmospherics/node2
var/minimum_temperature_difference = 300
var/thermal_conductivity = 0 //WALL_HEAT_TRANSFER_COEFFICIENT No
var/maximum_pressure = 70*ONE_ATMOSPHERE
var/fatigue_pressure = 55*ONE_ATMOSPHERE
alert_pressure = 55*ONE_ATMOSPHERE
level = 1
/obj/machinery/atmospherics/pipe/simple/New()
..()
// Pipe colors and icon states are handled by an image cache - so color and icon should
// be null. For mapping purposes color is defined in the object definitions.
icon = null
alpha = 255
switch(dir)
if(SOUTH || NORTH)
initialize_directions = SOUTH|NORTH
if(EAST || WEST)
initialize_directions = EAST|WEST
if(NORTHEAST)
initialize_directions = NORTH|EAST
if(NORTHWEST)
initialize_directions = NORTH|WEST
if(SOUTHEAST)
initialize_directions = SOUTH|EAST
if(SOUTHWEST)
initialize_directions = SOUTH|WEST
/obj/machinery/atmospherics/pipe/simple/hide(var/i)
if(level == 1 && istype(loc, /turf/simulated))
invisibility = i ? 101 : 0
update_icon()
/obj/machinery/atmospherics/pipe/simple/process()
if(!parent) //This should cut back on the overhead calling build_network thousands of times per cycle
..()
else
. = PROCESS_KILL
/obj/machinery/atmospherics/pipe/simple/check_pressure(pressure)
var/datum/gas_mixture/environment = loc.return_air()
var/pressure_difference = pressure - environment.return_pressure()
if(pressure_difference > maximum_pressure)
burst()
else if(pressure_difference > fatigue_pressure)
//TODO: leak to turf, doing pfshhhhh
if(prob(5))
burst()
else return 1
/obj/machinery/atmospherics/pipe/simple/proc/burst()
src.visible_message("<span class='danger'>\The [src] bursts!</span>");
playsound(src.loc, 'sound/effects/bang.ogg', 25, 1)
var/datum/effect/effect/system/harmless_smoke_spread/smoke = new
smoke.set_up(1,0, src.loc, 0)
smoke.start()
qdel(src)
/obj/machinery/atmospherics/pipe/simple/proc/normalize_dir()
if(dir==3)
dir = 1
else if(dir==12)
dir = 4
/obj/machinery/atmospherics/pipe/simple/Destroy()
if(node1)
node1.disconnect(src)
if(node2)
node2.disconnect(src)
return ..()
/obj/machinery/atmospherics/pipe/simple/pipeline_expansion()
return list(node1, node2)
/obj/machinery/atmospherics/pipe/simple/change_color(var/new_color)
..()
//for updating connected atmos device pipes (i.e. vents, manifolds, etc)
if(node1)
node1.update_underlays()
if(node2)
node2.update_underlays()
/obj/machinery/atmospherics/pipe/simple/update_icon(var/safety = 0)
if(!check_icon_cache())
return
alpha = 255
overlays.Cut()
if(!node1 && !node2)
var/turf/T = get_turf(src)
new /obj/item/pipe(loc, make_from=src)
for (var/obj/machinery/meter/meter in T)
if (meter.target == src)
new /obj/item/pipe_meter(T)
qdel(meter)
qdel(src)
else if(node1 && node2)
overlays += icon_manager.get_atmos_icon("pipe", , pipe_color, pipe_icon + "intact" + icon_connect_type)
else
overlays += icon_manager.get_atmos_icon("pipe", , pipe_color, pipe_icon + "exposed[node1?1:0][node2?1:0]" + icon_connect_type)
/obj/machinery/atmospherics/pipe/simple/update_underlays()
return
/obj/machinery/atmospherics/pipe/simple/initialize()
normalize_dir()
var/node1_dir
var/node2_dir
for(var/direction in cardinal)
if(direction&initialize_directions)
if (!node1_dir)
node1_dir = direction
else if (!node2_dir)
node2_dir = direction
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node2 = target
break
if(!node1 && !node2)
qdel(src)
return
var/turf/T = get_turf(src)
if(istype(T))
hide(T.intact)
update_icon()
/obj/machinery/atmospherics/pipe/simple/disconnect(obj/machinery/atmospherics/reference)
if(reference == node1)
if(istype(node1, /obj/machinery/atmospherics/pipe))
qdel(parent)
node1 = null
if(reference == node2)
if(istype(node2, /obj/machinery/atmospherics/pipe))
qdel(parent)
node2 = null
update_icon()
return null
@@ -0,0 +1,118 @@
/obj/machinery/atmospherics/pipe/simple/heat_exchanging
icon = 'icons/atmos/heat.dmi'
icon_state = "intact"
pipe_icon = "hepipe"
level = 2
var/initialize_directions_he
var/surface = 2
minimum_temperature_difference = 20
thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/process()
if(!parent)
..()
else
var/environment_temperature = 0
if(istype(loc, /turf/simulated/))
if(loc:blocks_air)
environment_temperature = loc:temperature
else
var/datum/gas_mixture/environment = loc.return_air()
environment_temperature = environment.temperature
else
environment_temperature = loc:temperature
var/datum/gas_mixture/pipe_air = return_air()
if(abs(environment_temperature-pipe_air.temperature) > minimum_temperature_difference)
parent.temperature_interact(loc, volume, thermal_conductivity)
// BubbleWrap
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/New()
..()
initialize_directions_he = initialize_directions // The auto-detection from /pipe is good enough for a simple HE pipe
// BubbleWrap END
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/initialize()
normalize_dir()
var/node1_dir
var/node2_dir
for(var/direction in cardinal)
if(direction&initialize_directions_he)
if (!node1_dir)
node1_dir = direction
else if (!node2_dir)
node2_dir = direction
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node1_dir))
if(target.initialize_directions_he & get_dir(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node2_dir))
if(target.initialize_directions_he & get_dir(target,src))
node2 = target
break
if(!node1 && !node2)
qdel(src)
return
update_icon()
return
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/hidden
level=1
icon_state="intact-f"
/////////////////////////////////
// JUNCTION
/////////////////////////////////
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction
icon = 'icons/atmos/junction.dmi'
icon_state = "intact"
pipe_icon = "hejunction"
level = 2
minimum_temperature_difference = 300
thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT
// BubbleWrap
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/New()
.. ()
switch ( dir )
if ( SOUTH )
initialize_directions = NORTH
initialize_directions_he = SOUTH
if ( NORTH )
initialize_directions = SOUTH
initialize_directions_he = NORTH
if ( EAST )
initialize_directions = WEST
initialize_directions_he = EAST
if ( WEST )
initialize_directions = EAST
initialize_directions_he = WEST
// BubbleWrap END
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/initialize()
for(var/obj/machinery/atmospherics/target in get_step(src,initialize_directions))
if(target.initialize_directions & get_dir(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,initialize_directions_he))
if(target.initialize_directions_he & get_dir(target,src))
node2 = target
break
if(!node1 && !node2)
qdel(src)
return
update_icon()
return
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/hidden
level=1
icon_state="intact-f"
@@ -0,0 +1,69 @@
/obj/machinery/atmospherics/pipe/simple/hidden
icon_state = "intact"
level = 1
alpha = 128 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game
/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers
name = "Scrubbers pipe"
desc = "A one meter section of scrubbers pipe"
icon_state = "intact-scrubbers"
connect_types = list(3)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/simple/hidden/supply
name = "Air supply pipe"
desc = "A one meter section of supply pipe"
icon_state = "intact-supply"
connect_types = list(2)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/simple/hidden/universal
name="Universal pipe adapter"
desc = "An adapter for regular, supply and scrubbers pipes"
connect_types = list(1,2,3)
icon_state = "map_universal"
/obj/machinery/atmospherics/pipe/simple/hidden/universal/update_icon(var/safety = 0)
if(!check_icon_cache())
return
alpha = 255
overlays.Cut()
overlays += icon_manager.get_atmos_icon("pipe", , pipe_color, "universal")
underlays.Cut()
if (node1)
universal_underlays(node1)
if(node2)
universal_underlays(node2)
else
var/node2_dir = turn(get_dir(src,node1),-180)
universal_underlays(,node2_dir)
else if (node2)
universal_underlays(node2)
var/node1_dir = turn(get_dir(src,node2),-180)
universal_underlays(,node1_dir)
else
universal_underlays(,dir)
universal_underlays(,turn(dir, -180))
/obj/machinery/atmospherics/pipe/simple/hidden/universal/update_underlays()
..()
update_icon()
/obj/machinery/atmospherics/pipe/simple/hidden/yellow
color = PIPE_COLOR_YELLOW
/obj/machinery/atmospherics/pipe/simple/hidden/cyan
color = PIPE_COLOR_CYAN
/obj/machinery/atmospherics/pipe/simple/hidden/green
color = PIPE_COLOR_GREEN
/obj/machinery/atmospherics/pipe/simple/hidden/purple
color = PIPE_COLOR_PURPLE
@@ -0,0 +1,11 @@
/obj/machinery/atmospherics/pipe/simple/insulated
icon = 'icons/obj/atmospherics/red_pipe.dmi'
icon_state = "intact"
minimum_temperature_difference = 10000
thermal_conductivity = 0
maximum_pressure = 1000*ONE_ATMOSPHERE
fatigue_pressure = 900*ONE_ATMOSPHERE
alert_pressure = 900*ONE_ATMOSPHERE
level = 2
@@ -0,0 +1,66 @@
/obj/machinery/atmospherics/pipe/simple/visible
icon_state = "intact"
level = 2
/obj/machinery/atmospherics/pipe/simple/visible/scrubbers
name = "Scrubbers pipe"
desc = "A one meter section of scrubbers pipe"
icon_state = "intact-scrubbers"
connect_types = list(3)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/simple/visible/supply
name = "Air supply pipe"
desc = "A one meter section of supply pipe"
icon_state = "intact-supply"
connect_types = list(2)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/simple/visible/yellow
color = PIPE_COLOR_YELLOW
/obj/machinery/atmospherics/pipe/simple/visible/cyan
color = PIPE_COLOR_CYAN
/obj/machinery/atmospherics/pipe/simple/visible/green
color = PIPE_COLOR_GREEN
/obj/machinery/atmospherics/pipe/simple/visible/purple
color = PIPE_COLOR_PURPLE
/obj/machinery/atmospherics/pipe/simple/visible/universal
name="Universal pipe adapter"
desc = "An adapter for regular, supply and scrubbers pipes"
connect_types = list(1,2,3)
icon_state = "map_universal"
/obj/machinery/atmospherics/pipe/simple/visible/universal/update_icon(var/safety = 0)
if(!check_icon_cache())
return
alpha = 255
overlays.Cut()
overlays += icon_manager.get_atmos_icon("pipe", , pipe_color, "universal")
underlays.Cut()
if (node1)
universal_underlays(node1)
if(node2)
universal_underlays(node2)
else
var/node1_dir = get_dir(node1,src)
universal_underlays(,node1_dir)
else if (node2)
universal_underlays(node2)
else
universal_underlays(,dir)
universal_underlays(,turn(dir, -180))
/obj/machinery/atmospherics/pipe/simple/visible/universal/update_underlays()
..()
update_icon()
+166
View File
@@ -0,0 +1,166 @@
/obj/machinery/atmospherics/pipe/tank
icon = 'icons/atmos/tank.dmi'
icon_state = "air_map"
name = "Pressure Tank"
desc = "A large vessel containing pressurized gas."
volume = 10000 //in liters, 1 meters by 1 meters by 2 meters ~tweaked it a little to simulate a pressure tank without needing to recode them yet
level = 1
dir = SOUTH
initialize_directions = SOUTH
density = 1
var/obj/machinery/atmospherics/node1
/obj/machinery/atmospherics/pipe/tank/New()
icon_state = "air"
initialize_directions = dir
..()
/obj/machinery/atmospherics/pipe/tank/process()
if(!parent)
..()
else
. = PROCESS_KILL
/obj/machinery/atmospherics/pipe/tank/Destroy()
if(node1)
node1.disconnect(src)
return ..()
/obj/machinery/atmospherics/pipe/tank/pipeline_expansion()
return list(node1)
/obj/machinery/atmospherics/pipe/tank/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
add_underlay(T, node1, dir)
/obj/machinery/atmospherics/pipe/tank/hide()
update_underlays()
/obj/machinery/atmospherics/pipe/tank/initialize()
var/connect_direction = dir
for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node1 = target
break
update_underlays()
/obj/machinery/atmospherics/pipe/tank/disconnect(obj/machinery/atmospherics/reference)
if(reference == node1)
if(istype(node1, /obj/machinery/atmospherics/pipe))
qdel(parent)
node1 = null
update_underlays()
return null
/obj/machinery/atmospherics/pipe/tank/attackby(var/obj/item/W as obj, var/mob/user as mob, params)
if(istype(W, /obj/item/device/pipe_painter))
return
if(istype(W, /obj/item/device/analyzer))
atmosanalyzer_scan(parent.air, user)
return
/obj/machinery/atmospherics/pipe/tank/air
name = "Pressure Tank (Air)"
icon_state = "air_map"
/obj/machinery/atmospherics/pipe/tank/air/New()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.oxygen = (25*ONE_ATMOSPHERE*O2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
air_temporary.nitrogen = (25*ONE_ATMOSPHERE*N2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
..()
icon_state = "air"
/obj/machinery/atmospherics/pipe/tank/oxygen
name = "Pressure Tank (Oxygen)"
icon_state = "o2_map"
/obj/machinery/atmospherics/pipe/tank/oxygen/New()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.oxygen = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
..()
icon_state = "o2"
/obj/machinery/atmospherics/pipe/tank/nitrogen
name = "Pressure Tank (Nitrogen)"
icon_state = "n2_map"
/obj/machinery/atmospherics/pipe/tank/nitrogen/New()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.nitrogen = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
..()
icon_state = "n2"
/obj/machinery/atmospherics/pipe/tank/carbon_dioxide
name = "Pressure Tank (Carbon Dioxide)"
icon_state = "co2_map"
/obj/machinery/atmospherics/pipe/tank/carbon_dioxide/New()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.carbon_dioxide = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
..()
icon_state = "co2"
/obj/machinery/atmospherics/pipe/tank/toxins
name = "Pressure Tank (Toxins)"
icon_state = "toxins_map"
/obj/machinery/atmospherics/pipe/tank/toxins/New()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.toxins = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
..()
icon_state = "toxins"
/obj/machinery/atmospherics/pipe/tank/nitrous_oxide
name = "Pressure Tank (Nitrous Oxide)"
icon_state = "n2o_map"
/obj/machinery/atmospherics/pipe/tank/nitrous_oxide/New()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T0C
var/datum/gas/sleeping_agent/trace_gas = new
trace_gas.moles = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
air_temporary.trace_gases += trace_gas
..()
icon_state = "n2o"
+105
View File
@@ -0,0 +1,105 @@
/obj/machinery/atmospherics/pipe/vent
icon = 'icons/obj/atmospherics/pipe_vent.dmi'
icon_state = "intact"
name = "Vent"
desc = "A large air vent"
level = 1
volume = 250
dir = SOUTH
initialize_directions = SOUTH
var/build_killswitch = 1
var/obj/machinery/atmospherics/node1
/obj/machinery/atmospherics/pipe/vent/New()
initialize_directions = dir
..()
/obj/machinery/atmospherics/pipe/vent/high_volume
name = "Larger vent"
volume = 1000
/obj/machinery/atmospherics/pipe/vent/process()
if(!parent)
if(build_killswitch <= 0)
. = PROCESS_KILL
else
build_killswitch--
..()
return
else
parent.mingle_with_turf(loc, volume)
/obj/machinery/atmospherics/pipe/vent/Destroy()
if(node1)
node1.disconnect(src)
return ..()
/obj/machinery/atmospherics/pipe/vent/pipeline_expansion()
return list(node1)
/obj/machinery/atmospherics/pipe/vent/update_icon()
if(node1)
icon_state = "intact"
dir = get_dir(src, node1)
else
icon_state = "exposed"
/obj/machinery/atmospherics/pipe/vent/initialize()
var/connect_direction = dir
for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node1 = target
break
update_icon()
/obj/machinery/atmospherics/pipe/vent/disconnect(obj/machinery/atmospherics/reference)
if(reference == node1)
if(istype(node1, /obj/machinery/atmospherics/pipe))
qdel(parent)
node1 = null
update_icon()
return null
/obj/machinery/atmospherics/pipe/vent/hide(var/i) //to make the little pipe section invisible, the icon changes.
if(node1)
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
dir = get_dir(src, node1)
else
icon_state = "exposed"
/obj/machinery/atmospherics/pipe/vent/attackby(var/obj/item/weapon/W, var/mob/user)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
var/turf/T = get_turf(src)
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = T.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "<span class='alert'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(T, 'sound/items/Ratchet.ogg', 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.")
new /obj/item/pipe(T, make_from=src)
qdel(src)