Conflicts:
	_maps/map_files/cyberiad/cyberiad.dmm
This commit is contained in:
Markolie
2015-09-22 00:17:30 +02:00
242 changed files with 15339 additions and 19006 deletions
+184 -73
View File
@@ -10,42 +10,26 @@ Pipelines + Other Objects -> Pipe network
*/
/obj/machinery/atmospherics
auto_init = 0
anchored = 1
layer = 2.4 //under wires with their 2.44
idle_power_usage = 0
active_power_usage = 0
power_channel = ENVIRON
var/nodealert = 0
layer = 2.4 //under wires with their 2.44
var/can_unwrench = 0
var/connect_types[] = list(1) //1=regular, 2=supply, 3=scrubber
var/connected_to = 1 //same as above, currently not used for anything
var/icon_connect_type = "" //"-supply" or "-scrubbers"
var/initialize_directions = 0
var/pipe_color
var/obj/item/pipe/stored
var/image/pipe_image
var/global/datum/pipe_icon_manager/icon_manager
/obj/machinery/atmospherics/Destroy()
for(var/mob/living/M in src) //ventcrawling is serious business
M.remove_ventcrawl()
M.forceMove(src.loc)
if(pipe_image)
del(pipe_image) //we have to del it, or it might keep a ref somewhere else
return ..()
// Find a connecting /obj/machinery/atmospherics in specified direction.
/obj/machinery/atmospherics/proc/findConnecting(var/direction)
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
return target
/obj/machinery/atmospherics/New()
if(!icon_manager)
icon_manager = new()
@@ -56,12 +40,39 @@ Pipelines + Other Objects -> Pipe network
if(!pipe_color_check(pipe_color))
pipe_color = null
if(can_unwrench)
stored = new(src, make_from = src)
..()
/obj/machinery/atmospherics/attackby(atom/A, mob/user as mob, params)
if(istype(A, /obj/item/device/pipe_painter))
return
..()
/obj/machinery/atmospherics/Destroy()
for(var/mob/living/M in src) //ventcrawling is serious business
M.remove_ventcrawl()
M.forceMove(loc)
if(pipe_image)
del(pipe_image) //we have to del it, or it might keep a ref somewhere else
return ..()
// Icons/overlays/underlays
/obj/machinery/atmospherics/update_icon()
return null
/obj/machinery/atmospherics/proc/check_icon_cache(var/safety = 0)
if(!istype(icon_manager))
if(!safety) //to prevent infinite loops
icon_manager = new()
check_icon_cache(1)
return 0
return 1
/obj/machinery/atmospherics/proc/color_cache_name(var/obj/machinery/atmospherics/node)
//Don't use this for standard pipes
if(!istype(node))
return null
return node.pipe_color
/obj/machinery/atmospherics/proc/add_underlay(var/turf/T, var/obj/machinery/atmospherics/node, var/direction, var/icon_connect_type)
if(node)
@@ -81,7 +92,8 @@ Pipelines + Other Objects -> Pipe network
else
return 0
obj/machinery/atmospherics/proc/check_connect_types(obj/machinery/atmospherics/atmos1, obj/machinery/atmospherics/atmos2)
// Connect types
/obj/machinery/atmospherics/proc/check_connect_types(obj/machinery/atmospherics/atmos1, obj/machinery/atmospherics/atmos2)
var/i
var/list1[] = atmos1.connect_types
var/list2[] = atmos2.connect_types
@@ -93,7 +105,7 @@ obj/machinery/atmospherics/proc/check_connect_types(obj/machinery/atmospherics/a
return n
return 0
obj/machinery/atmospherics/proc/check_connect_types_construction(obj/machinery/atmospherics/atmos1, obj/item/pipe/pipe2)
/obj/machinery/atmospherics/proc/check_connect_types_construction(obj/machinery/atmospherics/atmos1, obj/item/pipe/pipe2)
var/i
var/list1[] = atmos1.connect_types
var/list2[] = pipe2.connect_types
@@ -105,58 +117,116 @@ obj/machinery/atmospherics/proc/check_connect_types_construction(obj/machinery/a
return n
return 0
/obj/machinery/atmospherics/proc/check_icon_cache(var/safety = 0)
if(!istype(icon_manager))
if(!safety) //to prevent infinite loops
icon_manager = new()
check_icon_cache(1)
return 0
// Pipenet related functions
/obj/machinery/atmospherics/proc/returnPipenet()
return
return 1
/obj/machinery/atmospherics/proc/returnPipenetAir()
return
/obj/machinery/atmospherics/proc/color_cache_name(var/obj/machinery/atmospherics/node)
//Don't use this for standard pipes
if(!istype(node))
return null
/obj/machinery/atmospherics/proc/setPipenet()
return
return node.pipe_color
/obj/machinery/atmospherics/process()
build_network()
/obj/machinery/atmospherics/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
// Check to see if should be added to network. Add self if so and adjust variables appropriately.
// Note don't forget to have neighbors look as well!
return null
/obj/machinery/atmospherics/proc/replacePipenet()
return
/obj/machinery/atmospherics/proc/build_network()
// Called to build a network from this node
return null
/obj/machinery/atmospherics/proc/return_network(obj/machinery/atmospherics/reference)
// Returns pipe_network associated with connection to reference
// Notes: should create network if necessary
// Should never return null
return null
/obj/machinery/atmospherics/proc/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
// Used when two pipe_networks are combining
/obj/machinery/atmospherics/proc/return_network_air(datum/network/reference)
// Return a list of gas_mixture(s) in the object
// associated with reference pipe_network for use in rebuilding the networks gases list
// Is permitted to return null
return
/obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference)
return
/obj/machinery/atmospherics/proc/nullifyPipenet(datum/pipeline/P)
if(P)
P.other_atmosmch -= src
/obj/machinery/atmospherics/update_icon()
return null
//(De)construction
/obj/machinery/atmospherics/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if(can_unwrench && istype(W, /obj/item/weapon/wrench))
var/turf/T = get_turf(src)
if (level==1 && isturf(T) && T.intact)
user << "<span class='danger'>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()
add_fingerprint(user)
var/unsafe_wrenching = FALSE
var/internal_pressure = int_air.return_pressure()-env_air.return_pressure()
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (internal_pressure > 2*ONE_ATMOSPHERE)
user << "<span class='warning'>As you begin unwrenching \the [src] a gush of air blows in your face... maybe you should reconsider?</span>"
unsafe_wrenching = TRUE //Oh dear oh dear
if (do_after(user, 40, target = src) && isnull(gcDestroyed))
user.visible_message( \
"[user] unfastens \the [src].", \
"<span class='notice'>You have unfastened \the [src].</span>", \
"<span class='italics'>You hear ratchet.</span>")
investigate_log("was <span class='warning'>REMOVED</span> by [key_name(usr)]", "atmos")
//You unwrenched a pipe full of pressure? let's splat you into the wall silly.
if(unsafe_wrenching)
unsafe_pressure_release(user,internal_pressure)
Deconstruct()
else
return ..()
//Called when an atmospherics object is unwrenched while having a large pressure difference
//with it's locs air contents.
/obj/machinery/atmospherics/proc/unsafe_pressure_release(var/mob/user,var/pressures)
if(!user)
return
if(!pressures)
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
pressures = int_air.return_pressure()-env_air.return_pressure()
var/fuck_you_dir = get_dir(src,user)
var/turf/general_direction = get_edge_target_turf(user,fuck_you_dir)
user.visible_message("<span class='danger'>[user] is sent flying by pressure!</span>","<span class='userdanger'>The pressure sends you flying!</span>")
//Values based on 2*ONE_ATMOS (the unsafe pressure), resulting in 20 range and 4 speed
user.throw_at(general_direction,pressures/10,pressures/50)
/obj/machinery/atmospherics/proc/Deconstruct()
if(can_unwrench)
var/turf/T = get_turf(src)
stored.loc = T
transfer_fingerprints_to(stored)
if(istype(src, /obj/machinery/atmospherics/pipe))
for(var/obj/machinery/meter/meter in T)
if(meter.target == src)
new /obj/item/pipe_meter(T)
qdel(meter)
qdel(src)
/obj/machinery/atmospherics/construction(D, P, C)
if(C)
color = C
dir = D
initialize_directions = P
var/turf/T = loc
level = T.intact ? 2 : 1
initialize()
var/list/nodes = pipeline_expansion()
for(var/obj/machinery/atmospherics/A in nodes)
A.initialize()
A.addMember(src)
build_network()
// Find a connecting /obj/machinery/atmospherics in specified direction.
/obj/machinery/atmospherics/proc/findConnecting(var/direction)
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
var/can_connect = check_connect_types(target, src)
if(can_connect && (target.initialize_directions & get_dir(target,src)))
return target
// Ventcrawling
#define VENT_SOUND_DELAY 30
/obj/machinery/atmospherics/relaymove(mob/living/user, direction)
if(!(direction & initialize_directions)) //can't go in a way we aren't connecting to
return
@@ -168,16 +238,16 @@ obj/machinery/atmospherics/proc/check_connect_types_construction(obj/machinery/a
user.forceMove(target_move.loc) //handles entering and so on
user.visible_message("You hear something squeezing through the ducts.", "You climb out the ventilation system.")
else if(target_move.can_crawl_through())
if(target_move.return_network(target_move) != return_network(src))
user.remove_ventcrawl()
user.add_ventcrawl(target_move)
if(returnPipenet() != target_move.returnPipenet())
user.update_pipe_vision(target_move)
user.loc = target_move
user.client.eye = target_move //if we don't do this, Byond only updates the eye every tick - required for smooth movement
if(world.time - user.last_played_vent > VENT_SOUND_DELAY)
user.last_played_vent = world.time
playsound(src, 'sound/machines/ventcrawl.ogg', 50, 1, -3)
else
if((direction & initialize_directions) || is_type_in_list(src, ventcrawl_machinery) && target_move.can_crawl_through()) //if we move in a way the pipe can connect, but doesn't - or we're in a vent
var/can_connect = check_connect_types(target_move, src)
if((direction & initialize_directions) || (is_type_in_list(src, ventcrawl_machinery) && target_move.can_crawl_through() && can_connect)) //if we move in a way the pipe can connect, but doesn't - or we're in a vent
user.remove_ventcrawl()
user.forceMove(src.loc)
user.visible_message("You hear something squeezing through the pipes.", "You climb out the ventilation system.")
@@ -193,7 +263,48 @@ obj/machinery/atmospherics/proc/check_connect_types_construction(obj/machinery/a
/obj/machinery/atmospherics/proc/can_crawl_through()
return 1
/obj/machinery/atmospherics/proc/change_color(var/new_color)
//only pass valid pipe colors please ~otherwise your pipe will turn invisible
if(!pipe_color_check(new_color))
return
pipe_color = new_color
update_icon()
// Additional icon procs
/obj/machinery/atmospherics/proc/universal_underlays(var/obj/machinery/atmospherics/node, var/direction)
var/turf/T = get_turf(src)
if(!istype(T)) return
if(node)
var/node_dir = get_dir(src,node)
if(node.icon_connect_type == "-supply")
add_underlay_adapter(T, , node_dir, "")
add_underlay_adapter(T, node, node_dir, "-supply")
add_underlay_adapter(T, , node_dir, "-scrubbers")
else if (node.icon_connect_type == "-scrubbers")
add_underlay_adapter(T, , node_dir, "")
add_underlay_adapter(T, , node_dir, "-supply")
add_underlay_adapter(T, node, node_dir, "-scrubbers")
else
add_underlay_adapter(T, node, node_dir, "")
add_underlay_adapter(T, , node_dir, "-supply")
add_underlay_adapter(T, , node_dir, "-scrubbers")
else
add_underlay_adapter(T, , direction, "-supply")
add_underlay_adapter(T, , direction, "-scrubbers")
add_underlay_adapter(T, , direction, "")
/obj/machinery/atmospherics/proc/add_underlay_adapter(var/turf/T, var/obj/machinery/atmospherics/node, var/direction, var/icon_connect_type) //modified from add_underlay, does not make exposed underlays
if(node)
if(T.intact && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
underlays += icon_manager.get_atmos_icon("underlay", direction, color_cache_name(node), "down" + icon_connect_type)
else
underlays += icon_manager.get_atmos_icon("underlay", direction, color_cache_name(node), "intact" + icon_connect_type)
else
underlays += icon_manager.get_atmos_icon("underlay", direction, color_cache_name(node), "retracted" + icon_connect_type)
/obj/machinery/atmospherics/singularity_pull(S, current_size)
if(current_size >= STAGE_FIVE)
qdel(src)
Deconstruct()
@@ -8,9 +8,9 @@
var/obj/machinery/atmospherics/node1
var/obj/machinery/atmospherics/node2
var/datum/pipe_network/network1
var/datum/pipe_network/network2
var/datum/pipeline/parent1
var/datum/pipeline/parent2
/obj/machinery/atmospherics/binary/New()
..()
@@ -23,6 +23,7 @@
initialize_directions = EAST|WEST
if(WEST)
initialize_directions = EAST|WEST
air1 = new
air2 = new
@@ -30,38 +31,17 @@
air2.volume = 200
/obj/machinery/atmospherics/binary/Destroy()
loc = null
if(node1)
node1.disconnect(src)
qdel(network1)
node1 = null
nullifyPipenet(parent1)
if(node2)
node2.disconnect(src)
qdel(network2)
node1 = null
node2 = null
node2 = null
nullifyPipenet(parent2)
return ..()
// Housekeeping and pipe network stuff below
/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
if(new_network.normal_members.Find(src))
return 0
new_network.normal_members += src
return null
/obj/machinery/atmospherics/binary/initialize()
if(node1 && node2) return
var/node2_connect = dir
var/node1_connect = turn(dir, 180)
@@ -70,7 +50,7 @@
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
connected_to = c
node1 = target
break
@@ -79,7 +59,7 @@
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
connected_to = c
node2 = target
break
@@ -87,56 +67,80 @@
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(!parent1)
parent1 = new /datum/pipeline()
parent1.build_pipeline(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
if(!parent2)
parent2 = new /datum/pipeline()
parent2.build_pipeline(src)
/obj/machinery/atmospherics/binary/disconnect(obj/machinery/atmospherics/reference)
if(reference==node1)
qdel(network1)
if(reference == node1)
if(istype(node1, /obj/machinery/atmospherics/pipe))
qdel(parent1)
node1 = null
else if(reference==node2)
qdel(network2)
else if(reference == node2)
if(istype(node2, /obj/machinery/atmospherics/pipe))
qdel(parent2)
node2 = null
update_icon()
update_underlays()
return null
/obj/machinery/atmospherics/binary/nullifyPipenet(datum/pipeline/P)
..()
if(P == parent1)
parent1.other_airs -= air1
parent1 = null
else if(P == parent2)
parent2.other_airs -= air2
parent2 = null
/obj/machinery/atmospherics/binary/returnPipenetAir(datum/pipeline/P)
if(P == parent1)
return air1
else if(P == parent2)
return air2
/obj/machinery/atmospherics/binary/pipeline_expansion(datum/pipeline/P)
if(P)
if(parent1 == P)
return list(node1)
else if(parent2 == P)
return list(node2)
else
return list(node1, node2)
/obj/machinery/atmospherics/binary/setPipenet(datum/pipeline/P, obj/machinery/atmospherics/A)
if(A == node1)
parent1 = P
else if(A == node2)
parent2 = P
/obj/machinery/atmospherics/binary/returnPipenet(obj/machinery/atmospherics/A)
if(A == node1)
return parent1
else if(A == node2)
return parent2
/obj/machinery/atmospherics/binary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
if(Old == parent1)
parent1 = New
else if(Old == parent2)
parent2 = New
/obj/machinery/atmospherics/binary/unsafe_pressure_release(var/mob/user,var/pressures)
..()
var/turf/T = get_turf(src)
if(T)
//Remove the gas from air1+air2 and assume it
var/datum/gas_mixture/environment = T.return_air()
var/lost = pressures*environment.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
lost += pressures*environment.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
var/shared_loss = lost/2
var/datum/gas_mixture/to_release = air1.remove(shared_loss)
to_release.merge(air2.remove(shared_loss))
T.assume_air(to_release)
air_update_turf(1)
@@ -1,12 +1,12 @@
//node1, air1, network1 correspond to input
//node2, air2, network2 correspond to output
/obj/machinery/atmospherics/binary/circulator
name = "circulator/heat exchanger"
desc = "A gas circulator pump and heat exchanger."
icon = 'icons/obj/pipes.dmi'
icon_state = "circ-off"
anchored = 0
density = 1
var/recent_moles_transferred = 0
var/last_heat_capacity = 0
@@ -14,15 +14,13 @@
var/last_pressure_delta = 0
var/last_worldtime_transfer = 0
density = 1
/obj/machinery/atmospherics/binary/circulator/New()
..()
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
/obj/machinery/atmospherics/binary/circulator/proc/return_transfer_air()
var/datum/gas_mixture/removed
if(anchored && !(stat&BROKEN) )
if(anchored && !(stat & BROKEN))
var/input_starting_pressure = air1.return_pressure()
var/output_starting_pressure = air2.return_pressure()
last_pressure_delta = max(input_starting_pressure - output_starting_pressure + 10, 0)
@@ -40,8 +38,7 @@
last_temperature = removed.temperature
//Update the gas networks.
if(network1)
network1.update = 1
parent1.update = 1
last_worldtime_transfer = world.time
else
@@ -52,7 +49,6 @@
/obj/machinery/atmospherics/binary/circulator/process()
..()
if(last_worldtime_transfer < world.time - 50)
recent_moles_transferred = 0
update_icon()
@@ -69,59 +65,3 @@
icon_state = "circ-off"
return 1
/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 << "<span class='notice'>You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.</span>"
if(anchored)
if(dir & (NORTH|SOUTH))
initialize_directions = NORTH|SOUTH
else if(dir & (EAST|WEST))
initialize_directions = EAST|WEST
initialize()
build_network()
if (node1)
node1.initialize()
node1.build_network()
if (node2)
node2.initialize()
node2.build_network()
else
if(node1)
node1.disconnect(src)
qdel(network1)
if(node2)
node2.disconnect(src)
qdel(network2)
node1 = null
node2 = null
else
..()
/obj/machinery/atmospherics/binary/circulator/verb/rotate_clockwise()
set category = "Object"
set name = "Rotate Circulator (Clockwise)"
set src in view(1)
if (usr.stat || usr.restrained() || anchored)
return
src.dir = turn(src.dir, 90)
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
/obj/machinery/atmospherics/binary/circulator/verb/rotate_anticlockwise()
set category = "Object"
set name = "Rotate Circulator (Counterclockwise)"
set src in view(1)
if (usr.stat || usr.restrained() || anchored)
return
src.dir = turn(src.dir, -90)
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
@@ -7,7 +7,7 @@
req_one_access_txt = "24;10"
name = "Dual Port Air Vent"
name = "dual-port air vent"
desc = "Has a valve and pump attached to it. There are two ports."
level = 1
@@ -32,6 +32,26 @@
//1: Do not pass external_pressure_bound
//2: Do not pass input_pressure_min
//4: Do not pass output_pressure_max
/obj/machinery/atmospherics/binary/dp_vent_pump/New()
..()
if (!id_tag)
assign_uid()
id_tag = num2text(uid)
icon = null
/obj/machinery/atmospherics/binary/dp_vent_pump/initialize()
..()
if(frequency)
set_frequency(frequency)
/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume
name = "large dual port air vent"
/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume/New()
..()
air1.volume = 1000
air2.volume = 1000
/obj/machinery/atmospherics/binary/volume_pump/update_underlays()
if(..())
@@ -42,38 +62,6 @@
add_underlay(T, node1, turn(dir, -180))
add_underlay(T, node2, dir)
/obj/machinery/atmospherics/binary/dp_vent_pump/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
return {"
<ul>
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
<li><b>ID Tag:</b> <a href="?src=\ref[src];set_id=1">[id_tag]</a></li>
<li><b>AAC Acces:</b> <a href="?src=\ref[src];toggleadvcontrol=1">[advcontrol ? "Allowed" : "Blocked"]</a></li>
</ul>
"}
/obj/machinery/atmospherics/binary/dp_vent_pump/multitool_topic(var/mob/user, var/list/href_list, var/obj/O)
. = ..()
if(.)
return .
if("toggleadvcontrol" in href_list)
advcontrol = !advcontrol
return MT_UPDATE
/obj/machinery/atmospherics/binary/dp_vent_pump/New()
..()
if (!id_tag)
assign_uid()
id_tag = num2text(uid)
icon = null
/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume
name = "Large Dual Port Air Vent"
/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume/New()
..()
air1.volume = 1000
air2.volume = 1000
/obj/machinery/atmospherics/binary/dp_vent_pump/update_icon(var/safety = 0)
if(!check_icon_cache())
return
@@ -114,10 +102,6 @@
else
add_underlay(T, node2, dir)
/obj/machinery/atmospherics/binary/dp_vent_pump/hide(var/i)
update_icon()
update_underlays()
/obj/machinery/atmospherics/binary/dp_vent_pump/process()
..()
@@ -143,11 +127,8 @@
loc.assume_air(removed)
if(network1)
network1.update = 1
parent1.update = 1
air_update_turf()
else //external -> output
var/pressure_delta = 10000
@@ -164,15 +145,11 @@
air2.merge(removed)
if(network2)
network2.update = 1
parent2.update = 1
air_update_turf()
return 1
//Radio remote control
//Radio remote control
/obj/machinery/atmospherics/binary/dp_vent_pump/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
@@ -202,11 +179,6 @@
return 1
/obj/machinery/atmospherics/binary/dp_vent_pump/initialize()
..()
if(frequency)
set_frequency(frequency)
/obj/machinery/atmospherics/binary/dp_vent_pump/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command") || (signal.data["advcontrol"] && !advcontrol))
return 0
@@ -261,51 +233,26 @@
update_icon()
/obj/machinery/atmospherics/binary/dp_vent_pump/attackby(var/obj/item/W as obj, var/mob/user as mob)
/*
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if (WT.remove_fuel(0,user))
user << "<span class='notice'>Now welding the vent.</span>"
if(do_after(user, 20, target = src))
if(!src || !WT.isOn()) return
playsound(get_turf(src), 'sound/items/Welder2.ogg', 50, 1)
if(!welded)
user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
welded = 1
update_icon()
else
user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.")
welded = 0
update_icon()
else
user << "<span class='notice'>The welding tool needs to be on to start this task.</span>"
else
user << "<span class='notice'>You need more welding fuel to complete this task.</span>"
return 1*/
if(istype(W, /obj/item/device/multitool))
update_multitool_menu(user)
return 1
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && on)
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 << "<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, target = src))
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)
return ..()
/obj/machinery/atmospherics/binary/dp_vent_pump/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
return {"
<ul>
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
<li><b>ID Tag:</b> <a href="?src=\ref[src];set_id=1">[id_tag]</a></li>
<li><b>AAC Acces:</b> <a href="?src=\ref[src];toggleadvcontrol=1">[advcontrol ? "Allowed" : "Blocked"]</a></li>
</ul>
"}
/obj/machinery/atmospherics/binary/dp_vent_pump/multitool_topic(var/mob/user, var/list/href_list, var/obj/O)
. = ..()
if(.)
return .
if("toggleadvcontrol" in href_list)
advcontrol = !advcontrol
return MT_UPDATE
@@ -5,8 +5,10 @@
icon_state = "map"
level = 1
name = "Passive gate"
name = "passive gate"
desc = "A one-way air valve that does not require power"
can_unwrench = 1
var/on = 0
var/target_pressure = ONE_ATMOSPHERE
@@ -14,6 +16,11 @@
var/frequency = 0
var/id = null
var/datum/radio_frequency/radio_connection
/obj/machinery/atmospherics/binary/passive_gate/initialize()
..()
if(frequency)
set_frequency(frequency)
/obj/machinery/atmospherics/binary/passive_gate/update_icon()
icon_state = "[on ? "on" : "off"]"
@@ -27,9 +34,6 @@
add_underlay(T, node1, turn(dir, 180))
add_underlay(T, node2, dir)
/obj/machinery/atmospherics/binary/passive_gate/hide(var/i)
update_underlays()
/obj/machinery/atmospherics/binary/passive_gate/process()
..()
if(!on)
@@ -54,14 +58,11 @@
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
air2.merge(removed)
if(network1)
network1.update = 1
parent1.update = 1
if(network2)
network2.update = 1
parent2.update = 1
//Radio remote control
/obj/machinery/atmospherics/binary/passive_gate/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
@@ -97,14 +98,11 @@
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_pump")
onclose(user, "atmo_pump")
/obj/machinery/atmospherics/binary/passive_gate/initialize()
..()
if(frequency)
set_frequency(frequency)
/obj/machinery/atmospherics/binary/passive_gate/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
return 0
var/old_on = on //for logging
if("power" in signal.data)
on = text2num(signal.data["power"])
@@ -118,6 +116,9 @@
text2num(signal.data["set_output_pressure"]),
ONE_ATMOSPHERE*50
)
if(on != old_on)
investigate_log("was turned [on ? "on" : "off"] by a remote signal", "atmos")
if("status" in signal.data)
spawn(2)
@@ -144,9 +145,11 @@
if(..()) return
if(href_list["power"])
on = !on
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
if(href_list["set_press"])
var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
src.target_pressure = max(0, min(4500, new_pressure))
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
usr.set_machine(src)
src.update_icon()
src.updateUsrDialog()
@@ -158,18 +161,5 @@
if (on)
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 << "<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, target = src))
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)
return ..()
@@ -17,8 +17,10 @@ Thus, the two variables affect pump operation are set in New():
icon_state = "map_off"
level = 1
name = "Gas pump"
name = "gas pump"
desc = "A pump"
can_unwrench = 1
var/on = 0
var/target_pressure = ONE_ATMOSPHERE
@@ -52,9 +54,6 @@ Thus, the two variables affect pump operation are set in New():
add_underlay(T, node1, turn(dir, -180))
add_underlay(T, node2, dir)
/obj/machinery/atmospherics/binary/pump/hide(var/i)
update_underlays()
/obj/machinery/atmospherics/binary/pump/process()
// ..()
if(stat & (NOPOWER|BROKEN))
@@ -77,16 +76,12 @@ Thus, the two variables affect pump operation are set in New():
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
air2.merge(removed)
if(network1)
network1.update = 1
if(network2)
network2.update = 1
parent1.update = 1
parent2.update = 1
return 1
//Radio remote control
/obj/machinery/atmospherics/binary/pump/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
@@ -110,7 +105,6 @@ Thus, the two variables affect pump operation are set in New():
)
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
return 1
/obj/machinery/atmospherics/binary/pump/interact(mob/user as mob)
@@ -130,6 +124,8 @@ Thus, the two variables affect pump operation are set in New():
/obj/machinery/atmospherics/binary/pump/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
return 0
var/old_on = on //for logging
if(signal.data["power"])
on = text2num(signal.data["power"])
@@ -143,6 +139,9 @@ Thus, the two variables affect pump operation are set in New():
text2num(signal.data["set_output_pressure"]),
ONE_ATMOSPHERE*50
)
if(on != old_on)
investigate_log("was turned [on ? "on" : "off"] by a remote signal", "atmos")
if(signal.data["status"])
spawn(2)
@@ -154,7 +153,6 @@ Thus, the two variables affect pump operation are set in New():
update_icon()
return
/obj/machinery/atmospherics/binary/pump/attack_hand(user as mob)
if(..())
return
@@ -167,12 +165,15 @@ Thus, the two variables affect pump operation are set in New():
return
/obj/machinery/atmospherics/binary/pump/Topic(href,href_list)
if(..()) return
if(..())
return 1
if(href_list["power"])
on = !on
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
if(href_list["set_press"])
var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
src.target_pressure = max(0, min(4500, new_pressure))
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
usr.set_machine(src)
src.update_icon()
src.updateUsrDialog()
@@ -190,18 +191,4 @@ Thus, the two variables affect pump operation are set in New():
if (!(stat & NOPOWER) && on)
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 << "<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, target = src))
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)
return ..()
@@ -0,0 +1,147 @@
/obj/machinery/atmospherics/binary/valve
icon = 'icons/atmos/valve.dmi'
icon_state = "map_valve0"
name = "manual valve"
desc = "A pipe valve"
can_unwrench = 1
level = 1
var/open = 0
req_one_access_txt = "24;10"
/obj/machinery/atmospherics/binary/valve/open
open = 1
icon_state = "map_valve1"
/obj/machinery/atmospherics/binary/valve/update_icon(animation)
if(animation)
flick("valve[src.open][!src.open]",src)
else
icon_state = "valve[open]"
/obj/machinery/atmospherics/binary/valve/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
add_underlay(T, node1, get_dir(src, node1))
add_underlay(T, node2, get_dir(src, node2))
/obj/machinery/atmospherics/binary/valve/proc/open()
open = 1
update_icon()
parent1.update = 0
parent2.update = 0
parent1.reconcile_air()
investigate_log("was opened by [usr ? key_name(usr) : "a remote signal"]", "atmos")
return
/obj/machinery/atmospherics/binary/valve/proc/close()
open = 0
update_icon()
investigate_log("was closed by [usr ? key_name(usr) : "a remote signal"]", "atmos")
return
/obj/machinery/atmospherics/binary/valve/attack_ai(mob/user as mob)
return
/obj/machinery/atmospherics/binary/valve/attack_hand(mob/user as mob)
add_fingerprint(usr)
update_icon(1)
sleep(10)
if (open)
close()
return
open()
/obj/machinery/atmospherics/binary/valve/digital // can be controlled by AI
name = "digital valve"
desc = "A digitally controlled valve."
icon = 'icons/atmos/digital_valve.dmi'
var/frequency = 1439
var/id_tag = null
var/datum/radio_frequency/radio_connection
settagwhitelist = list("id_tag")
/obj/machinery/atmospherics/binary/valve/digital/attack_ai(mob/user as mob)
return src.attack_hand(user)
/obj/machinery/atmospherics/binary/valve/digital/attack_hand(mob/user as mob)
if(!powered())
return
if(!src.allowed(user))
user << "<span class='alert'>Access denied.</span>"
return
..()
/obj/machinery/atmospherics/binary/valve/digital/open
open = 1
icon_state = "map_valve1"
/obj/machinery/atmospherics/binary/valve/digital/power_change()
var/old_stat = stat
..()
if(old_stat != stat)
update_icon()
/obj/machinery/atmospherics/binary/valve/digital/update_icon()
..()
if(!powered())
icon_state = "valve[open]nopower"
/obj/machinery/atmospherics/binary/valve/digital/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
/obj/machinery/atmospherics/binary/valve/digital/initialize()
..()
if(frequency)
set_frequency(frequency)
/obj/machinery/atmospherics/binary/valve/digital/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id_tag))
return 0
switch(signal.data["command"])
if("valve_open")
if(!open)
open()
if("valve_close")
if(open)
close()
if("valve_toggle")
if(open)
close()
else
open()
if("valve_set")
if(signal.data["valve_set"] == 1)
if(!open)
open()
else
if(open)
close()
/obj/machinery/atmospherics/binary/valve/digital/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if(istype(W, /obj/item/device/multitool))
update_multitool_menu(user)
return 1
..()
/obj/machinery/atmospherics/binary/valve/digital/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
return {"
<ul>
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
<li>[format_tag("ID Tag","id_tag","set_id")]</a></li>
</ul>
"}
@@ -17,8 +17,10 @@ Thus, the two variables affect pump operation are set in New():
icon_state = "map_off"
level = 1
name = "Volumetric gas pump"
name = "volumetric gas pump"
desc = "A volumetric pump"
can_unwrench = 1
var/on = 0
var/transfer_rate = 200
@@ -30,6 +32,10 @@ Thus, the two variables affect pump operation are set in New():
/obj/machinery/atmospherics/binary/volume_pump/on
on = 1
icon_state = "map_on"
/obj/machinery/atmospherics/binary/volume_pump/initialize()
..()
set_frequency(frequency)
/obj/machinery/atmospherics/binary/volume_pump/update_icon()
if(!powered())
@@ -46,18 +52,13 @@ Thus, the two variables affect pump operation are set in New():
add_underlay(T, node1, turn(dir, -180))
add_underlay(T, node2, dir)
/obj/machinery/atmospherics/binary/volume_pump/hide(var/i)
update_underlays()
/obj/machinery/atmospherics/binary/volume_pump/process()
// ..()
if(stat & (NOPOWER|BROKEN))
return
if(!on)
return 0
// Pump mechanism just won't do anything if the pressure is too high/too low
// Pump mechanism just won't do anything if the pressure is too high/too low
var/input_starting_pressure = air1.return_pressure()
var/output_starting_pressure = air2.return_pressure()
@@ -70,11 +71,9 @@ Thus, the two variables affect pump operation are set in New():
air2.merge(removed)
if(network1)
network1.update = 1
if(network2)
network2.update = 1
parent1.update = 1
parent2.update = 1
return 1
@@ -112,13 +111,12 @@ Thus, the two variables affect pump operation are set in New():
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_pump")
onclose(user, "atmo_pump")
/obj/machinery/atmospherics/binary/volume_pump/initialize()
..()
set_frequency(frequency)
/obj/machinery/atmospherics/binary/volume_pump/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
return 0
var/old_on = on //for logging
if(signal.data["power"])
on = text2num(signal.data["power"])
@@ -132,6 +130,9 @@ Thus, the two variables affect pump operation are set in New():
text2num(signal.data["set_transfer_rate"]),
air1.volume
)
if(on != old_on)
investigate_log("was turned [on ? "on" : "off"] by a remote signal", "atmos")
if(signal.data["status"])
spawn(2)
@@ -154,12 +155,15 @@ Thus, the two variables affect pump operation are set in New():
return
/obj/machinery/atmospherics/binary/volume_pump/Topic(href,href_list)
if(..()) return
if(..())
return 1
if(href_list["power"])
on = !on
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
if(href_list["set_transfer_rate"])
var/new_transfer_rate = input(usr,"Enter new output volume (0-200l/s)","Flow control",src.transfer_rate) as num
src.transfer_rate = max(0, min(200, new_transfer_rate))
investigate_log("was set to [transfer_rate] L/s by [key_name(usr)]", "atmos")
usr.set_machine(src)
src.update_icon()
src.updateUsrDialog()
@@ -177,18 +181,4 @@ Thus, the two variables affect pump operation are set in New():
if (!(stat & NOPOWER) && on)
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 << "<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, target = src))
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)
return ..()
@@ -27,7 +27,7 @@
var/transfer_moles = 0
var/datum/gas_mixture/air
var/obj/machinery/atmospherics/node
var/datum/pipe_network/network
var/datum/pipeline/parent
/datum/omni_port/New(var/obj/machinery/atmospherics/omni/M, var/direction = NORTH)
..()
@@ -41,16 +41,16 @@
if(node)
return
master.initialize()
master.build_network()
if(node)
node.initialize()
node.build_network()
node.addMember(master)
master.build_network()
/datum/omni_port/proc/disconnect()
if(node)
node.disconnect(master)
master.disconnect(node)
node = null
master.nullifyPipenet(parent)
//--------------------------------------------
// Need to find somewhere else for these
@@ -90,4 +90,5 @@
if("west")
return WEST
else
return 0
return 0
@@ -99,16 +99,13 @@
filtered_out = null
P.air.merge(filtered_out)
if(P.network)
P.network.update = 1
P.parent.update = 1
output_air.merge(removed)
if(output.network)
output.network.update = 1
output.parent.update = 1
input.transfer_moles = 0
if(input.network)
input.network.update = 1
input.parent.update = 1
return
@@ -124,7 +121,6 @@
if (!ui)
ui = new(user, src, ui_key, "omni_filter.tmpl", "Omni Filter Control", 330, 330)
ui.set_initial_data(data)
ui.open()
/obj/machinery/atmospherics/omni/filter/proc/build_uidata()
@@ -181,7 +177,8 @@
return null
/obj/machinery/atmospherics/omni/filter/Topic(href, href_list)
if(..()) return
if(..())
return 1
switch(href_list["command"])
if("power")
if(!configuring)
@@ -279,4 +276,5 @@
else
initialize_directions |= P.dir
P.connect()
P.update = 1
P.update = 1
@@ -123,17 +123,13 @@
for(var/datum/omni_port/P in inputs)
P.transfer_moles *= ratio
for(var/datum/omni_port/P in inputs)
if(P.transfer_moles > 0)
output_air.merge(P.air.remove(P.transfer_moles))
if(P.network)
P.network.update = 1
P.parent.update = 1
P.transfer_moles = 0
if(output.network)
output.network.update = 1
output.parent.update = 1
return 1
@@ -149,7 +145,6 @@
if (!ui)
ui = new(user, src, ui_key, "omni_mixer.tmpl", "Omni Mixer Control", 360, 330)
ui.set_initial_data(data)
ui.open()
/obj/machinery/atmospherics/omni/mixer/proc/build_uidata()
@@ -185,7 +180,8 @@
return data
/obj/machinery/atmospherics/omni/mixer/Topic(href, href_list)
if(..()) return
if(..())
return 1
switch(href_list["command"])
if("power")
@@ -298,4 +294,5 @@
/obj/machinery/atmospherics/omni/mixer/proc/con_lock(var/port = NORTH)
for(var/datum/omni_port/P in inputs)
if(P.dir == port)
P.con_lock = !P.con_lock
P.con_lock = !P.con_lock
@@ -8,6 +8,8 @@
use_power = 1
initialize_directions = 0
level = 1
can_unwrench = 1
var/on = 0
var/configuring = 0
@@ -46,6 +48,28 @@
ports += new_port
build_icons()
/obj/machinery/atmospherics/omni/Destroy()
for(var/datum/omni_port/P in ports)
if(P.node)
P.node.disconnect(src)
P.node = null
nullifyPipenet(P.parent)
return ..()
/obj/machinery/atmospherics/omni/initialize()
for(var/datum/omni_port/P in ports)
if(P.node || P.mode == 0)
continue
for(var/obj/machinery/atmospherics/target in get_step(src, P.dir))
if(target.initialize_directions & get_dir(target,src))
P.node = target
break
for(var/datum/omni_port/P in ports)
P.update = 1
update_ports()
/obj/machinery/atmospherics/omni/update_icon()
if(stat & NOPOWER)
@@ -74,23 +98,26 @@
if(!istype(W, /obj/item/weapon/wrench))
return ..()
var/int_pressure = 0
for(var/datum/omni_port/P in ports)
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='alert'>You cannot unwrench [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
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, target = src))
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(can_unwrench)
var/int_pressure = 0
for(var/datum/omni_port/P in ports)
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='danger'>You cannot unwrench [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, target = src))
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)
else
return ..()
/obj/machinery/atmospherics/omni/attack_hand(user as mob)
if(..())
@@ -207,87 +234,56 @@
/obj/machinery/atmospherics/omni/proc/sort_ports()
return
// Housekeeping and pipe network stuff below
/obj/machinery/atmospherics/omni/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
for(var/datum/omni_port/P in ports)
if(reference == P.node)
P.network = new_network
break
if(new_network.normal_members.Find(src))
return 0
new_network.normal_members += src
return null
/obj/machinery/atmospherics/omni/Destroy()
loc = null
for(var/datum/omni_port/P in ports)
if(P.node)
P.node.disconnect(src)
qdel(P.network)
P.node = null
return ..()
/obj/machinery/atmospherics/omni/initialize()
for(var/datum/omni_port/P in ports)
if(P.node || P.mode == 0)
continue
for(var/obj/machinery/atmospherics/target in get_step(src, P.dir))
if(target.initialize_directions & get_dir(target,src))
P.node = target
break
for(var/datum/omni_port/P in ports)
P.update = 1
update_ports()
// Pipenet procs
/obj/machinery/atmospherics/omni/build_network()
for(var/datum/omni_port/P in ports)
if(!P.network && P.node)
P.network = new /datum/pipe_network()
P.network.normal_members += src
P.network.build_network(P.node, src)
/obj/machinery/atmospherics/omni/return_network(obj/machinery/atmospherics/reference)
build_network()
for(var/datum/omni_port/P in ports)
if(reference == P.node)
return P.network
return null
/obj/machinery/atmospherics/omni/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
for(var/datum/omni_port/P in ports)
if(P.network == old_network)
P.network = new_network
return 1
/obj/machinery/atmospherics/omni/return_network_air(datum/pipe_network/reference)
var/list/results = list()
for(var/datum/omni_port/P in ports)
if(P.network == reference)
results += P.air
return results
if(!P.parent)
P.parent = new /datum/pipeline()
P.parent.build_pipeline(src)
/obj/machinery/atmospherics/omni/disconnect(obj/machinery/atmospherics/reference)
for(var/datum/omni_port/P in ports)
if(reference == P.node)
qdel(P.network)
if(istype(P.node, /obj/machinery/atmospherics/pipe))
qdel(P.parent)
P.node = null
P.update = 1
break
update_ports()
/obj/machinery/atmospherics/omni/nullifyPipenet(datum/pipeline/P)
..()
for(var/datum/omni_port/PO in ports)
if(P == PO.parent)
PO.parent.other_airs -= PO.air
PO.parent = null
/obj/machinery/atmospherics/omni/returnPipenetAir(datum/pipeline/P)
for(var/datum/omni_port/PO in ports)
if(P == PO.parent)
return PO.air
return null
/obj/machinery/atmospherics/omni/pipeline_expansion(datum/pipeline/P)
if(P)
for(var/datum/omni_port/PO in ports)
if(PO.parent == P)
return list(PO.node)
else
var/list/nodes = list()
for(var/datum/omni_port/PO in ports)
nodes += PO.node
return nodes
/obj/machinery/atmospherics/omni/setPipenet(datum/pipeline/P, obj/machinery/atmospherics/A)
for(var/datum/omni_port/PO in ports)
if(A == PO.node)
PO.parent = P
/obj/machinery/atmospherics/omni/returnPipenet(obj/machinery/atmospherics/A)
for(var/datum/omni_port/P in ports)
if(A == P.node)
return P.parent
/obj/machinery/atmospherics/omni/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
for(var/datum/omni_port/P in ports)
if(Old == P.parent)
P.parent = New
@@ -1,158 +0,0 @@
/obj/machinery/atmospherics/portables_connector
icon = 'icons/atmos/connector.dmi'
icon_state = "map_connector"
name = "Connector Port"
desc = "For connecting portables devices related to atmospherics control."
dir = SOUTH
initialize_directions = SOUTH
var/obj/machinery/portable_atmospherics/connected_device
var/obj/machinery/atmospherics/node
var/datum/pipe_network/network
var/on = 0
use_power = 0
level = 1
/obj/machinery/atmospherics/portables_connector/New()
initialize_directions = dir
..()
/obj/machinery/atmospherics/portables_connector/update_icon()
icon_state = "connector"
/obj/machinery/atmospherics/portables_connector/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
add_underlay(T, node, dir)
/obj/machinery/atmospherics/portables_connector/hide(var/i)
update_underlays()
/obj/machinery/atmospherics/portables_connector/process()
..()
if(!on)
return
if(!connected_device)
on = 0
return
if(network)
network.update = 1
return 1
// Housekeeping and pipe network stuff below
/obj/machinery/atmospherics/portables_connector/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
new_network.normal_members += src
return null
/obj/machinery/atmospherics/portables_connector/Destroy()
loc = null
if(connected_device)
connected_device.disconnect()
if(node)
node.disconnect(src)
qdel(network)
node = null
return ..()
/obj/machinery/atmospherics/portables_connector/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()
/obj/machinery/atmospherics/portables_connector/build_network()
if(!network && node)
network = new /datum/pipe_network()
network.normal_members += src
network.build_network(node, src)
/obj/machinery/atmospherics/portables_connector/return_network(obj/machinery/atmospherics/reference)
build_network()
if(reference==node)
return network
if(reference==connected_device)
return network
return null
/obj/machinery/atmospherics/portables_connector/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
if(network == old_network)
network = new_network
return 1
/obj/machinery/atmospherics/portables_connector/return_network_air(datum/pipe_network/reference)
var/list/results = list()
if(connected_device)
results += connected_device.air_contents
return results
/obj/machinery/atmospherics/portables_connector/disconnect(obj/machinery/atmospherics/reference)
if(reference==node)
qdel(network)
node = null
update_underlays()
return null
/obj/machinery/atmospherics/portables_connector/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (connected_device)
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 << "<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, target = src))
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)
@@ -4,7 +4,9 @@
density = 0
level = 1
name = "Gas filter"
can_unwrench = 1
name = "gas filter"
var/temp = null // -- TLE
@@ -23,6 +25,10 @@ Filter types:
var/frequency = 0
var/datum/radio_frequency/radio_connection
/obj/machinery/atmospherics/trinary/mixer/flipped
icon_state = "mmap"
flipped = 1
/obj/machinery/atmospherics/trinary/filter/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
@@ -31,7 +37,7 @@ Filter types:
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
/obj/machinery/atmospherics/trinary/filter/update_icon()
if(istype(src, /obj/machinery/atmospherics/trinary/filter/m_filter))
if(flipped)
icon_state = "m"
else
icon_state = ""
@@ -53,16 +59,13 @@ Filter types:
add_underlay(T, node1, turn(dir, -180))
if(istype(src, /obj/machinery/atmospherics/trinary/filter/m_filter))
if(flipped)
add_underlay(T, node2, turn(dir, 90))
else
add_underlay(T, node2, turn(dir, -90))
add_underlay(T, node3, dir)
/obj/machinery/atmospherics/trinary/filter/hide(var/i)
update_underlays()
/obj/machinery/atmospherics/trinary/filter/power_change()
var/old_stat = stat
..()
@@ -135,14 +138,11 @@ Filter types:
air2.merge(filtered_out)
air3.merge(removed)
if(network2)
network2.update = 1
parent2.update = 1
if(network3)
network3.update = 1
parent3.update = 1
if(network1)
network1.update = 1
parent1.update = 1
return 1
@@ -150,26 +150,6 @@ Filter types:
set_frequency(frequency)
..()
/obj/machinery/atmospherics/trinary/filter/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
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(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40, target = src))
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)
/obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE
if(..())
return
@@ -225,7 +205,7 @@ Filter types:
/obj/machinery/atmospherics/trinary/filter/Topic(href, href_list) // -- TLE
if(..())
return
return 1
usr.set_machine(src)
src.add_fingerprint(usr)
if(href_list["filterset"])
@@ -245,48 +225,4 @@ Filter types:
src.attack_hand(M)
*/
return
/obj/machinery/atmospherics/trinary/filter/m_filter
icon_state = "mmap"
dir = SOUTH
initialize_directions = SOUTH|NORTH|EAST
obj/machinery/atmospherics/trinary/filter/m_filter/New()
..()
switch(dir)
if(NORTH)
initialize_directions = WEST|NORTH|SOUTH
if(SOUTH)
initialize_directions = SOUTH|EAST|NORTH
if(EAST)
initialize_directions = EAST|WEST|NORTH
if(WEST)
initialize_directions = WEST|SOUTH|EAST
/obj/machinery/atmospherics/trinary/filter/m_filter/initialize()
set_frequency(frequency)
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()
@@ -4,20 +4,24 @@
density = 0
level = 1
name = "Gas mixer"
can_unwrench = 1
name = "gas mixer"
var/target_pressure = ONE_ATMOSPHERE
var/node1_concentration = 0.5
var/node2_concentration = 0.5
//node 3 is the outlet, nodes 1 & 2 are intakes
/obj/machinery/atmospherics/trinary/mixer/flipped
icon_state = "mmap"
flipped = 1
/obj/machinery/atmospherics/trinary/mixer/update_icon(var/safety = 0)
if(istype(src, /obj/machinery/atmospherics/trinary/mixer/m_mixer))
icon_state = "m"
else if(istype(src, /obj/machinery/atmospherics/trinary/mixer/t_mixer))
icon_state = "t"
else
if(flipped)
icon_state = "m"
else
icon_state = ""
if(!powered())
@@ -35,21 +39,18 @@
if(!istype(T))
return
if(istype(src, /obj/machinery/atmospherics/trinary/mixer/t_mixer))
if(flipped)
add_underlay(T, node1, turn(dir, -90))
else
add_underlay(T, node1, turn(dir, -180))
if(istype(src, /obj/machinery/atmospherics/trinary/mixer/m_mixer) || istype(src, /obj/machinery/atmospherics/trinary/mixer/t_mixer))
if(flipped)
add_underlay(T, node2, turn(dir, 90))
else
add_underlay(T, node2, turn(dir, -90))
add_underlay(T, node3, dir)
/obj/machinery/atmospherics/trinary/mixer/hide(var/i)
update_underlays()
/obj/machinery/atmospherics/trinary/mixer/power_change()
var/old_stat = stat
..()
@@ -103,36 +104,16 @@
var/datum/gas_mixture/removed2 = air2.remove(transfer_moles2)
air3.merge(removed2)
if(network1 && transfer_moles1)
network1.update = 1
if(transfer_moles1)
parent1.update = 1
if(network2 && transfer_moles2)
network2.update = 1
if(transfer_moles2)
parent2.update = 1
if(network3)
network3.update = 1
parent3.update = 1
return 1
/obj/machinery/atmospherics/trinary/mixer/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
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(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40, target = src))
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)
/obj/machinery/atmospherics/trinary/mixer/attack_hand(user as mob)
if(..())
return
@@ -165,7 +146,8 @@
return
/obj/machinery/atmospherics/trinary/mixer/Topic(href,href_list)
if(..()) return
if(..())
return 1
if(href_list["power"])
on = !on
if(href_list["set_press"])
@@ -182,93 +164,3 @@
src.update_icon()
src.updateUsrDialog()
return
/obj/machinery/atmospherics/trinary/mixer/t_mixer
icon_state = "tmap"
dir = SOUTH
initialize_directions = SOUTH|EAST|WEST
//node 3 is the outlet, nodes 1 & 2 are intakes
/obj/machinery/atmospherics/trinary/mixer/t_mixer/New()
..()
switch(dir)
if(NORTH)
initialize_directions = EAST|NORTH|WEST
if(SOUTH)
initialize_directions = SOUTH|WEST|EAST
if(EAST)
initialize_directions = EAST|NORTH|SOUTH
if(WEST)
initialize_directions = WEST|NORTH|SOUTH
/obj/machinery/atmospherics/trinary/mixer/t_mixer/initialize()
if(node1 && node2 && node3) return
var/node1_connect = turn(dir, -90)
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/mixer/m_mixer
icon_state = "mmap"
dir = SOUTH
initialize_directions = SOUTH|NORTH|EAST
//node 3 is the outlet, nodes 1 & 2 are intakes
/obj/machinery/atmospherics/trinary/mixer/m_mixer/New()
..()
switch(dir)
if(NORTH)
initialize_directions = WEST|NORTH|SOUTH
if(SOUTH)
initialize_directions = SOUTH|EAST|NORTH
if(EAST)
initialize_directions = EAST|WEST|NORTH
if(WEST)
initialize_directions = WEST|SOUTH|EAST
/obj/machinery/atmospherics/trinary/mixer/m_mixer/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()
@@ -13,9 +13,11 @@
var/obj/machinery/atmospherics/node2
var/obj/machinery/atmospherics/node3
var/datum/pipe_network/network1
var/datum/pipe_network/network2
var/datum/pipe_network/network3
var/datum/pipeline/parent1
var/datum/pipeline/parent2
var/datum/pipeline/parent3
var/flipped = 0
/obj/machinery/atmospherics/trinary/New()
..()
@@ -37,49 +39,41 @@
air3.volume = 200
/obj/machinery/atmospherics/trinary/Destroy()
loc = null
if(node1)
node1.disconnect(src)
qdel(network1)
node1 = null
nullifyPipenet(parent1)
if(node2)
node2.disconnect(src)
qdel(network2)
node2 = null
nullifyPipenet(parent2)
if(node3)
node3.disconnect(src)
qdel(network3)
node1 = null
node2 = null
node3 = null
node3 = null
nullifyPipenet(parent3)
return ..()
// Housekeeping and pipe network stuff below
/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 == node3)
network3 = new_network
if(new_network.normal_members.Find(src))
return 0
new_network.normal_members += src
return null
/obj/machinery/atmospherics/trinary/initialize()
if(node1 && node2 && node3) return
//Mixer:
//1 and 2 is input
//Node 3 is output
//If we flip the mixer, 1 and 3 shall exchange positions
//Filter:
//Node 1 is input
//Node 2 is filtered output
//Node 3 is rest output
//If we flip the filter, 1 and 3 shall exchange positions
var/node1_connect = turn(dir, -180)
var/node2_connect = turn(dir, -90)
var/node3_connect = dir
if(flipped)
node1_connect = turn(node1_connect, 180)
node3_connect = turn(node3_connect, 180)
for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
if(target.initialize_directions & get_dir(target,src))
node1 = target
@@ -99,71 +93,102 @@
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(!parent1)
parent1 = new /datum/pipeline()
parent1.build_pipeline(src)
if(!network2 && node2)
network2 = new /datum/pipe_network()
network2.normal_members += src
network2.build_network(node2, src)
if(!parent2)
parent2 = new /datum/pipeline()
parent2.build_pipeline(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
if(!parent3)
parent3 = new /datum/pipeline()
parent3.build_pipeline(src)
/obj/machinery/atmospherics/trinary/disconnect(obj/machinery/atmospherics/reference)
if(reference==node1)
qdel(network1)
if(reference == node1)
if(istype(node1, /obj/machinery/atmospherics/pipe))
qdel(parent1)
node1 = null
else if(reference==node2)
qdel(network2)
else if(reference == node2)
if(istype(node2, /obj/machinery/atmospherics/pipe))
qdel(parent2)
node2 = null
else if(reference==node3)
qdel(network3)
else if(reference == node3)
if(istype(node3, /obj/machinery/atmospherics/pipe))
qdel(parent3)
node3 = null
update_icon()
update_underlays()
/obj/machinery/atmospherics/trinary/nullifyPipenet(datum/pipeline/P)
..()
if(P == parent1)
parent1.other_airs -= air1
parent1 = null
else if(P == parent2)
parent2.other_airs -= air2
parent2 = null
else if(P == parent3)
parent3.other_airs -= air3
parent3 = null
return null
/obj/machinery/atmospherics/trinary/returnPipenetAir(datum/pipeline/P)
if(P == parent1)
return air1
else if(P == parent2)
return air2
else if(P == parent3)
return air3
/obj/machinery/atmospherics/trinary/pipeline_expansion(datum/pipeline/P)
if(P)
if(parent1 == P)
return list(node1)
else if(parent2 == P)
return list(node2)
else if(parent3 == P)
return list(node3)
return list(node1, node2, node3)
/obj/machinery/atmospherics/trinary/setPipenet(datum/pipeline/P, obj/machinery/atmospherics/A)
if(A == node1)
parent1 = P
else if(A == node2)
parent2 = P
else if(A == node3)
parent3 = P
/obj/machinery/atmospherics/trinary/returnPipenet(obj/machinery/atmospherics/A)
if(A == node1)
return parent1
else if(A == node2)
return parent2
else if(A == node3)
return parent3
/obj/machinery/atmospherics/trinary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
if(Old == parent1)
parent1 = New
else if(Old == parent2)
parent2 = New
else if(Old == parent3)
parent3 = New
/obj/machinery/atmospherics/trinary/unsafe_pressure_release(var/mob/user,var/pressures)
..()
var/turf/T = get_turf(src)
if(T)
//Remove the gas from air1+air2+air3 and assume it
var/datum/gas_mixture/environment = T.return_air()
var/lost = pressures*environment.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
lost += pressures*environment.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
lost += pressures*environment.volume/(air3.temperature * R_IDEAL_GAS_EQUATION)
var/shared_loss = lost/3
var/datum/gas_mixture/to_release = air1.remove(shared_loss)
to_release.merge(air2.remove(shared_loss))
to_release.merge(air3.remove(shared_loss))
T.assume_air(to_release)
air_update_turf(1)
@@ -0,0 +1,146 @@
#define TVALVE_STATE_STRAIGHT 0
#define TVALVE_STATE_SIDE 1
/obj/machinery/atmospherics/trinary/tvalve
icon = 'icons/atmos/tvalve.dmi'
icon_state = "map_tvalve0"
name = "manual switching valve"
desc = "A pipe valve"
can_unwrench = 1
level = 1
var/state = TVALVE_STATE_STRAIGHT
/obj/machinery/atmospherics/trinary/tvalve/bypass
icon_state = "map_tvalve1"
state = TVALVE_STATE_SIDE
/obj/machinery/atmospherics/trinary/tvalve/update_icon(animation)
if(animation)
flick("tvalve[src.state][!src.state]",src)
else
icon_state = "tvalve[state]"
/obj/machinery/atmospherics/trinary/tvalve/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
add_underlay(T, node1, turn(dir, -180))
add_underlay(T, node2, turn(dir, -90))
add_underlay(T, node3, dir)
/obj/machinery/atmospherics/trinary/tvalve/proc/switch_side()
if(state == TVALVE_STATE_STRAIGHT)
src.go_to_side()
else
src.go_straight()
/obj/machinery/atmospherics/trinary/tvalve/proc/go_to_side()
if(state == TVALVE_STATE_SIDE)
return 0
state = TVALVE_STATE_SIDE
update_icon()
parent1.update = 0
parent2.update = 0
parent3.update = 0
parent3.reconcile_air()
investigate_log("was set to side by [usr ? key_name(usr) : "a remote signal"]", "atmos")
return 1
/obj/machinery/atmospherics/trinary/tvalve/proc/go_straight()
if(state == TVALVE_STATE_STRAIGHT)
return 0
state = TVALVE_STATE_STRAIGHT
update_icon()
parent1.update = 0
parent2.update = 0
parent3.update = 0
parent1.reconcile_air()
investigate_log("was set to straight by [usr ? key_name(usr) : "a remote signal"]", "atmos")
return 1
/obj/machinery/atmospherics/trinary/tvalve/attack_ai(mob/user as mob)
return
/obj/machinery/atmospherics/trinary/tvalve/attack_hand(mob/user as mob)
add_fingerprint(usr)
update_icon(1)
sleep(10)
switch_side()
/obj/machinery/atmospherics/trinary/tvalve/digital // can be controlled by AI
name = "digital switching valve"
desc = "A digitally controlled valve."
icon = 'icons/atmos/digital_tvalve.dmi'
var/frequency = 0
var/id = null
var/datum/radio_frequency/radio_connection
/obj/machinery/atmospherics/trinary/tvalve/digital/bypass
icon_state = "map_tvalve1"
state = TVALVE_STATE_SIDE
/obj/machinery/atmospherics/trinary/tvalve/digital/power_change()
var/old_stat = stat
..()
if(old_stat != stat)
update_icon()
/obj/machinery/atmospherics/trinary/tvalve/digital/update_icon()
..()
if(!powered())
icon_state = "tvalvenopower"
/obj/machinery/atmospherics/trinary/tvalve/digital/attack_ai(mob/user as mob)
return src.attack_hand(user)
/obj/machinery/atmospherics/trinary/tvalve/digital/attack_hand(mob/user as mob)
if(!powered())
return
if(!src.allowed(user))
user << "<span class='alert'>Access denied.</span>"
return
..()
//Radio remote control
/obj/machinery/atmospherics/trinary/tvalve/digital/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
/obj/machinery/atmospherics/trinary/tvalve/digital/initialize()
..()
if(frequency)
set_frequency(frequency)
/obj/machinery/atmospherics/trinary/tvalve/digital/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id))
return 0
switch(signal.data["command"])
if("valve_open")
go_to_side()
if("valve_close")
go_straight()
if("valve_toggle")
switch_side()
#undef TVALVE_STATE_STRAIGHT
#undef TVALVE_STATE_SIDE
-494
View File
@@ -1,494 +0,0 @@
/obj/machinery/atmospherics/tvalve
icon = 'icons/atmos/tvalve.dmi'
icon_state = "map_tvalve0"
name = "manual switching valve"
desc = "A pipe valve"
level = 1
dir = SOUTH
initialize_directions = SOUTH|NORTH|WEST
var/state = 0 // 0 = go straight, 1 = go to side
// like a trinary component, node1 is input, node2 is side output, node3 is straight output
var/obj/machinery/atmospherics/node1
var/obj/machinery/atmospherics/node2
var/obj/machinery/atmospherics/node3
var/datum/pipe_network/network_node1
var/datum/pipe_network/network_node2
var/datum/pipe_network/network_node3
/obj/machinery/atmospherics/tvalve/bypass
icon_state = "map_tvalve1"
state = 1
/obj/machinery/atmospherics/tvalve/update_icon(animation)
if(animation)
flick("tvalve[src.state][!src.state]",src)
else
icon_state = "tvalve[state]"
/obj/machinery/atmospherics/tvalve/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
add_underlay(T, node1, turn(dir, -180))
if(istype(src, /obj/machinery/atmospherics/tvalve/mirrored))
add_underlay(T, node2, turn(dir, 90))
else
add_underlay(T, node2, turn(dir, -90))
add_underlay(T, node3, dir)
/obj/machinery/atmospherics/tvalve/hide(var/i)
update_underlays()
/obj/machinery/atmospherics/tvalve/New()
initialize_directions()
..()
/obj/machinery/atmospherics/tvalve/proc/initialize_directions()
switch(dir)
if(NORTH)
initialize_directions = SOUTH|NORTH|EAST
if(SOUTH)
initialize_directions = NORTH|SOUTH|WEST
if(EAST)
initialize_directions = WEST|EAST|SOUTH
if(WEST)
initialize_directions = EAST|WEST|NORTH
/obj/machinery/atmospherics/tvalve/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node1)
network_node1 = new_network
if(state)
network_node2 = new_network
else
network_node3 = new_network
else if(reference == node2)
network_node2 = new_network
if(state)
network_node1 = new_network
else if(reference == node3)
network_node3 = new_network
if(!state)
network_node1 = new_network
if(new_network.normal_members.Find(src))
return 0
new_network.normal_members += src
if(state)
if(reference == node1)
if(node2)
return node2.network_expand(new_network, src)
else if(reference == node2)
if(node1)
return node1.network_expand(new_network, src)
else
if(reference == node1)
if(node3)
return node3.network_expand(new_network, src)
else if(reference == node3)
if(node1)
return node1.network_expand(new_network, src)
return null
/obj/machinery/atmospherics/tvalve/Destroy()
loc = null
if(node1)
node1.disconnect(src)
qdel(network_node1)
if(node2)
node2.disconnect(src)
qdel(network_node2)
if(node3)
node3.disconnect(src)
qdel(network_node3)
node1 = null
node2 = null
node3 = null
return ..()
/obj/machinery/atmospherics/tvalve/proc/go_to_side()
if(state) return 0
state = 1
update_icon()
if(network_node1)
qdel(network_node1)
if(network_node3)
qdel(network_node3)
build_network()
if(network_node1&&network_node2)
network_node1.merge(network_node2)
network_node2 = network_node1
if(network_node1)
network_node1.update = 1
else if(network_node2)
network_node2.update = 1
return 1
/obj/machinery/atmospherics/tvalve/proc/go_straight()
if(!state)
return 0
state = 0
update_icon()
if(network_node1)
qdel(network_node1)
if(network_node2)
qdel(network_node2)
build_network()
if(network_node1&&network_node3)
network_node1.merge(network_node3)
network_node3 = network_node1
if(network_node1)
network_node1.update = 1
else if(network_node3)
network_node3.update = 1
return 1
/obj/machinery/atmospherics/tvalve/attack_ai(mob/user as mob)
return
/obj/machinery/atmospherics/tvalve/attack_hand(mob/user as mob)
src.add_fingerprint(usr)
update_icon(1)
sleep(10)
if (src.state)
src.go_straight()
else
src.go_to_side()
/obj/machinery/atmospherics/tvalve/process()
..()
. = PROCESS_KILL
//machines.Remove(src)
return
/obj/machinery/atmospherics/tvalve/initialize()
var/node1_dir
var/node2_dir
var/node3_dir
node1_dir = turn(dir, 180)
node2_dir = turn(dir, -90)
node3_dir = dir
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
for(var/obj/machinery/atmospherics/target in get_step(src,node3_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
node3 = target
break
update_icon()
update_underlays()
/obj/machinery/atmospherics/tvalve/build_network()
if(!network_node1 && node1)
network_node1 = new /datum/pipe_network()
network_node1.normal_members += src
network_node1.build_network(node1, src)
if(!network_node2 && node2)
network_node2 = new /datum/pipe_network()
network_node2.normal_members += src
network_node2.build_network(node2, src)
if(!network_node3 && node3)
network_node3 = new /datum/pipe_network()
network_node3.normal_members += src
network_node3.build_network(node3, src)
/obj/machinery/atmospherics/tvalve/return_network(obj/machinery/atmospherics/reference)
build_network()
if(reference==node1)
return network_node1
if(reference==node2)
return network_node2
if(reference==node3)
return network_node3
return null
/obj/machinery/atmospherics/tvalve/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
if(network_node1 == old_network)
network_node1 = new_network
if(network_node2 == old_network)
network_node2 = new_network
if(network_node3 == old_network)
network_node3 = new_network
return 1
/obj/machinery/atmospherics/tvalve/return_network_air(datum/network/reference)
return null
/obj/machinery/atmospherics/tvalve/disconnect(obj/machinery/atmospherics/reference)
if(reference==node1)
qdel(network_node1)
node1 = null
else if(reference==node2)
qdel(network_node2)
node2 = null
else if(reference==node3)
qdel(network_node3)
node2 = null
update_underlays()
return null
/obj/machinery/atmospherics/tvalve/digital // can be controlled by AI
name = "digital switching valve"
desc = "A digitally controlled valve."
icon = 'icons/atmos/digital_tvalve.dmi'
var/frequency = 0
var/id = null
var/datum/radio_frequency/radio_connection
/obj/machinery/atmospherics/tvalve/digital/bypass
icon_state = "map_tvalve1"
state = 1
/obj/machinery/atmospherics/tvalve/digital/power_change()
var/old_stat = stat
..()
if(old_stat != stat)
update_icon()
/obj/machinery/atmospherics/tvalve/digital/update_icon()
..()
if(!powered())
icon_state = "tvalvenopower"
/obj/machinery/atmospherics/tvalve/digital/attack_ai(mob/user as mob)
return src.attack_hand(user)
/obj/machinery/atmospherics/tvalve/digital/attack_hand(mob/user as mob)
if(!powered())
return
if(!src.allowed(user))
user << "<span class='alert'>Access denied.</span>"
return
..()
//Radio remote control
/obj/machinery/atmospherics/tvalve/digital/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
/obj/machinery/atmospherics/tvalve/digital/initialize()
..()
if(frequency)
set_frequency(frequency)
/obj/machinery/atmospherics/tvalve/digital/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id))
return 0
switch(signal.data["command"])
if("valve_open")
if(!state)
go_to_side()
if("valve_close")
if(state)
go_straight()
if("valve_toggle")
if(state)
go_straight()
else
go_to_side()
/obj/machinery/atmospherics/tvalve/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (istype(src, /obj/machinery/atmospherics/tvalve/digital))
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 << "<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, target = src))
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)
/obj/machinery/atmospherics/tvalve/mirrored
icon_state = "map_tvalvem0"
/obj/machinery/atmospherics/tvalve/mirrored/bypass
icon_state = "map_tvalvem1"
state = 1
/obj/machinery/atmospherics/tvalve/mirrored/initialize_directions()
switch(dir)
if(NORTH)
initialize_directions = SOUTH|NORTH|WEST
if(SOUTH)
initialize_directions = NORTH|SOUTH|EAST
if(EAST)
initialize_directions = WEST|EAST|NORTH
if(WEST)
initialize_directions = EAST|WEST|SOUTH
/obj/machinery/atmospherics/tvalve/mirrored/initialize()
var/node1_dir
var/node2_dir
var/node3_dir
node1_dir = turn(dir, 180)
node2_dir = turn(dir, 90)
node3_dir = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
if(target.initialize_directions & get_dir(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
if(target.initialize_directions & get_dir(target,src))
node2 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node3_dir))
if(target.initialize_directions & get_dir(target,src))
node3 = target
break
update_icon()
update_underlays()
/obj/machinery/atmospherics/tvalve/mirrored/update_icon(animation)
if(animation)
flick("tvalvem[src.state][!src.state]",src)
else
icon_state = "tvalvem[state]"
/obj/machinery/atmospherics/tvalve/mirrored/digital // can be controlled by AI
name = "digital switching valve"
desc = "A digitally controlled valve."
icon = 'icons/atmos/digital_tvalve.dmi'
var/frequency = 0
var/id = null
var/datum/radio_frequency/radio_connection
/obj/machinery/atmospherics/tvalve/mirrored/digital/bypass
icon_state = "map_tvalvem1"
state = 1
/obj/machinery/atmospherics/tvalve/mirrored/digital/power_change()
var/old_stat = stat
..()
if(old_stat != stat)
update_icon()
/obj/machinery/atmospherics/tvalve/mirrored/digital/update_icon()
..()
if(!powered())
icon_state = "tvalvemnopower"
/obj/machinery/atmospherics/tvalve/mirrored/digital/attack_ai(mob/user as mob)
return src.attack_hand(user)
/obj/machinery/atmospherics/tvalve/mirrored/digital/attack_hand(mob/user as mob)
if(!powered())
return
if(!src.allowed(user))
user << "<span class='alert'>Access denied.</span>"
return
..()
//Radio remote control -eh?
/obj/machinery/atmospherics/tvalve/mirrored/digital/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
/obj/machinery/atmospherics/tvalve/mirrored/digital/initialize()
..()
if(frequency)
set_frequency(frequency)
/obj/machinery/atmospherics/tvalve/mirrored/digital/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id))
return 0
switch(signal.data["command"])
if("valve_open")
if(!state)
go_to_side()
if("valve_close")
if(state)
go_straight()
if("valve_toggle")
if(state)
go_straight()
else
go_to_side()
@@ -1,96 +0,0 @@
/obj/machinery/atmospherics/unary
dir = SOUTH
initialize_directions = SOUTH
layer = TURF_LAYER+0.1
var/datum/gas_mixture/air_contents
var/obj/machinery/atmospherics/node
var/datum/pipe_network/network
/obj/machinery/atmospherics/unary/New()
..()
initialize_directions = dir
air_contents = new
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
/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
new_network.normal_members += src
return null
/obj/machinery/atmospherics/unary/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()
/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
update_icon()
update_underlays()
return null
@@ -1,41 +1,41 @@
/obj/machinery/atmospherics/unary/cold_sink
icon = 'icons/obj/atmospherics/cold_sink.dmi'
icon_state = "on_cool"
density = 1
use_power = 1
name = "Cold Sink"
desc = "Cools gas when connected to pipe network"
var/on = 0
var/current_temperature = T20C
var/current_heat_capacity = 50000 //totally random
/obj/machinery/atmospherics/unary/cold_sink/update_icon()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed"
on = 0
return
/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
//todo: have current temperature affected. require power to bring down current temperature again
if(abs(old_temperature-air_contents.temperature) > 1)
network.update = 1
/obj/machinery/atmospherics/unary/cold_sink
icon = 'icons/obj/atmospherics/cold_sink.dmi'
icon_state = "on_cool"
density = 1
use_power = 1
name = "cold sink"
desc = "Cools gas when connected to pipe network"
var/on = 0
var/current_temperature = T20C
var/current_heat_capacity = 50000 //totally random
/obj/machinery/atmospherics/unary/cold_sink/update_icon()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed"
on = 0
return
/obj/machinery/atmospherics/unary/cold_sink/process()
..()
if(!on)
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
//todo: have current temperature affected. require power to bring down current temperature again
if(abs(old_temperature-air_contents.temperature) > 1)
parent.update = 1
return 1
@@ -1,20 +1,20 @@
/obj/machinery/atmospherics/unary/generator_input
icon = 'icons/obj/atmospherics/heat_exchanger.dmi'
icon_state = "intact"
density = 1
name = "Generator Input"
desc = "Placeholder"
var/update_cycle
/obj/machinery/atmospherics/unary/generator_input/update_icon()
if(node)
icon_state = "intact"
else
icon_state = "exposed"
return
/obj/machinery/atmospherics/unary/generator_input/proc/return_exchange_air()
return air_contents
/obj/machinery/atmospherics/unary/generator_input
icon = 'icons/obj/atmospherics/heat_exchanger.dmi'
icon_state = "intact"
density = 1
name = "generator input"
desc = "Placeholder"
var/update_cycle
/obj/machinery/atmospherics/unary/generator_input/update_icon()
if(node)
icon_state = "intact"
else
icon_state = "exposed"
return
/obj/machinery/atmospherics/unary/generator_input/proc/return_exchange_air()
return air_contents
@@ -1,89 +1,66 @@
/obj/machinery/atmospherics/unary/heat_exchanger
icon = 'icons/obj/atmospherics/heat_exchanger.dmi'
icon_state = "intact"
density = 1
name = "Heat Exchanger"
desc = "Exchanges heat between two input gases. Setup for fast heat transfer"
var/obj/machinery/atmospherics/unary/heat_exchanger/partner = null
var/update_cycle
/obj/machinery/atmospherics/unary/heat_exchanger/update_icon()
if(node)
icon_state = "intact"
else
icon_state = "exposed"
return
/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
..()
/obj/machinery/atmospherics/unary/heat_exchanger/process()
..()
if(!partner)
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
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
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
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
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
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, target = src))
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)
/obj/machinery/atmospherics/unary/heat_exchanger
icon = 'icons/obj/atmospherics/heat_exchanger.dmi'
icon_state = "intact"
density = 1
name = "heat exchanger"
desc = "Exchanges heat between two input gases. Setup for fast heat transfer"
can_unwrench = 1
var/obj/machinery/atmospherics/unary/heat_exchanger/partner = null
var/update_cycle
/obj/machinery/atmospherics/unary/heat_exchanger/update_icon()
if(node)
icon_state = "intact"
else
icon_state = "exposed"
return
/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
..()
/obj/machinery/atmospherics/unary/heat_exchanger/process()
..()
if(!partner)
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
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
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
if(abs(old_temperature-air_contents.temperature) > 1)
parent.update = 1
if(abs(other_old_temperature-partner.air_contents.temperature) > 1)
partner.parent.update = 1
return 1
@@ -1,43 +1,43 @@
/obj/machinery/atmospherics/unary/heat_reservoir
//currently the same code as cold_sink but anticipating process() changes
icon = 'icons/obj/atmospherics/cold_sink.dmi'
icon_state = "intact_off"
density = 1
use_power = 1
name = "Heat Reservoir"
desc = "Heats gas when connected to pipe network"
var/on = 0
var/current_temperature = T20C
var/current_heat_capacity = 50000 //totally random
/obj/machinery/atmospherics/unary/heat_reservoir/update_icon()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed"
on = 0
return
/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
//todo: have current temperature affected. require power to bring up current temperature again
if(abs(old_temperature-air_contents.temperature) > 1)
network.update = 1
/obj/machinery/atmospherics/unary/heat_reservoir
//currently the same code as cold_sink but anticipating process() changes
icon = 'icons/obj/atmospherics/cold_sink.dmi'
icon_state = "intact_off"
density = 1
use_power = 1
name = "heat reservoir"
desc = "Heats gas when connected to pipe network"
var/on = 0
var/current_temperature = T20C
var/current_heat_capacity = 50000 //totally random
/obj/machinery/atmospherics/unary/heat_reservoir/update_icon()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed"
on = 0
return
/obj/machinery/atmospherics/unary/heat_reservoir/process()
..()
if(!on)
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
//todo: have current temperature affected. require power to bring up current temperature again
if(abs(old_temperature-air_contents.temperature) > 1)
parent.update = 1
return 1
@@ -1,204 +1,184 @@
/obj/machinery/atmospherics/unary/outlet_injector
icon = 'icons/atmos/injector.dmi'
icon_state = "map_injector"
use_power = 1
layer = 3
name = "Air Injector"
desc = "Has a valve and pump attached to it"
req_one_access_txt = "24;10"
var/on = 0
var/injecting = 0
var/volume_rate = 50
var/frequency = 0
var/id
var/id_tag = null
var/datum/radio_frequency/radio_connection
Mtoollink = 1
settagwhitelist = list("id_tag")
level = 1
/obj/machinery/atmospherics/unary/outlet_injector/New()
..()
if(id && !id_tag)//I'm not dealing with any more merge conflicts
id_tag = id
/obj/machinery/atmospherics/unary/outlet_injector/on
on = 1
/obj/machinery/atmospherics/unary/outlet_injector/update_icon()
if(!powered())
icon_state = "off"
else
icon_state = "[on ? "on" : "off"]"
/obj/machinery/atmospherics/unary/outlet_injector/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
add_underlay(T, node, dir)
/obj/machinery/atmospherics/unary/outlet_injector/power_change()
var/old_stat = stat
..()
if(old_stat != stat)
update_icon()
/obj/machinery/atmospherics/unary/outlet_injector/process()
..()
injecting = 0
if(!on || stat & NOPOWER)
return 0
if(air_contents.temperature > 0)
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
loc.assume_air(removed)
air_update_turf()
if(network)
network.update = 1
return 1
/obj/machinery/atmospherics/unary/outlet_injector/proc/inject()
if(on || injecting)
return 0
injecting = 1
if(air_contents.temperature > 0)
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
loc.assume_air(removed)
if(network)
network.update = 1
flick("inject", src)
/obj/machinery/atmospherics/unary/outlet_injector/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency)
/obj/machinery/atmospherics/unary/outlet_injector/proc/broadcast_status()
if(!radio_connection)
return 0
var/datum/signal/signal = new
signal.transmission_method = 1 //radio signal
signal.source = src
signal.data = list(
"tag" = id_tag,
"device" = "AO",
"power" = on,
"volume_rate" = volume_rate,
"sigtype" = "status"
)
radio_connection.post_signal(src, signal)
return 1
/obj/machinery/atmospherics/unary/outlet_injector/initialize()
..()
set_frequency(frequency)
/obj/machinery/atmospherics/unary/outlet_injector/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"] != "command"))
return 0
if(signal.data["power"] != null)
on = text2num(signal.data["power"])
if(signal.data["power_toggle"] != null)
on = !on
if(signal.data["inject"] != null)
spawn inject()
return
if(signal.data["set_volume_rate"] != null)
var/number = text2num(signal.data["set_volume_rate"])
volume_rate = between(0, number, air_contents.volume)
if(signal.data["status"])
spawn(2)
broadcast_status()
return //do not update_icon
//log_admin("DEBUG \[[world.timeofday]\]: outlet_injector/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
//return
spawn(2)
broadcast_status()
update_icon()
/*hide(var/i) //to make the little pipe section invisible, the icon changes.
if(node)
if(on)
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
else
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
else
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]exposed"
on = 0
return*/
/obj/machinery/atmospherics/unary/outlet_injector/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
return {"
<ul>
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
<li>[format_tag("ID Tag","id_tag","set_id")]</a></li>
</ul>
"}
/obj/machinery/atmospherics/unary/outlet_injector/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if(istype(W, /obj/item/device/multitool))
interact(user)
return 1
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && on)
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 << "<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, target = src))
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)
/obj/machinery/atmospherics/unary/outlet_injector/interact(mob/user as mob)
update_multitool_menu(user)
/obj/machinery/atmospherics/unary/outlet_injector/hide(var/i)
update_underlays()
/obj/machinery/atmospherics/unary/outlet_injector
icon = 'icons/atmos/injector.dmi'
icon_state = "map_injector"
use_power = 1
layer = 3
can_unwrench = 1
name = "air injector"
desc = "Has a valve and pump attached to it"
req_one_access_txt = "24;10"
var/on = 0
var/injecting = 0
var/volume_rate = 50
var/frequency = 0
var/id
var/id_tag = null
var/datum/radio_frequency/radio_connection
Mtoollink = 1
settagwhitelist = list("id_tag")
level = 1
/obj/machinery/atmospherics/unary/outlet_injector/on
on = 1
/obj/machinery/atmospherics/unary/outlet_injector/New()
..()
if(id && !id_tag)//I'm not dealing with any more merge conflicts
id_tag = id
/obj/machinery/atmospherics/unary/outlet_injector/update_icon()
if(!powered())
icon_state = "off"
else
icon_state = "[on ? "on" : "off"]"
/obj/machinery/atmospherics/unary/outlet_injector/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
add_underlay(T, node, dir)
/obj/machinery/atmospherics/unary/outlet_injector/power_change()
var/old_stat = stat
..()
if(old_stat != stat)
update_icon()
/obj/machinery/atmospherics/unary/outlet_injector/process()
..()
injecting = 0
if(!on || stat & NOPOWER)
return 0
if(air_contents.temperature > 0)
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
loc.assume_air(removed)
air_update_turf()
parent.update = 1
return 1
/obj/machinery/atmospherics/unary/outlet_injector/proc/inject()
if(on || injecting)
return 0
injecting = 1
if(air_contents.temperature > 0)
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
loc.assume_air(removed)
parent.update = 1
flick("inject", src)
/obj/machinery/atmospherics/unary/outlet_injector/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency)
/obj/machinery/atmospherics/unary/outlet_injector/proc/broadcast_status()
if(!radio_connection)
return 0
var/datum/signal/signal = new
signal.transmission_method = 1 //radio signal
signal.source = src
signal.data = list(
"tag" = id_tag,
"device" = "AO",
"power" = on,
"volume_rate" = volume_rate,
"sigtype" = "status"
)
radio_connection.post_signal(src, signal)
return 1
/obj/machinery/atmospherics/unary/outlet_injector/initialize()
..()
set_frequency(frequency)
/obj/machinery/atmospherics/unary/outlet_injector/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"] != "command"))
return 0
if(signal.data["power"] != null)
on = text2num(signal.data["power"])
if(signal.data["power_toggle"] != null)
on = !on
if(signal.data["inject"] != null)
spawn inject()
return
if(signal.data["set_volume_rate"] != null)
var/number = text2num(signal.data["set_volume_rate"])
volume_rate = between(0, number, air_contents.volume)
if(signal.data["status"])
spawn(2)
broadcast_status()
return //do not update_icon
//log_admin("DEBUG \[[world.timeofday]\]: outlet_injector/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
//return
spawn(2)
broadcast_status()
update_icon()
/*hide(var/i) //to make the little pipe section invisible, the icon changes.
if(node)
if(on)
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
else
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
else
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]exposed"
on = 0
return*/
/obj/machinery/atmospherics/unary/outlet_injector/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
return {"
<ul>
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
<li>[format_tag("ID Tag","id_tag","set_id")]</a></li>
</ul>
"}
/obj/machinery/atmospherics/unary/outlet_injector/attackby(obj/item/weapon/W, mob/user)
if(istype(W, /obj/item/device/multitool))
interact(user)
return 1
if(istype(W, /obj/item/weapon/wrench))
if (!(stat & NOPOWER) && on)
user << "<span class='danger'>You cannot unwrench this [src], turn if off first.</span>"
return 1
return ..()
/obj/machinery/atmospherics/unary/outlet_injector/interact(mob/user as mob)
update_multitool_menu(user)
/obj/machinery/atmospherics/unary/outlet_injector/hide(var/i)
update_underlays()
@@ -1,49 +1,48 @@
/obj/machinery/atmospherics/unary/oxygen_generator
icon = 'icons/obj/atmospherics/oxygen_generator.dmi'
icon_state = "intact_off"
density = 1
name = "Oxygen Generator"
desc = ""
dir = SOUTH
initialize_directions = SOUTH
var/on = 0
var/oxygen_content = 10
/obj/machinery/atmospherics/unary/oxygen_generator/update_icon()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed_off"
on = 0
return
/obj/machinery/atmospherics/unary/oxygen_generator/New()
..()
air_contents.volume = 50
/obj/machinery/atmospherics/unary/oxygen_generator/process()
..()
if(!on)
return 0
var/total_moles = air_contents.total_moles()
if(total_moles < oxygen_content)
var/current_heat_capacity = air_contents.heat_capacity()
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
if(network)
network.update = 1
/obj/machinery/atmospherics/unary/oxygen_generator
icon = 'icons/obj/atmospherics/oxygen_generator.dmi'
icon_state = "intact_off"
density = 1
name = "oxygen generator"
desc = ""
dir = SOUTH
initialize_directions = SOUTH
var/on = 0
var/oxygen_content = 10
/obj/machinery/atmospherics/unary/oxygen_generator/update_icon()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed_off"
on = 0
return
/obj/machinery/atmospherics/unary/oxygen_generator/New()
..()
air_contents.volume = 50
/obj/machinery/atmospherics/unary/oxygen_generator/process()
..()
if(!on)
return 0
var/total_moles = air_contents.total_moles()
if(total_moles < oxygen_content)
var/current_heat_capacity = air_contents.heat_capacity()
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
parent.update = 1
return 1
@@ -0,0 +1,48 @@
/obj/machinery/atmospherics/unary/portables_connector
icon = 'icons/atmos/connector.dmi'
icon_state = "map_connector"
name = "connector port"
desc = "For connecting portables devices related to atmospherics control."
can_unwrench = 1
layer = 2.4
var/obj/machinery/portable_atmospherics/connected_device
var/on = 0
use_power = 0
level = 1
/obj/machinery/atmospherics/unary/portables_connector/Destroy()
if(connected_device)
connected_device.disconnect()
return ..()
/obj/machinery/atmospherics/unary/portables_connector/update_icon()
icon_state = "connector"
/obj/machinery/atmospherics/unary/portables_connector/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
add_underlay(T, node, dir)
/obj/machinery/atmospherics/unary/portables_connector/process()
if(!connected_device)
return
parent.update = 1
/obj/machinery/atmospherics/unary/portables_connector/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if(istype(W, /obj/item/weapon/wrench))
if(connected_device)
user << "<span class='danger'>You cannot unwrench this [src], detach [connected_device] first.</span>"
return 1
return ..()
/obj/machinery/atmospherics/unary/portables_connector/portableConnectorReturnAir()
return connected_device.portableConnectorReturnAir()
/obj/proc/portableConnectorReturnAir()
@@ -0,0 +1,91 @@
/obj/machinery/atmospherics/unary/tank
icon = 'icons/atmos/tank.dmi'
icon_state = "air_map"
name = "pressure tank"
desc = "A large vessel containing pressurized gas."
var/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
density = 1
/obj/machinery/atmospherics/unary/tank/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
add_underlay(T, node, dir)
/obj/machinery/atmospherics/unary/tank/air
name = "Pressure Tank (Air)"
icon_state = "air_map"
/obj/machinery/atmospherics/unary/tank/air/New()
..()
icon_state = "air"
air_contents.volume = volume
air_contents.temperature = T20C
air_contents.oxygen = (25*ONE_ATMOSPHERE*O2STANDARD)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
air_contents.nitrogen = (25*ONE_ATMOSPHERE*N2STANDARD)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
/obj/machinery/atmospherics/unary/tank/oxygen
name = "Pressure Tank (Oxygen)"
icon_state = "o2_map"
/obj/machinery/atmospherics/unary/tank/oxygen/New()
..()
icon_state = "o2"
air_contents.volume = volume
air_contents.temperature = T20C
air_contents.oxygen = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
/obj/machinery/atmospherics/unary/tank/nitrogen
name = "Pressure Tank (Nitrogen)"
icon_state = "n2_map"
/obj/machinery/atmospherics/unary/tank/nitrogen/New()
..()
icon_state = "n2"
air_contents.volume = volume
air_contents.temperature = T20C
air_contents.nitrogen = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
/obj/machinery/atmospherics/unary/tank/carbon_dioxide
name = "Pressure Tank (Carbon Dioxide)"
icon_state = "co2_map"
/obj/machinery/atmospherics/unary/tank/carbon_dioxide/New()
..()
icon_state = "co2"
air_contents.volume = volume
air_contents.temperature = T20C
air_contents.carbon_dioxide = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
/obj/machinery/atmospherics/unary/tank/toxins
name = "Pressure Tank (Toxins)"
icon_state = "toxins_map"
/obj/machinery/atmospherics/unary/tank/toxins/New()
..()
icon_state = "toxins"
air_contents.volume = volume
air_contents.temperature = T20C
air_contents.toxins = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
/obj/machinery/atmospherics/unary/tank/nitrous_oxide
name = "Pressure Tank (Nitrous Oxide)"
icon_state = "n2o_map"
/obj/machinery/atmospherics/unary/tank/nitrous_oxide/New()
..()
icon_state = "n2o"
air_contents.volume = volume
air_contents.temperature = T20C
var/datum/gas/sleeping_agent/trace_gas = new
trace_gas.moles = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
air_contents.trace_gases += trace_gas
@@ -4,10 +4,11 @@
/obj/machinery/atmospherics/unary/thermal_plate
//Based off Heat Reservoir and Space Heater
//Transfers heat between a pipe system and environment, based on which has a greater thermal energy concentration
icon = 'icons/obj/atmospherics/cold_sink.dmi'
icon_state = "off"
level = 1
can_unwrench = 1
name = "Thermal Transfer Plate"
desc = "Transfers heat to and from an area"
@@ -56,41 +57,10 @@
internal_removed.temperature = final_temperature
air_contents.merge(internal_removed)
network.update = 1
parent.update = 1
return 1
/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
/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, target = src))
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)
/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)
@@ -106,7 +76,6 @@
internal_removed.temperature = final_temperature
air_contents.merge(internal_removed)
if (network)
network.update = 1
parent.update = 1
return 1
@@ -0,0 +1,97 @@
/obj/machinery/atmospherics/unary
dir = SOUTH
initialize_directions = SOUTH
layer = TURF_LAYER+0.1
var/datum/gas_mixture/air_contents
var/obj/machinery/atmospherics/node
var/datum/pipeline/parent
/obj/machinery/atmospherics/unary/New()
..()
initialize_directions = dir
air_contents = new
air_contents.volume = 200
/obj/machinery/atmospherics/unary/Destroy()
if(node)
node.disconnect(src)
node = null
nullifyPipenet(parent)
return ..()
/obj/machinery/atmospherics/unary/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
update_icon()
update_underlays()
/obj/machinery/atmospherics/unary/default_change_direction_wrench(mob/user, obj/item/weapon/wrench/W)
if(..())
initialize_directions = dir
if(node)
node.disconnect(src)
node = null
nullifyPipenet(parent)
initialize()
if(node)
node.initialize()
node.addMember(src)
build_network()
. = 1
/obj/machinery/atmospherics/unary/build_network()
if(!parent)
parent = new /datum/pipeline()
parent.build_pipeline(src)
/obj/machinery/atmospherics/unary/disconnect(obj/machinery/atmospherics/reference)
if(reference == node)
if(istype(node, /obj/machinery/atmospherics/pipe))
qdel(parent)
node = null
update_icon()
/obj/machinery/atmospherics/unary/nullifyPipenet(datum/pipeline/P)
..()
parent.other_airs -= air_contents
parent = null
/obj/machinery/atmospherics/unary/returnPipenetAir()
return air_contents
/obj/machinery/atmospherics/unary/pipeline_expansion()
return list(node)
/obj/machinery/atmospherics/unary/setPipenet(datum/pipeline/P)
parent = P
/obj/machinery/atmospherics/unary/returnPipenet()
return parent
/obj/machinery/atmospherics/unary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
if(Old == parent)
parent = New
/obj/machinery/atmospherics/unary/unsafe_pressure_release(var/mob/user,var/pressures)
..()
var/turf/T = get_turf(src)
if(T)
//Remove the gas from air_contents and assume it
var/datum/gas_mixture/environment = T.return_air()
var/lost = pressures*environment.volume/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/to_release = air_contents.remove(lost)
T.assume_air(to_release)
air_update_turf(1)
@@ -1,425 +1,403 @@
#define EXTERNAL_PRESSURE_BOUND ONE_ATMOSPHERE
#define INTERNAL_PRESSURE_BOUND 0
#define PRESSURE_CHECKS 1
#undefine
/obj/machinery/atmospherics/unary/vent_pump
icon = 'icons/atmos/vent_pump.dmi'
icon_state = "map_vent"
name = "Air Vent"
desc = "Has a valve and pump attached to it"
use_power = 1
var/area/initial_loc
level = 1
var/area_uid
var/id_tag = null
req_one_access_txt = "24;10"
var/on = 0
var/pump_direction = 1 //0 = siphoning, 1 = releasing
var/external_pressure_bound = EXTERNAL_PRESSURE_BOUND
var/internal_pressure_bound = INTERNAL_PRESSURE_BOUND
var/pressure_checks = PRESSURE_CHECKS
//1: Do not pass external_pressure_bound
//2: Do not pass internal_pressure_bound
//3: Do not pass either
// Used when handling incoming radio signals requesting default settings
var/external_pressure_bound_default = EXTERNAL_PRESSURE_BOUND
var/internal_pressure_bound_default = INTERNAL_PRESSURE_BOUND
var/pressure_checks_default = PRESSURE_CHECKS
var/welded = 0 // Added for aliens -- TLE
var/frequency = 1439
var/datum/radio_frequency/radio_connection
Mtoollink = 1
var/advcontrol = 0//does this device listen to the AAC
var/radio_filter_out
var/radio_filter_in
connect_types = list(1,2) //connects to regular and supply pipes
/obj/machinery/atmospherics/unary/vent_pump/on
on = 1
icon_state = "map_vent_out"
/obj/machinery/atmospherics/unary/vent_pump/siphon
pump_direction = 0
/obj/machinery/atmospherics/unary/vent_pump/siphon/on
on = 1
icon_state = "map_vent_in"
/obj/machinery/atmospherics/unary/vent_pump/New()
icon = null
initial_loc = get_area(loc)
area_uid = initial_loc.uid
if (!id_tag)
assign_uid()
id_tag = num2text(uid)
..()
/obj/machinery/atmospherics/unary/vent_pump/high_volume
name = "Large Air Vent"
power_channel = EQUIP
/obj/machinery/atmospherics/unary/vent_pump/high_volume/New()
..()
air_contents.volume = 1000
/obj/machinery/atmospherics/unary/vent_pump/update_icon(var/safety = 0)
if(!check_icon_cache())
return
overlays.Cut()
var/vent_icon = "vent"
var/turf/T = get_turf(src)
if(!istype(T))
return
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
vent_icon += "h"
if(welded)
vent_icon += "weld"
else if(!powered())
vent_icon += "off"
else
vent_icon += "[on ? "[pump_direction ? "out" : "in"]" : "off"]"
overlays += icon_manager.get_atmos_icon("device", , , vent_icon)
/obj/machinery/atmospherics/unary/vent_pump/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
return
else
if(node)
add_underlay(T, node, dir, node.icon_connect_type)
else
add_underlay(T,, dir)
/obj/machinery/atmospherics/unary/vent_pump/hide()
update_icon()
update_underlays()
/obj/machinery/atmospherics/unary/vent_pump/process()
..()
if(stat & (NOPOWER|BROKEN))
return
if (!node)
on = 0
//broadcast_status() // from now air alarm/control computer should request update purposely --rastaf0
if(!on)
return 0
if(welded)
return 0
var/datum/gas_mixture/environment = loc.return_air()
var/environment_pressure = environment.return_pressure()
if(pump_direction) //internal -> external
var/pressure_delta = 10000
if(pressure_checks&1)
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
if(pressure_checks&2)
pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound))
if(pressure_delta > 0.5)
if(air_contents.temperature > 0)
var/transfer_moles = pressure_delta*environment.volume/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
loc.assume_air(removed)
air_update_turf()
if(network)
network.update = 1
else //external -> internal
var/pressure_delta = 10000
if(pressure_checks&1)
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
if(pressure_checks&2)
pressure_delta = min(pressure_delta, (internal_pressure_bound - air_contents.return_pressure()))
if(pressure_delta > 0.5)
if(environment.temperature > 0)
var/transfer_moles = pressure_delta*air_contents.volume/(environment.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
if (isnull(removed)) //in space
return
air_contents.merge(removed)
air_update_turf()
if(network)
network.update = 1
return 1
//Radio remote control
/obj/machinery/atmospherics/unary/vent_pump/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency,radio_filter_in)
if(frequency != 1439)
initial_loc.air_vent_info -= id_tag
initial_loc.air_vent_names -= id_tag
name = "Vent Pump"
else
broadcast_status()
/obj/machinery/atmospherics/unary/vent_pump/proc/broadcast_status()
if(!radio_connection)
return 0
var/datum/signal/signal = new
signal.transmission_method = 1 //radio signal
signal.source = src
signal.data = list(
"area" = src.area_uid,
"tag" = src.id_tag,
"device" = "AVP",
"power" = on,
"direction" = pump_direction?("release"):("siphon"),
"checks" = pressure_checks,
"internal" = internal_pressure_bound,
"external" = external_pressure_bound,
"timestamp" = world.time,
"sigtype" = "status"
)
if(frequency == 1439)//We're on the frequency the air alarms and stuff use
if(!initial_loc.air_vent_names[id_tag])
var/new_name = "[initial_loc.name] Vent Pump #[initial_loc.air_vent_names.len+1]"
initial_loc.air_vent_names[id_tag] = new_name
src.name = new_name
initial_loc.air_vent_info[id_tag] = signal.data
radio_connection.post_signal(src, signal, radio_filter_out)
return 1
/obj/machinery/atmospherics/unary/vent_pump/initialize()
..()
//some vents work his own special way
radio_filter_in = frequency==1439?(RADIO_FROM_AIRALARM):null
radio_filter_out = frequency==1439?(RADIO_TO_AIRALARM):null
if(frequency)
set_frequency(frequency)
src.broadcast_status()
/obj/machinery/atmospherics/unary/vent_pump/receive_signal(datum/signal/signal)
if(stat & (NOPOWER|BROKEN))
return
//log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/unary/vent_pump/receive_signal([signal.debug_print()])")
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command") || (signal.data["advcontrol"] && !advcontrol))
return 0
if(signal.data["purge"] != null)
pressure_checks &= ~1
pump_direction = 0
if(signal.data["stabilize"] != null)
pressure_checks |= 1
pump_direction = 1
if(signal.data["power"] != null)
on = text2num(signal.data["power"])
if(signal.data["power_toggle"] != null)
on = !on
if(signal.data["checks"] != null)
if (signal.data["checks"] == "default")
pressure_checks = pressure_checks_default
else
pressure_checks = text2num(signal.data["checks"])
if(signal.data["checks_toggle"] != null)
pressure_checks = (pressure_checks?0:3)
if(signal.data["direction"] != null)
pump_direction = text2num(signal.data["direction"])
if(signal.data["set_internal_pressure"] != null)
if (signal.data["set_internal_pressure"] == "default")
internal_pressure_bound = internal_pressure_bound_default
else
internal_pressure_bound = between(
0,
text2num(signal.data["set_internal_pressure"]),
ONE_ATMOSPHERE*50
)
if(signal.data["set_external_pressure"] != null)
if (signal.data["set_external_pressure"] == "default")
external_pressure_bound = external_pressure_bound_default
else
external_pressure_bound = between(
0,
text2num(signal.data["set_external_pressure"]),
ONE_ATMOSPHERE*50
)
if(signal.data["adjust_internal_pressure"] != null)
internal_pressure_bound = between(
0,
internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),
ONE_ATMOSPHERE*50
)
if(signal.data["adjust_external_pressure"] != null)
external_pressure_bound = between(
0,
external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),
ONE_ATMOSPHERE*50
)
if(signal.data["init"] != null)
name = signal.data["init"]
return
if(signal.data["status"] != null)
spawn(2)
broadcast_status()
return //do not update_icon
//log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
spawn(2)
broadcast_status()
update_icon()
return
/obj/machinery/atmospherics/unary/vent_pump/can_crawl_through()
return !welded
/obj/machinery/atmospherics/unary/vent_pump/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if (WT.remove_fuel(0,user))
user << "<span class='notice'>Now welding the vent.</span>"
if(do_after(user, 20, target = src))
if(!src || !WT.isOn()) return
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
if(!welded)
user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
welded = 1
update_icon()
else
user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.")
welded = 0
update_icon()
else
user << "<span class='notice'>The welding tool needs to be on to start this task.</span>"
else
user << "<span class='notice'>You need more welding fuel to complete this task.</span>"
return 1
else if(istype(W, /obj/item/device/multitool))
update_multitool_menu(user)
return 1
else
..()
/obj/machinery/atmospherics/unary/vent_pump/examine(mob/user)
..(user)
if(welded)
user << "It seems welded shut."
/obj/machinery/atmospherics/unary/vent_pump/power_change()
var/old_stat = stat
..()
if(old_stat != stat)
update_icon()
/obj/machinery/atmospherics/unary/vent_pump/interact(mob/user as mob)
update_multitool_menu(user)
/obj/machinery/atmospherics/unary/vent_pump/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
return {"
<ul>
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
<li>[format_tag("ID Tag","id_tag","set_id")]</li>
<li><b>AAC Acces:</b> <a href="?src=\ref[src];toggleadvcontrol=1">[advcontrol ? "Allowed" : "Blocked"]</a>
</ul>
"}
/obj/machinery/atmospherics/unary/vent_pump/multitool_topic(var/mob/user, var/list/href_list, var/obj/O)
if("toggleadvcontrol" in href_list)
advcontrol = !advcontrol
return MT_UPDATE
if("set_id" in href_list)
var/newid = copytext(reject_bad_text(input(usr, "Specify the new ID tag for this machine", src, src.id_tag) as null|text), 1, MAX_MESSAGE_LEN)
if(!newid)
return
if(frequency == 1439)
initial_loc.air_vent_info -= id_tag
initial_loc.air_vent_names -= id_tag
id_tag = newid
broadcast_status()
return MT_UPDATE
return ..()
/obj/machinery/atmospherics/unary/vent_pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if (istype(W, /obj/item/device/multitool))
update_multitool_menu(user)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && on)
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 << "<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(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40, target = src))
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)
/obj/machinery/atmospherics/unary/vent_pump/Destroy()
if(initial_loc)
initial_loc.air_vent_info -= id_tag
initial_loc.air_vent_names -= id_tag
return ..()
#define EXTERNAL_PRESSURE_BOUND ONE_ATMOSPHERE
#define INTERNAL_PRESSURE_BOUND 0
#define PRESSURE_CHECKS 1
#undefine
/obj/machinery/atmospherics/unary/vent_pump
icon = 'icons/atmos/vent_pump.dmi'
icon_state = "map_vent"
name = "Air Vent"
desc = "Has a valve and pump attached to it"
use_power = 1
can_unwrench = 1
var/area/initial_loc
level = 1
var/area_uid
var/id_tag = null
req_one_access_txt = "24;10"
var/on = 0
var/pump_direction = 1 //0 = siphoning, 1 = releasing
var/external_pressure_bound = EXTERNAL_PRESSURE_BOUND
var/internal_pressure_bound = INTERNAL_PRESSURE_BOUND
var/pressure_checks = PRESSURE_CHECKS
//1: Do not pass external_pressure_bound
//2: Do not pass internal_pressure_bound
//3: Do not pass either
// Used when handling incoming radio signals requesting default settings
var/external_pressure_bound_default = EXTERNAL_PRESSURE_BOUND
var/internal_pressure_bound_default = INTERNAL_PRESSURE_BOUND
var/pressure_checks_default = PRESSURE_CHECKS
var/welded = 0 // Added for aliens -- TLE
var/frequency = 1439
var/datum/radio_frequency/radio_connection
Mtoollink = 1
var/advcontrol = 0//does this device listen to the AAC
var/radio_filter_out
var/radio_filter_in
connect_types = list(1,2) //connects to regular and supply pipes
/obj/machinery/atmospherics/unary/vent_pump/on
on = 1
icon_state = "map_vent_out"
/obj/machinery/atmospherics/unary/vent_pump/siphon
pump_direction = 0
/obj/machinery/atmospherics/unary/vent_pump/siphon/on
on = 1
icon_state = "map_vent_in"
/obj/machinery/atmospherics/unary/vent_pump/New()
icon = null
initial_loc = get_area(loc)
area_uid = initial_loc.uid
if (!id_tag)
assign_uid()
id_tag = num2text(uid)
..()
/obj/machinery/atmospherics/unary/vent_pump/high_volume
name = "Large Air Vent"
power_channel = EQUIP
/obj/machinery/atmospherics/unary/vent_pump/high_volume/New()
..()
air_contents.volume = 1000
/obj/machinery/atmospherics/unary/vent_pump/update_icon(var/safety = 0)
if(!check_icon_cache())
return
overlays.Cut()
var/vent_icon = "vent"
var/turf/T = get_turf(src)
if(!istype(T))
return
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
vent_icon += "h"
if(welded)
vent_icon += "weld"
else if(!powered())
vent_icon += "off"
else
vent_icon += "[on ? "[pump_direction ? "out" : "in"]" : "off"]"
overlays += icon_manager.get_atmos_icon("device", , , vent_icon)
/obj/machinery/atmospherics/unary/vent_pump/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
return
else
if(node)
add_underlay(T, node, dir, node.icon_connect_type)
else
add_underlay(T,, dir)
/obj/machinery/atmospherics/unary/vent_pump/hide()
update_icon()
update_underlays()
/obj/machinery/atmospherics/unary/vent_pump/process()
..()
if(stat & (NOPOWER|BROKEN))
return
if (!node)
on = 0
//broadcast_status() // from now air alarm/control computer should request update purposely --rastaf0
if(!on)
return 0
if(welded)
return 0
var/datum/gas_mixture/environment = loc.return_air()
var/environment_pressure = environment.return_pressure()
if(pump_direction) //internal -> external
var/pressure_delta = 10000
if(pressure_checks&1)
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
if(pressure_checks&2)
pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound))
if(pressure_delta > 0.5)
if(air_contents.temperature > 0)
var/transfer_moles = pressure_delta*environment.volume/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
loc.assume_air(removed)
air_update_turf()
parent.update = 1
else //external -> internal
var/pressure_delta = 10000
if(pressure_checks&1)
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
if(pressure_checks&2)
pressure_delta = min(pressure_delta, (internal_pressure_bound - air_contents.return_pressure()))
if(pressure_delta > 0.5)
if(environment.temperature > 0)
var/transfer_moles = pressure_delta*air_contents.volume/(environment.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
if (isnull(removed)) //in space
return
air_contents.merge(removed)
air_update_turf()
parent.update = 1
return 1
//Radio remote control
/obj/machinery/atmospherics/unary/vent_pump/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency,radio_filter_in)
if(frequency != 1439)
initial_loc.air_vent_info -= id_tag
initial_loc.air_vent_names -= id_tag
name = "Vent Pump"
else
broadcast_status()
/obj/machinery/atmospherics/unary/vent_pump/proc/broadcast_status()
if(!radio_connection)
return 0
var/datum/signal/signal = new
signal.transmission_method = 1 //radio signal
signal.source = src
signal.data = list(
"area" = src.area_uid,
"tag" = src.id_tag,
"device" = "AVP",
"power" = on,
"direction" = pump_direction?("release"):("siphon"),
"checks" = pressure_checks,
"internal" = internal_pressure_bound,
"external" = external_pressure_bound,
"timestamp" = world.time,
"sigtype" = "status"
)
if(frequency == 1439)//We're on the frequency the air alarms and stuff use
if(!initial_loc.air_vent_names[id_tag])
var/new_name = "[initial_loc.name] Vent Pump #[initial_loc.air_vent_names.len+1]"
initial_loc.air_vent_names[id_tag] = new_name
src.name = new_name
initial_loc.air_vent_info[id_tag] = signal.data
radio_connection.post_signal(src, signal, radio_filter_out)
return 1
/obj/machinery/atmospherics/unary/vent_pump/initialize()
..()
//some vents work his own special way
radio_filter_in = frequency==1439?(RADIO_FROM_AIRALARM):null
radio_filter_out = frequency==1439?(RADIO_TO_AIRALARM):null
if(frequency)
set_frequency(frequency)
src.broadcast_status()
/obj/machinery/atmospherics/unary/vent_pump/receive_signal(datum/signal/signal)
if(stat & (NOPOWER|BROKEN))
return
//log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/unary/vent_pump/receive_signal([signal.debug_print()])")
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command") || (signal.data["advcontrol"] && !advcontrol))
return 0
if(signal.data["purge"] != null)
pressure_checks &= ~1
pump_direction = 0
if(signal.data["stabilize"] != null)
pressure_checks |= 1
pump_direction = 1
if(signal.data["power"] != null)
on = text2num(signal.data["power"])
if(signal.data["power_toggle"] != null)
on = !on
if(signal.data["checks"] != null)
if (signal.data["checks"] == "default")
pressure_checks = pressure_checks_default
else
pressure_checks = text2num(signal.data["checks"])
if(signal.data["checks_toggle"] != null)
pressure_checks = (pressure_checks?0:3)
if(signal.data["direction"] != null)
pump_direction = text2num(signal.data["direction"])
if(signal.data["set_internal_pressure"] != null)
if (signal.data["set_internal_pressure"] == "default")
internal_pressure_bound = internal_pressure_bound_default
else
internal_pressure_bound = between(
0,
text2num(signal.data["set_internal_pressure"]),
ONE_ATMOSPHERE*50
)
if(signal.data["set_external_pressure"] != null)
if (signal.data["set_external_pressure"] == "default")
external_pressure_bound = external_pressure_bound_default
else
external_pressure_bound = between(
0,
text2num(signal.data["set_external_pressure"]),
ONE_ATMOSPHERE*50
)
if(signal.data["adjust_internal_pressure"] != null)
internal_pressure_bound = between(
0,
internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),
ONE_ATMOSPHERE*50
)
if(signal.data["adjust_external_pressure"] != null)
external_pressure_bound = between(
0,
external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),
ONE_ATMOSPHERE*50
)
if(signal.data["init"] != null)
name = signal.data["init"]
return
if(signal.data["status"] != null)
spawn(2)
broadcast_status()
return //do not update_icon
//log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
spawn(2)
broadcast_status()
update_icon()
return
/obj/machinery/atmospherics/unary/vent_pump/can_crawl_through()
return !welded
/obj/machinery/atmospherics/unary/vent_pump/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if (WT.remove_fuel(0,user))
user << "<span class='notice'>Now welding the vent.</span>"
if(do_after(user, 20, target = src))
if(!src || !WT.isOn()) return
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
if(!welded)
user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
welded = 1
update_icon()
else
user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.")
welded = 0
update_icon()
else
user << "<span class='notice'>The welding tool needs to be on to start this task.</span>"
else
user << "<span class='notice'>You need more welding fuel to complete this task.</span>"
return 1
if(istype(W, /obj/item/device/multitool))
update_multitool_menu(user)
return 1
if (istype(W, /obj/item/weapon/wrench))
if (!(stat & NOPOWER) && on)
user << "<span class='danger'>You cannot unwrench this [src], turn it off first.</span>"
return 1
return ..()
/obj/machinery/atmospherics/unary/vent_pump/examine(mob/user)
..(user)
if(welded)
user << "It seems welded shut."
/obj/machinery/atmospherics/unary/vent_pump/power_change()
var/old_stat = stat
..()
if(old_stat != stat)
update_icon()
/obj/machinery/atmospherics/unary/vent_pump/interact(mob/user as mob)
update_multitool_menu(user)
/obj/machinery/atmospherics/unary/vent_pump/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
return {"
<ul>
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
<li>[format_tag("ID Tag","id_tag","set_id")]</li>
<li><b>AAC Acces:</b> <a href="?src=\ref[src];toggleadvcontrol=1">[advcontrol ? "Allowed" : "Blocked"]</a>
</ul>
"}
/obj/machinery/atmospherics/unary/vent_pump/multitool_topic(var/mob/user, var/list/href_list, var/obj/O)
if("toggleadvcontrol" in href_list)
advcontrol = !advcontrol
return MT_UPDATE
if("set_id" in href_list)
var/newid = copytext(reject_bad_text(input(usr, "Specify the new ID tag for this machine", src, src.id_tag) as null|text), 1, MAX_MESSAGE_LEN)
if(!newid)
return
if(frequency == 1439)
initial_loc.air_vent_info -= id_tag
initial_loc.air_vent_names -= id_tag
id_tag = newid
broadcast_status()
return MT_UPDATE
return ..()
/obj/machinery/atmospherics/unary/vent_pump/Destroy()
if(initial_loc)
initial_loc.air_vent_info -= id_tag
initial_loc.air_vent_names -= id_tag
return ..()
@@ -1,420 +1,402 @@
/obj/machinery/atmospherics/unary/vent_scrubber
icon = 'icons/atmos/vent_scrubber.dmi'
icon_state = "map_scrubber"
req_one_access_txt = "24;10"
name = "Air Scrubber"
desc = "Has a valve and pump attached to it"
use_power = 1
idle_power_usage = 10
active_power_usage = 60
level = 1
var/area/initial_loc
var/id_tag = null
var/frequency = 1439
var/datum/radio_frequency/radio_connection
var/advcontrol = 0//does this device listen to the AAC?
var/list/turf/simulated/adjacent_turfs = list()
var/on = 0
var/scrubbing = 1 //0 = siphoning, 1 = scrubbing
var/scrub_O2 = 0
var/scrub_N2 = 0
var/scrub_CO2 = 1
var/scrub_Toxins = 0
var/scrub_N2O = 0
var/volume_rate = 200
var/widenet = 0 //is this scrubber acting on the 3x3 area around it.
var/welded = 0
var/area_uid
var/radio_filter_out
var/radio_filter_in
connect_types = list(1,3) //connects to regular and scrubber pipes
/obj/machinery/atmospherics/unary/vent_scrubber/New()
icon = null
initial_loc = get_area(loc)
area_uid = initial_loc.uid
if (!id_tag)
assign_uid()
id_tag = num2text(uid)
..()
/obj/machinery/atmospherics/unary/vent_scrubber/Destroy()
if(initial_loc && frequency == 1439)
initial_loc.air_scrub_info -= id_tag
initial_loc.air_scrub_names -= id_tag
return ..()
/obj/machinery/atmospherics/unary/vent_pump/examine(mob/user)
..(user)
if(welded)
user << "It seems welded shut."
/obj/machinery/atmospherics/unary/vent_scrubber/auto_use_power()
if(!powered(power_channel))
return 0
if (!on || welded)
return 0
if(stat & (NOPOWER|BROKEN))
return 0
var/amount = idle_power_usage
if (scrubbing)
if (scrub_CO2)
amount += idle_power_usage
if (scrub_Toxins)
amount += idle_power_usage
if (scrub_N2)
amount += idle_power_usage
if (scrub_N2O)
amount += idle_power_usage
else
amount = active_power_usage
if (widenet)
amount += amount*(adjacent_turfs.len*(adjacent_turfs.len/2))
use_power(amount, power_channel)
return 1
/obj/machinery/atmospherics/unary/vent_scrubber/update_icon(var/safety = 0)
if(!check_icon_cache())
return
overlays.Cut()
var/scrubber_icon = "scrubber"
var/turf/T = get_turf(src)
if(!istype(T))
return
if(!powered())
scrubber_icon += "off"
else
scrubber_icon += "[on ? "[scrubbing ? "on" : "in"]" : "off"]"
if(welded)
scrubber_icon = "scrubberweld"
overlays += icon_manager.get_atmos_icon("device", , , scrubber_icon)
/obj/machinery/atmospherics/unary/vent_scrubber/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
return
else
if(node)
add_underlay(T, node, dir, node.icon_connect_type)
else
add_underlay(T,, dir)
/obj/machinery/atmospherics/unary/vent_scrubber/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
radio_connection = radio_controller.add_object(src, frequency, radio_filter_in)
if(frequency != 1439)
initial_loc.air_scrub_info -= id_tag
initial_loc.air_scrub_names -= id_tag
name = "air Scrubber"
else
broadcast_status()
/obj/machinery/atmospherics/unary/vent_scrubber/proc/broadcast_status()
if(!radio_connection)
return 0
var/datum/signal/signal = new
signal.transmission_method = 1 //radio signal
signal.source = src
signal.data = list(
"area" = area_uid,
"tag" = id_tag,
"device" = "AScr",
"timestamp" = world.time,
"power" = on,
"scrubbing" = scrubbing,
"widenet" = widenet,
"filter_o2" = scrub_O2,
"filter_n2" = scrub_N2,
"filter_co2" = scrub_CO2,
"filter_toxins" = scrub_Toxins,
"filter_n2o" = scrub_N2O,
"sigtype" = "status"
)
if(frequency == 1439)//We're on the frequency the air alarms and stuff use
if(!initial_loc.air_scrub_names[id_tag])
var/new_name = "[initial_loc.name] Air Scrubber #[initial_loc.air_scrub_names.len+1]"
initial_loc.air_scrub_names[id_tag] = new_name
src.name = new_name
initial_loc.air_scrub_info[id_tag] = signal.data
radio_connection.post_signal(src, signal, radio_filter_out)
return 1
/obj/machinery/atmospherics/unary/vent_scrubber/initialize()
..()
radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null
radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null
if(frequency)
set_frequency(frequency)
src.broadcast_status()
check_turfs()
/obj/machinery/atmospherics/unary/vent_scrubber/process()
..()
if (widenet)
check_turfs()
if(stat & (NOPOWER|BROKEN))
return
if (!node)
on = 0
if(welded)
return 0
//broadcast_status()
if(!on)
return 0
scrub(loc)
if (widenet)
for (var/turf/simulated/tile in adjacent_turfs)
scrub(tile)
//we populate a list of turfs with nonatmos-blocked cardinal turfs AND
// diagonal turfs that can share atmos with *both* of the cardinal turfs
/obj/machinery/atmospherics/unary/vent_scrubber/proc/check_turfs()
adjacent_turfs.Cut()
var/turf/T = loc
if (istype(T))
adjacent_turfs = T.GetAtmosAdjacentTurfs(alldir=1)
/obj/machinery/atmospherics/unary/vent_scrubber/proc/scrub(var/turf/simulated/tile)
if (!tile || !istype(tile))
return 0
var/datum/gas_mixture/environment = tile.return_air()
if(scrubbing)
if((environment.toxins>0.001) || (environment.carbon_dioxide>0.001) || (environment.trace_gases.len>0))
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
//Take a gas sample
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
if (isnull(removed)) //in space
return
//Filter it
var/datum/gas_mixture/filtered_out = new
filtered_out.temperature = removed.temperature
if(scrub_O2)
filtered_out.oxygen = removed.oxygen
removed.oxygen = 0
if(scrub_N2)
filtered_out.nitrogen = removed.nitrogen
removed.nitrogen = 0
if(scrub_Toxins)
filtered_out.toxins = removed.toxins
removed.toxins = 0
if(scrub_CO2)
filtered_out.carbon_dioxide = removed.carbon_dioxide
removed.carbon_dioxide = 0
if(removed.trace_gases.len>0)
for(var/datum/gas/trace_gas in removed.trace_gases)
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
removed.trace_gases -= trace_gas
filtered_out.trace_gases += trace_gas
else if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O)
removed.trace_gases -= trace_gas
filtered_out.trace_gases += trace_gas
//Remix the resulting gases
air_contents.merge(filtered_out)
tile.assume_air(removed)
tile.air_update_turf()
else //Just siphoning all air
if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE)
return
var/transfer_moles = environment.total_moles()*(volume_rate/environment.volume)
var/datum/gas_mixture/removed = tile.remove_air(transfer_moles)
air_contents.merge(removed)
tile.air_update_turf()
if(network)
network.update = 1
return 1
/obj/machinery/atmospherics/unary/vent_scrubber/hide(var/i) //to make the little pipe section invisible, the icon changes.
update_icon()
/obj/machinery/atmospherics/unary/vent_scrubber/receive_signal(datum/signal/signal)
if(stat & (NOPOWER|BROKEN))
return
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command") || (signal.data["advcontrol"] && !advcontrol))
return 0
if(signal.data["power"] != null)
on = text2num(signal.data["power"])
if(signal.data["power_toggle"] != null)
on = !on
if("widenet" in signal.data)
widenet = text2num(signal.data["widenet"])
if("toggle_widenet" in signal.data)
widenet = !widenet
if(signal.data["scrubbing"] != null)
scrubbing = text2num(signal.data["scrubbing"])
if(signal.data["toggle_scrubbing"])
scrubbing = !scrubbing
if(signal.data["o2_scrub"] != null)
scrub_O2 = text2num(signal.data["o2_scrub"])
if(signal.data["toggle_o2_scrub"])
scrub_O2 = !scrub_O2
if(signal.data["n2_scrub"] != null)
scrub_N2 = text2num(signal.data["n2_scrub"])
if(signal.data["toggle_n2_scrub"])
scrub_N2 = !scrub_N2
if(signal.data["co2_scrub"] != null)
scrub_CO2 = text2num(signal.data["co2_scrub"])
if(signal.data["toggle_co2_scrub"])
scrub_CO2 = !scrub_CO2
if(signal.data["tox_scrub"] != null)
scrub_Toxins = text2num(signal.data["tox_scrub"])
if(signal.data["toggle_tox_scrub"])
scrub_Toxins = !scrub_Toxins
if(signal.data["n2o_scrub"] != null)
scrub_N2O = text2num(signal.data["n2o_scrub"])
if(signal.data["toggle_n2o_scrub"])
scrub_N2O = !scrub_N2O
if(signal.data["init"] != null)
name = signal.data["init"]
return
if(signal.data["status"] != null)
spawn(2)
broadcast_status()
return //do not update_icon
spawn(2)
broadcast_status()
update_icon()
return
/obj/machinery/atmospherics/unary/vent_scrubber/power_change()
var/old_stat = stat
..()
if(old_stat != stat)
update_icon()
/obj/machinery/atmospherics/unary/vent_scrubber/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
return {"
<ul>
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
<li>[format_tag("ID Tag","id_tag", "set_id")]</li>
<li><b>AAC Acces:</b> <a href="?src=\ref[src];toggleadvcontrol=1">[advcontrol ? "Allowed" : "Blocked"]</a>
</ul>
"}
/obj/machinery/atmospherics/unary/vent_scrubber/multitool_topic(var/mob/user, var/list/href_list, var/obj/O)
if("toggleadvcontrol" in href_list)
advcontrol = !advcontrol
return MT_UPDATE
if("set_id" in href_list)
var/newid = copytext(reject_bad_text(input(usr, "Specify the new ID tag for this machine", src, src:id_tag) as null|text),1,MAX_MESSAGE_LEN)
if(!newid)
return
if(frequency == 1439)
initial_loc.air_scrub_info -= id_tag
initial_loc.air_scrub_names -= id_tag
id_tag = newid
broadcast_status()
return MT_UPDATE
return ..()
/obj/machinery/atmospherics/unary/vent_scrubber/can_crawl_through()
return !welded
/obj/machinery/atmospherics/unary/vent_scrubber/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if (WT.remove_fuel(0,user))
user << "<span class='notice'>Now welding the scrubber.</span>"
if(do_after(user, 20, target = src))
if(!src || !WT.isOn()) return
playsound(get_turf(src), 'sound/items/Welder2.ogg', 50, 1)
if(!welded)
user.visible_message("[user] welds the scrubber shut.", "You weld the vent scrubber.", "You hear welding.")
welded = 1
update_icon()
else
user.visible_message("[user] unwelds the scrubber.", "You unweld the scrubber.", "You hear welding.")
welded = 0
update_icon()
else
user << "<span class='notice'>The welding tool needs to be on to start this task.</span>"
return 1
else
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)
return 1
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && on)
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 << "<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(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40, target = src))
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)
/obj/machinery/atmospherics/unary/vent_scrubber
icon = 'icons/atmos/vent_scrubber.dmi'
icon_state = "map_scrubber"
req_one_access_txt = "24;10"
name = "Air Scrubber"
desc = "Has a valve and pump attached to it"
use_power = 1
idle_power_usage = 10
active_power_usage = 60
level = 1
can_unwrench = 1
var/area/initial_loc
var/id_tag = null
var/frequency = 1439
var/datum/radio_frequency/radio_connection
var/advcontrol = 0//does this device listen to the AAC?
var/list/turf/simulated/adjacent_turfs = list()
var/on = 0
var/scrubbing = 1 //0 = siphoning, 1 = scrubbing
var/scrub_O2 = 0
var/scrub_N2 = 0
var/scrub_CO2 = 1
var/scrub_Toxins = 0
var/scrub_N2O = 0
var/volume_rate = 200
var/widenet = 0 //is this scrubber acting on the 3x3 area around it.
var/welded = 0
var/area_uid
var/radio_filter_out
var/radio_filter_in
connect_types = list(1,3) //connects to regular and scrubber pipes
/obj/machinery/atmospherics/unary/vent_scrubber/New()
icon = null
initial_loc = get_area(loc)
area_uid = initial_loc.uid
if (!id_tag)
assign_uid()
id_tag = num2text(uid)
..()
/obj/machinery/atmospherics/unary/vent_scrubber/Destroy()
if(initial_loc && frequency == 1439)
initial_loc.air_scrub_info -= id_tag
initial_loc.air_scrub_names -= id_tag
return ..()
/obj/machinery/atmospherics/unary/vent_pump/examine(mob/user)
..(user)
if(welded)
user << "It seems welded shut."
/obj/machinery/atmospherics/unary/vent_scrubber/auto_use_power()
if(!powered(power_channel))
return 0
if (!on || welded)
return 0
if(stat & (NOPOWER|BROKEN))
return 0
var/amount = idle_power_usage
if (scrubbing)
if (scrub_CO2)
amount += idle_power_usage
if (scrub_Toxins)
amount += idle_power_usage
if (scrub_N2)
amount += idle_power_usage
if (scrub_N2O)
amount += idle_power_usage
else
amount = active_power_usage
if (widenet)
amount += amount*(adjacent_turfs.len*(adjacent_turfs.len/2))
use_power(amount, power_channel)
return 1
/obj/machinery/atmospherics/unary/vent_scrubber/update_icon(var/safety = 0)
if(!check_icon_cache())
return
overlays.Cut()
var/scrubber_icon = "scrubber"
var/turf/T = get_turf(src)
if(!istype(T))
return
if(!powered())
scrubber_icon += "off"
else
scrubber_icon += "[on ? "[scrubbing ? "on" : "in"]" : "off"]"
if(welded)
scrubber_icon = "scrubberweld"
overlays += icon_manager.get_atmos_icon("device", , , scrubber_icon)
/obj/machinery/atmospherics/unary/vent_scrubber/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
return
else
if(node)
add_underlay(T, node, dir, node.icon_connect_type)
else
add_underlay(T,, dir)
/obj/machinery/atmospherics/unary/vent_scrubber/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
radio_connection = radio_controller.add_object(src, frequency, radio_filter_in)
if(frequency != 1439)
initial_loc.air_scrub_info -= id_tag
initial_loc.air_scrub_names -= id_tag
name = "air Scrubber"
else
broadcast_status()
/obj/machinery/atmospherics/unary/vent_scrubber/proc/broadcast_status()
if(!radio_connection)
return 0
var/datum/signal/signal = new
signal.transmission_method = 1 //radio signal
signal.source = src
signal.data = list(
"area" = area_uid,
"tag" = id_tag,
"device" = "AScr",
"timestamp" = world.time,
"power" = on,
"scrubbing" = scrubbing,
"widenet" = widenet,
"filter_o2" = scrub_O2,
"filter_n2" = scrub_N2,
"filter_co2" = scrub_CO2,
"filter_toxins" = scrub_Toxins,
"filter_n2o" = scrub_N2O,
"sigtype" = "status"
)
if(frequency == 1439)//We're on the frequency the air alarms and stuff use
if(!initial_loc.air_scrub_names[id_tag])
var/new_name = "[initial_loc.name] Air Scrubber #[initial_loc.air_scrub_names.len+1]"
initial_loc.air_scrub_names[id_tag] = new_name
src.name = new_name
initial_loc.air_scrub_info[id_tag] = signal.data
radio_connection.post_signal(src, signal, radio_filter_out)
return 1
/obj/machinery/atmospherics/unary/vent_scrubber/initialize()
..()
radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null
radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null
if(frequency)
set_frequency(frequency)
src.broadcast_status()
check_turfs()
/obj/machinery/atmospherics/unary/vent_scrubber/process()
..()
if (widenet)
check_turfs()
if(stat & (NOPOWER|BROKEN))
return
if (!node)
on = 0
if(welded)
return 0
//broadcast_status()
if(!on)
return 0
scrub(loc)
if (widenet)
for (var/turf/simulated/tile in adjacent_turfs)
scrub(tile)
//we populate a list of turfs with nonatmos-blocked cardinal turfs AND
// diagonal turfs that can share atmos with *both* of the cardinal turfs
/obj/machinery/atmospherics/unary/vent_scrubber/proc/check_turfs()
adjacent_turfs.Cut()
var/turf/T = loc
if (istype(T))
adjacent_turfs = T.GetAtmosAdjacentTurfs(alldir=1)
/obj/machinery/atmospherics/unary/vent_scrubber/proc/scrub(var/turf/simulated/tile)
if (!tile || !istype(tile))
return 0
var/datum/gas_mixture/environment = tile.return_air()
if(scrubbing)
if((environment.toxins>0.001) || (environment.carbon_dioxide>0.001) || (environment.trace_gases.len>0))
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
//Take a gas sample
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
if (isnull(removed)) //in space
return
//Filter it
var/datum/gas_mixture/filtered_out = new
filtered_out.temperature = removed.temperature
if(scrub_O2)
filtered_out.oxygen = removed.oxygen
removed.oxygen = 0
if(scrub_N2)
filtered_out.nitrogen = removed.nitrogen
removed.nitrogen = 0
if(scrub_Toxins)
filtered_out.toxins = removed.toxins
removed.toxins = 0
if(scrub_CO2)
filtered_out.carbon_dioxide = removed.carbon_dioxide
removed.carbon_dioxide = 0
if(removed.trace_gases.len>0)
for(var/datum/gas/trace_gas in removed.trace_gases)
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
removed.trace_gases -= trace_gas
filtered_out.trace_gases += trace_gas
else if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O)
removed.trace_gases -= trace_gas
filtered_out.trace_gases += trace_gas
//Remix the resulting gases
air_contents.merge(filtered_out)
tile.assume_air(removed)
tile.air_update_turf()
else //Just siphoning all air
if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE)
return
var/transfer_moles = environment.total_moles()*(volume_rate/environment.volume)
var/datum/gas_mixture/removed = tile.remove_air(transfer_moles)
air_contents.merge(removed)
tile.air_update_turf()
parent.update = 1
return 1
/obj/machinery/atmospherics/unary/vent_scrubber/hide(var/i) //to make the little pipe section invisible, the icon changes.
update_icon()
/obj/machinery/atmospherics/unary/vent_scrubber/receive_signal(datum/signal/signal)
if(stat & (NOPOWER|BROKEN))
return
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command") || (signal.data["advcontrol"] && !advcontrol))
return 0
if(signal.data["power"] != null)
on = text2num(signal.data["power"])
if(signal.data["power_toggle"] != null)
on = !on
if("widenet" in signal.data)
widenet = text2num(signal.data["widenet"])
if("toggle_widenet" in signal.data)
widenet = !widenet
if(signal.data["scrubbing"] != null)
scrubbing = text2num(signal.data["scrubbing"])
if(signal.data["toggle_scrubbing"])
scrubbing = !scrubbing
if(signal.data["o2_scrub"] != null)
scrub_O2 = text2num(signal.data["o2_scrub"])
if(signal.data["toggle_o2_scrub"])
scrub_O2 = !scrub_O2
if(signal.data["n2_scrub"] != null)
scrub_N2 = text2num(signal.data["n2_scrub"])
if(signal.data["toggle_n2_scrub"])
scrub_N2 = !scrub_N2
if(signal.data["co2_scrub"] != null)
scrub_CO2 = text2num(signal.data["co2_scrub"])
if(signal.data["toggle_co2_scrub"])
scrub_CO2 = !scrub_CO2
if(signal.data["tox_scrub"] != null)
scrub_Toxins = text2num(signal.data["tox_scrub"])
if(signal.data["toggle_tox_scrub"])
scrub_Toxins = !scrub_Toxins
if(signal.data["n2o_scrub"] != null)
scrub_N2O = text2num(signal.data["n2o_scrub"])
if(signal.data["toggle_n2o_scrub"])
scrub_N2O = !scrub_N2O
if(signal.data["init"] != null)
name = signal.data["init"]
return
if(signal.data["status"] != null)
spawn(2)
broadcast_status()
return //do not update_icon
spawn(2)
broadcast_status()
update_icon()
return
/obj/machinery/atmospherics/unary/vent_scrubber/power_change()
var/old_stat = stat
..()
if(old_stat != stat)
update_icon()
/obj/machinery/atmospherics/unary/vent_scrubber/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
return {"
<ul>
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
<li>[format_tag("ID Tag","id_tag", "set_id")]</li>
<li><b>AAC Acces:</b> <a href="?src=\ref[src];toggleadvcontrol=1">[advcontrol ? "Allowed" : "Blocked"]</a>
</ul>
"}
/obj/machinery/atmospherics/unary/vent_scrubber/multitool_topic(var/mob/user, var/list/href_list, var/obj/O)
if("toggleadvcontrol" in href_list)
advcontrol = !advcontrol
return MT_UPDATE
if("set_id" in href_list)
var/newid = copytext(reject_bad_text(input(usr, "Specify the new ID tag for this machine", src, src:id_tag) as null|text),1,MAX_MESSAGE_LEN)
if(!newid)
return
if(frequency == 1439)
initial_loc.air_scrub_info -= id_tag
initial_loc.air_scrub_names -= id_tag
id_tag = newid
broadcast_status()
return MT_UPDATE
return ..()
/obj/machinery/atmospherics/unary/vent_scrubber/can_crawl_through()
return !welded
/obj/machinery/atmospherics/unary/vent_scrubber/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if (WT.remove_fuel(0,user))
user << "<span class='notice'>Now welding the scrubber.</span>"
if(do_after(user, 20, target = src))
if(!src || !WT.isOn()) return
playsound(get_turf(src), 'sound/items/Welder2.ogg', 50, 1)
if(!welded)
user.visible_message("[user] welds the scrubber shut.", "You weld the vent scrubber.", "You hear welding.")
welded = 1
update_icon()
else
user.visible_message("[user] unwelds the scrubber.", "You unweld the scrubber.", "You hear welding.")
welded = 0
update_icon()
else
user << "<span class='notice'>The welding tool needs to be on to start this task.</span>"
return 1
else
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)
return 1
if (istype(W, /obj/item/weapon/wrench))
if (!(stat & NOPOWER) && on)
user << "<span class='danger'>You cannot unwrench this [src], turn it off first.</span>"
return 1
return ..()
-341
View File
@@ -1,341 +0,0 @@
/obj/machinery/atmospherics/valve
icon = 'icons/atmos/valve.dmi'
icon_state = "map_valve0"
name = "manual valve"
desc = "A pipe valve"
level = 1
dir = SOUTH
initialize_directions = SOUTH|NORTH
var/open = 0
var/openDuringInit = 0
var/obj/machinery/atmospherics/node1
var/obj/machinery/atmospherics/node2
var/datum/pipe_network/network_node1
var/datum/pipe_network/network_node2
req_one_access_txt = "24;10"
/obj/machinery/atmospherics/valve/open
open = 1
icon_state = "map_valve1"
/obj/machinery/atmospherics/valve/update_icon(animation)
if(animation)
flick("valve[src.open][!src.open]",src)
else
icon_state = "valve[open]"
/obj/machinery/atmospherics/valve/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
add_underlay(T, node1, get_dir(src, node1))
add_underlay(T, node2, get_dir(src, node2))
/obj/machinery/atmospherics/valve/hide(var/i)
update_underlays()
/obj/machinery/atmospherics/valve/New()
switch(dir)
if(NORTH || SOUTH)
initialize_directions = NORTH|SOUTH
if(EAST || WEST)
initialize_directions = EAST|WEST
..()
/obj/machinery/atmospherics/valve/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node1)
network_node1 = new_network
if(open)
network_node2 = new_network
else if(reference == node2)
network_node2 = new_network
if(open)
network_node1 = new_network
if(new_network.normal_members.Find(src))
return 0
new_network.normal_members += src
if(open)
if(reference == node1)
if(node2)
return node2.network_expand(new_network, src)
else if(reference == node2)
if(node1)
return node1.network_expand(new_network, src)
return null
/obj/machinery/atmospherics/valve/Destroy()
loc = null
if(node1)
node1.disconnect(src)
qdel(network_node1)
if(node2)
node2.disconnect(src)
qdel(network_node2)
node1 = null
node2 = null
return ..()
/obj/machinery/atmospherics/valve/proc/open()
if(open) return 0
open = 1
update_icon()
if(network_node1&&network_node2)
network_node1.merge(network_node2)
network_node2 = network_node1
if(network_node1)
network_node1.update = 1
else if(network_node2)
network_node2.update = 1
return 1
/obj/machinery/atmospherics/valve/proc/close()
if(!open)
return 0
open = 0
update_icon()
if(network_node1)
qdel(network_node1)
if(network_node2)
qdel(network_node2)
build_network()
return 1
/obj/machinery/atmospherics/valve/proc/normalize_dir()
if(dir==3)
dir = 1
else if(dir==12)
dir = 4
/obj/machinery/atmospherics/valve/attack_ai(mob/user as mob)
return
/obj/machinery/atmospherics/valve/attack_hand(mob/user as mob)
src.add_fingerprint(usr)
update_icon(1)
sleep(10)
if (src.open)
src.close()
else
src.open()
/obj/machinery/atmospherics/valve/process()
..()
. = PROCESS_KILL
return
/obj/machinery/atmospherics/valve/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
build_network()
update_icon()
update_underlays()
if(openDuringInit)
close()
open()
openDuringInit = 0
/obj/machinery/atmospherics/valve/build_network()
if(!network_node1 && node1)
network_node1 = new /datum/pipe_network()
network_node1.normal_members += src
network_node1.build_network(node1, src)
if(!network_node2 && node2)
network_node2 = new /datum/pipe_network()
network_node2.normal_members += src
network_node2.build_network(node2, src)
/obj/machinery/atmospherics/valve/return_network(obj/machinery/atmospherics/reference)
build_network()
if(reference==node1)
return network_node1
if(reference==node2)
return network_node2
return null
/obj/machinery/atmospherics/valve/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
if(network_node1 == old_network)
network_node1 = new_network
if(network_node2 == old_network)
network_node2 = new_network
return 1
/obj/machinery/atmospherics/valve/return_network_air(datum/network/reference)
return null
/obj/machinery/atmospherics/valve/disconnect(obj/machinery/atmospherics/reference)
if(reference==node1)
qdel(network_node1)
node1 = null
else if(reference==node2)
qdel(network_node2)
node2 = null
update_underlays()
return null
/obj/machinery/atmospherics/valve/digital // can be controlled by AI
name = "digital valve"
desc = "A digitally controlled valve."
icon = 'icons/atmos/digital_valve.dmi'
var/frequency = 1439
var/id_tag = null
var/datum/radio_frequency/radio_connection
settagwhitelist = list("id_tag")
/obj/machinery/atmospherics/valve/digital/attack_ai(mob/user as mob)
return src.attack_hand(user)
/obj/machinery/atmospherics/valve/digital/attack_hand(mob/user as mob)
if(!powered())
return
if(!src.allowed(user))
user << "<span class='alert'>Access denied.</span>"
return
..()
/obj/machinery/atmospherics/valve/digital/open
open = 1
icon_state = "map_valve1"
/obj/machinery/atmospherics/valve/digital/power_change()
var/old_stat = stat
..()
if(old_stat != stat)
update_icon()
/obj/machinery/atmospherics/valve/digital/update_icon()
..()
if(!powered())
icon_state = "valve[open]nopower"
/obj/machinery/atmospherics/valve/digital/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
/obj/machinery/atmospherics/valve/digital/initialize()
..()
if(frequency)
set_frequency(frequency)
/obj/machinery/atmospherics/valve/digital/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id_tag))
return 0
switch(signal.data["command"])
if("valve_open")
if(!open)
open()
if("valve_close")
if(open)
close()
if("valve_toggle")
if(open)
close()
else
open()
if("valve_set")
if(signal.data["valve_set"] == 1)
if(!open)
open()
else
if(open)
close()
/obj/machinery/atmospherics/valve/digital/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if(istype(W, /obj/item/device/multitool))
update_multitool_menu(user)
return 1
..()
/obj/machinery/atmospherics/valve/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
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(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
if (do_after(user, 40, target = src))
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)
/obj/machinery/atmospherics/valve/digital/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
return {"
<ul>
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
<li>[format_tag("ID Tag","id_tag","set_id")]</a></li>
</ul>
"}
@@ -192,92 +192,3 @@ var/global/list/pipe_colors = list("grey" = PIPE_COLOR_GREY, "red" = PIPE_COLOR_
I = image('icons/atmos/pipe_underlays.dmi', icon_state = state, dir = D)
I.color = pipe_colors[pipe_color]
underlays[state + "[D]" + "[pipe_colors[pipe_color]]"] = I
/*
/datum/pipe_icon_manager/proc/gen_underlay_icons()
if(!underlays_intact)
underlays_intact = new()
if(!underlays_exposed)
underlays_exposed = new()
if(!underlays_down)
underlays_down = new()
if(!pipe_underlays_exposed)
pipe_underlays_exposed = new()
if(!pipe_underlays_intact)
pipe_underlays_intact = new()
var/icon/pipe = new('icons/atmos/pipe_underlays.dmi')
for(var/state in pipe.IconStates())
if(state == "")
continue
for(var/D in cardinal)
var/image/I = image('icons/atmos/pipe_underlays.dmi', icon_state = state, dir = D)
switch(state)
if("intact")
underlays_intact["[D]"] = I
if("exposed")
underlays_exposed["[D]"] = I
if("down")
underlays_down["[D]"] = I
if("pipe_exposed")
pipe_underlays_exposed["[D]"] = I
if("pipe_intact")
pipe_underlays_intact["[D]"] = I
if("intact-supply")
underlays_intact["[D]"] = I
if("exposed-supply")
underlays_exposed["[D]"] = I
if("down-supply")
underlays_down["[D]"] = I
if("pipe_exposed-supply")
pipe_underlays_exposed["[D]"] = I
if("pipe_intact-supply")
pipe_underlays_intact["[D]"] = I
if("intact-scrubbers")
underlays_intact["[D]"] = I
if("exposed-scrubbers")
underlays_exposed["[D]"] = I
if("down-scrubbers")
underlays_down["[D]"] = I
if("pipe_exposed-scrubbers")
pipe_underlays_exposed["[D]"] = I
if("pipe_intact-scrubbers")
pipe_underlays_intact["[D]"] = I
for(var/pipe_color in pipe_colors)
I = image('icons/atmos/pipe_underlays.dmi', icon_state = state, dir = D)
I.color = pipe_colors[pipe_color]
switch(state)
if("intact")
underlays_intact["[D]" + pipe_colors[pipe_color]] = I
if("exposed")
underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
if("down")
underlays_down["[D]" + pipe_colors[pipe_color]] = I
if("pipe_exposed")
pipe_underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
if("pipe_intact")
pipe_underlays_intact["[D]" + pipe_colors[pipe_color]] = I
if("intact-supply")
underlays_intact["[D]" + pipe_colors[pipe_color]] = I
if("exposed-supply")
underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
if("down-supply")
underlays_down["[D]" + pipe_colors[pipe_color]] = I
if("pipe_exposed-supply")
pipe_underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
if("pipe_intact-supply")
pipe_underlays_intact["[D]" + pipe_colors[pipe_color]] = I
if("intact-scrubbers")
underlays_intact["[D]" + pipe_colors[pipe_color]] = I
if("exposed-scrubbers")
underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
if("down-scrubbers")
underlays_down["[D]" + pipe_colors[pipe_color]] = I
if("pipe_exposed-scrubbers")
pipe_underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
if("pipe_intact-scrubbers")
pipe_underlays_intact["[D]" + pipe_colors[pipe_color]] = I
*/
-201
View File
@@ -1,201 +0,0 @@
var/global/list/datum/pipe_network/pipe_networks = list()
/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()
var/list/datum/pipeline/line_members = list()
//membership roster to go through for updates and what not
var/update = 1
var/datum/gas_mixture/air_transient = null
/datum/pipe_network/New()
air_transient = new()
..()
/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()
/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)
start_normal.network_expand(src, reference)
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
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)
//Perfectly equalize all gases members instantly
//Calculate totals from individual components
var/total_volume = 0
var/total_thermal_energy = 0
var/total_heat_capacity = 0
var/total_oxygen = 0
var/total_nitrogen = 0
var/total_toxins = 0
var/total_carbon_dioxide = 0
var/list/total_trace_gases = list()
for(var/datum/gas_mixture/gas in gases)
total_volume += gas.volume
var/temp_heatcap = gas.heat_capacity()
total_thermal_energy += gas.temperature*temp_heatcap
total_heat_capacity += temp_heatcap
total_oxygen += gas.oxygen
total_nitrogen += gas.nitrogen
total_toxins += gas.toxins
total_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 total_trace_gases
if(!corresponding)
corresponding = new trace_gas.type()
total_trace_gases += corresponding
corresponding.moles += trace_gas.moles
if(total_volume > 0)
//Calculate temperature
var/temperature = 0
if(total_heat_capacity > 0)
temperature = total_thermal_energy/total_heat_capacity
//Update individual gas_mixtures by volume ratio
for(var/datum/gas_mixture/gas in gases)
gas.oxygen = total_oxygen*gas.volume/total_volume
gas.nitrogen = total_nitrogen*gas.volume/total_volume
gas.toxins = total_toxins*gas.volume/total_volume
gas.carbon_dioxide = total_carbon_dioxide*gas.volume/total_volume
gas.temperature = temperature
if(total_trace_gases.len)
for(var/datum/gas/trace_gas in total_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/total_volume
return 1
+202 -102
View File
@@ -1,36 +1,145 @@
#define STEFAN_BOLTZMANN_CONSTANT 0.0000000567
var/global/list/datum/pipeline/pipe_networks = list()
/datum/pipeline
var/datum/gas_mixture/air
var/list/datum/gas_mixture/other_airs = list()
var/list/obj/machinery/atmospherics/pipe/members
var/list/obj/machinery/atmospherics/pipe/edges //Used for building networks
var/list/obj/machinery/atmospherics/pipe/members = list()
var/list/obj/machinery/atmospherics/other_atmosmch = list()
var/datum/pipe_network/network
var/update = 1
var/alert_pressure = 0
/datum/pipeline/Destroy()
if(network)
qdel(network)
/datum/pipeline/New()
pipe_networks += src
/datum/pipeline/Destroy()
pipe_networks -= src
if(air && air.volume)
temporarily_store_air()
qdel(air)
return ..()
for(var/obj/machinery/atmospherics/pipe/P in members)
P.parent = null
for(var/obj/machinery/atmospherics/A in other_atmosmch)
A.nullifyPipenet(src)
..()
return QDEL_HINT_QUEUE
/datum/pipeline/proc/process()//This use to be called called from the pipe networks
if(update)
update = 0
reconcile_air()
return
/*
//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
*/
var/pipenetwarnings = 10
/datum/pipeline/proc/build_pipeline(obj/machinery/atmospherics/base)
var/volume = 0
if(istype(base, /obj/machinery/atmospherics/pipe))
var/obj/machinery/atmospherics/pipe/E = base
volume = E.volume
alert_pressure = E.alert_pressure
members += E
if(E.air_temporary)
air = E.air_temporary
E.air_temporary = null
else
addMachineryMember(base)
if(!air)
air = new
var/list/possible_expansions = list(base)
while(possible_expansions.len>0)
for(var/obj/machinery/atmospherics/borderline in possible_expansions)
var/list/result = borderline.pipeline_expansion(src)
if(result.len>0)
for(var/obj/machinery/atmospherics/P in result)
if(istype(P, /obj/machinery/atmospherics/pipe))
var/obj/machinery/atmospherics/pipe/item = P
if(!members.Find(item))
if(item.parent)
if(pipenetwarnings > 0)
error("[item.type] added to a pipenet while still having one (pipes leading to the same spot stacking in one turf). Nearby: [item.x], [item.y], [item.z].")
pipenetwarnings -= 1
if(pipenetwarnings == 0)
error("Further messages about pipenets will be suppressed.")
members += item
possible_expansions += item
volume += item.volume
item.parent = src
alert_pressure = min(alert_pressure, item.alert_pressure)
if(item.air_temporary)
air.merge(item.air_temporary)
item.air_temporary = null
else
P.setPipenet(src, borderline)
addMachineryMember(P)
possible_expansions -= borderline
air.volume = volume
/datum/pipeline/proc/addMachineryMember(obj/machinery/atmospherics/A)
other_atmosmch |= A
var/datum/gas_mixture/G = A.returnPipenetAir(src)
other_airs |= G
/datum/pipeline/proc/addMember(obj/machinery/atmospherics/A, obj/machinery/atmospherics/N)
if(istype(A, /obj/machinery/atmospherics/pipe))
var/obj/machinery/atmospherics/pipe/P = A
P.parent = src
var/list/adjacent = P.pipeline_expansion()
for(var/obj/machinery/atmospherics/pipe/I in adjacent)
if(I.parent == src)
continue
var/datum/pipeline/E = I.parent
merge(E)
if(!members.Find(P))
members += P
air.volume += P.volume
else
A.setPipenet(src, N)
addMachineryMember(A)
/datum/pipeline/proc/merge(datum/pipeline/E)
air.volume += E.air.volume
members.Add(E.members)
for(var/obj/machinery/atmospherics/pipe/S in E.members)
S.parent = src
air.merge(E.air)
for(var/obj/machinery/atmospherics/A in E.other_atmosmch)
A.replacePipenet(E, src)
other_atmosmch.Add(E.other_atmosmch)
other_airs.Add(E.other_airs)
E.members.Cut()
E.other_atmosmch.Cut()
qdel(E)
/obj/machinery/atmospherics/proc/addMember(obj/machinery/atmospherics/A)
return
/obj/machinery/atmospherics/pipe/addMember(obj/machinery/atmospherics/A)
parent.addMember(A, src)
/obj/machinery/atmospherics/addMember(obj/machinery/atmospherics/A)
var/datum/pipeline/P = returnPipenet(A)
P.addMember(A, src)
/datum/pipeline/proc/temporarily_store_air()
//Update individual gas_mixtures by volume ratio
@@ -53,94 +162,6 @@
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
while(possible_expansions.len>0)
for(var/obj/machinery/atmospherics/pipe/borderline in possible_expansions)
var/list/result = borderline.pipeline_expansion()
var/edge_check = result.len
if(result.len>0)
for(var/obj/machinery/atmospherics/pipe/item in result)
if(!members.Find(item))
members += item
possible_expansions += item
volume += item.volume
item.parent = src
alert_pressure = min(alert_pressure, item.alert_pressure)
if(item.air_temporary)
air.merge(item.air_temporary)
edge_check--
if(edge_check>0)
edges += borderline
possible_expansions -= borderline
air.volume = volume
/datum/pipeline/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(new_network.line_members.Find(src))
return 0
new_network.line_members += src
network = new_network
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 1
/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
return network
/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
var/datum/gas_mixture/turf_air = target.return_air()
equalize_gases(list(air_sample, turf_air))
air.merge(air_sample)
//turf_air already modified by equalize_gases()
if(istype(target))
if(target.air)
target.update_visuals()
if(network)
network.update = 1
/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)
@@ -191,5 +212,84 @@
(partial_heat_capacity*target.heat_capacity/(partial_heat_capacity+target.heat_capacity))
air.temperature -= heat/total_heat_capacity
if(network)
network.update = 1
update = 1
/datum/pipeline/proc/reconcile_air()
var/list/datum/gas_mixture/GL = list()
var/list/datum/pipeline/PL = list()
PL += src
for(var/i=1;i<=PL.len;i++)
var/datum/pipeline/P = PL[i]
if(!P)
return
GL += P.air
GL += P.other_airs
for(var/obj/machinery/atmospherics/binary/valve/V in P.other_atmosmch)
if(V.open)
PL |= V.parent1
PL |= V.parent2
for(var/obj/machinery/atmospherics/trinary/tvalve/T in P.other_atmosmch)
if(!T.state)
PL |= T.parent3
PL |= T.parent1
else
PL |= T.parent3
PL |= T.parent2
for(var/obj/machinery/atmospherics/unary/portables_connector/C in P.other_atmosmch)
if(C.connected_device)
GL += C.portableConnectorReturnAir()
var/total_volume = 0
var/total_thermal_energy = 0
var/total_heat_capacity = 0
var/total_oxygen = 0
var/total_nitrogen = 0
var/total_toxins = 0
var/total_carbon_dioxide = 0
var/list/total_trace_gases = list()
for(var/datum/gas_mixture/G in GL)
total_volume += G.volume
total_thermal_energy += G.thermal_energy()
total_heat_capacity += G.heat_capacity()
total_oxygen += G.oxygen
total_nitrogen += G.nitrogen
total_toxins += G.toxins
total_carbon_dioxide += G.carbon_dioxide
if(G.trace_gases.len)
for(var/datum/gas/trace_gas in G.trace_gases)
var/datum/gas/corresponding = locate(trace_gas.type) in total_trace_gases
if(!corresponding)
corresponding = new trace_gas.type()
total_trace_gases += corresponding
corresponding.moles += trace_gas.moles
if(total_volume > 0)
//Calculate temperature
var/temperature = 0
if(total_heat_capacity > 0)
temperature = total_thermal_energy/total_heat_capacity
//Update individual gas_mixtures by volume ratio
for(var/datum/gas_mixture/G in GL)
G.oxygen = total_oxygen*G.volume/total_volume
G.nitrogen = total_nitrogen*G.volume/total_volume
G.toxins = total_toxins*G.volume/total_volume
G.carbon_dioxide = total_carbon_dioxide*G.volume/total_volume
G.temperature = temperature
if(total_trace_gases.len)
for(var/datum/gas/trace_gas in total_trace_gases)
var/datum/gas/corresponding = locate(trace_gas.type) in G.trace_gases
if(!corresponding)
corresponding = new trace_gas.type()
G.trace_gases += corresponding
corresponding.moles = trace_gas.moles*G.volume/total_volume
View File
-707
View File
@@ -1,707 +0,0 @@
// internal pipe, don't actually place or use these
obj/machinery/atmospherics/pipe/mains_component
var/obj/machinery/atmospherics/mains_pipe/parent_pipe
var/list/obj/machinery/atmospherics/pipe/mains_component/nodes = new()
New(loc)
..(loc)
parent_pipe = loc
check_pressure(pressure)
var/datum/gas_mixture/environment = loc.loc.return_air()
var/pressure_difference = pressure - environment.return_pressure()
if(pressure_difference > parent_pipe.maximum_pressure)
mains_burst()
else if(pressure_difference > parent_pipe.fatigue_pressure)
//TODO: leak to turf, doing pfshhhhh
if(prob(5))
mains_burst()
else return 1
pipeline_expansion()
return nodes
disconnect(obj/machinery/atmospherics/reference)
if(nodes.Find(reference))
nodes.Remove(reference)
proc/mains_burst()
parent_pipe.burst()
obj/machinery/atmospherics/mains_pipe
icon = 'icons/obj/atmospherics/mainspipe.dmi'
layer = 2.4 //under wires with their 2.5
force = 20
var/volume = 0
var/alert_pressure = 80*ONE_ATMOSPHERE
var/initialize_mains_directions = 0
var/list/obj/machinery/atmospherics/mains_pipe/nodes = new()
var/obj/machinery/atmospherics/pipe/mains_component/supply
var/obj/machinery/atmospherics/pipe/mains_component/scrubbers
var/obj/machinery/atmospherics/pipe/mains_component/aux
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
New()
..()
supply = new(src)
supply.volume = volume
supply.nodes.len = nodes.len
scrubbers = new(src)
scrubbers.volume = volume
scrubbers.nodes.len = nodes.len
aux = new(src)
aux.volume = volume
aux.nodes.len = nodes.len
hide(var/i)
if(level == 1 && istype(loc, /turf/simulated))
invisibility = i ? 101 : 0
update_icon()
proc/burst()
..()
for(var/obj/machinery/atmospherics/pipe/mains_component/pipe in contents)
burst()
proc/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
disconnect()
..()
for(var/obj/machinery/atmospherics/pipe/mains_component/node in nodes)
node.disconnect()
Destroy()
disconnect()
return ..()
initialize()
for(var/i = 1 to nodes.len)
var/obj/machinery/atmospherics/mains_pipe/node = nodes[i]
if(node)
supply.nodes[i] = node.supply
scrubbers.nodes[i] = node.scrubbers
aux.nodes[i] = node.aux
obj/machinery/atmospherics/mains_pipe/simple
name = "mains pipe"
desc = "A one meter section of 3-line mains pipe"
dir = SOUTH
initialize_mains_directions = SOUTH|NORTH
New()
nodes.len = 2
..()
switch(dir)
if(SOUTH || NORTH)
initialize_mains_directions = SOUTH|NORTH
if(EAST || WEST)
initialize_mains_directions = EAST|WEST
if(NORTHEAST)
initialize_mains_directions = NORTH|EAST
if(NORTHWEST)
initialize_mains_directions = NORTH|WEST
if(SOUTHEAST)
initialize_mains_directions = SOUTH|EAST
if(SOUTHWEST)
initialize_mains_directions = SOUTH|WEST
proc/normalize_dir()
if(dir==3)
dir = 1
else if(dir==12)
dir = 4
update_icon()
if(nodes[1] && nodes[2])
icon_state = "intact[invisibility ? "-f" : "" ]"
//var/node1_direction = get_dir(src, node1)
//var/node2_direction = get_dir(src, node2)
//dir = node1_direction|node2_direction
else
if(!nodes[1]&&!nodes[2])
del(src) //TODO: silent deleting looks weird
var/have_node1 = nodes[1]?1:0
var/have_node2 = nodes[2]?1:0
icon_state = "exposed[have_node1][have_node2][invisibility ? "-f" : "" ]"
initialize()
normalize_dir()
var/node1_dir
var/node2_dir
for(var/direction in cardinal)
if(direction&initialize_mains_directions)
if (!node1_dir)
node1_dir = direction
else if (!node2_dir)
node2_dir = direction
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,node1_dir))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[1] = target
break
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,node2_dir))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[2] = target
break
..() // initialize internal pipes
var/turf/T = src.loc // hide if turf is not intact
hide(T.intact)
update_icon()
hidden
level = 1
icon_state = "intact-f"
visible
level = 2
icon_state = "intact"
obj/machinery/atmospherics/mains_pipe/manifold
name = "manifold pipe"
desc = "A manifold composed of mains pipes"
dir = SOUTH
initialize_mains_directions = EAST|NORTH|WEST
volume = 105
New()
nodes.len = 3
..()
initialize_mains_directions = (NORTH|SOUTH|EAST|WEST) & ~dir
initialize()
var/connect_directions = initialize_mains_directions
for(var/direction in cardinal)
if(direction&connect_directions)
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,direction))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[1] = target
connect_directions &= ~direction
break
if (nodes[1])
break
for(var/direction in cardinal)
if(direction&connect_directions)
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,direction))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[2] = target
connect_directions &= ~direction
break
if (nodes[2])
break
for(var/direction in cardinal)
if(direction&connect_directions)
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,direction))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[3] = target
connect_directions &= ~direction
break
if (nodes[3])
break
..() // initialize internal pipes
var/turf/T = src.loc // hide if turf is not intact
hide(T.intact)
update_icon()
update_icon()
icon_state = "manifold[invisibility ? "-f" : "" ]"
hidden
level = 1
icon_state = "manifold-f"
visible
level = 2
icon_state = "manifold"
obj/machinery/atmospherics/mains_pipe/manifold4w
name = "manifold pipe"
desc = "A manifold composed of mains pipes"
dir = SOUTH
initialize_mains_directions = EAST|NORTH|WEST|SOUTH
volume = 105
New()
nodes.len = 4
..()
initialize()
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,NORTH))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[1] = target
break
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,SOUTH))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[2] = target
break
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,EAST))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[3] = target
break
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,WEST))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[3] = target
break
..() // initialize internal pipes
var/turf/T = src.loc // hide if turf is not intact
hide(T.intact)
update_icon()
update_icon()
icon_state = "manifold4w[invisibility ? "-f" : "" ]"
hidden
level = 1
icon_state = "manifold4w-f"
visible
level = 2
icon_state = "manifold4w"
obj/machinery/atmospherics/mains_pipe/split
name = "mains splitter"
desc = "A splitter for connecting to a single pipe off a mains."
var/obj/machinery/atmospherics/pipe/mains_component/split_node
var/obj/machinery/atmospherics/node3
var/icon_type
New()
nodes.len = 2
..()
initialize_mains_directions = turn(dir, 90) | turn(dir, -90)
initialize_directions = dir // actually have a normal connection too
initialize()
var/node1_dir
var/node2_dir
var/node3_dir
node1_dir = turn(dir, 90)
node2_dir = turn(dir, -90)
node3_dir = dir
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,node1_dir))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[1] = target
break
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,node2_dir))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[2] = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node3_dir))
if(target.initialize_directions & get_dir(target,src))
node3 = target
break
..() // initialize internal pipes
// bind them
spawn(5)
if(node3 && split_node)
var/datum/pipe_network/N1 = node3.return_network(src)
var/datum/pipe_network/N2 = split_node.return_network(split_node)
if(N1 && N2)
N1.merge(N2)
var/turf/T = src.loc // hide if turf is not intact
hide(T.intact)
update_icon()
update_icon()
icon_state = "split-[icon_type][invisibility ? "-f" : "" ]"
return_network(A)
return split_node.return_network(A)
supply
icon_type = "supply"
New()
..()
split_node = supply
hidden
level = 1
icon_state = "split-supply-f"
visible
level = 2
icon_state = "split-supply"
scrubbers
icon_type = "scrubbers"
New()
..()
split_node = scrubbers
hidden
level = 1
icon_state = "split-scrubbers-f"
visible
level = 2
icon_state = "split-scrubbers"
aux
icon_type = "aux"
New()
..()
split_node = aux
hidden
level = 1
icon_state = "split-aux-f"
visible
level = 2
icon_state = "split-aux"
obj/machinery/atmospherics/mains_pipe/split3
name = "triple mains splitter"
desc = "A splitter for connecting to the 3 pipes on a mainline."
var/obj/machinery/atmospherics/supply_node
var/obj/machinery/atmospherics/scrubbers_node
var/obj/machinery/atmospherics/aux_node
New()
nodes.len = 1
..()
initialize_mains_directions = dir
initialize_directions = cardinal & ~dir // actually have a normal connection too
initialize()
var/node1_dir
var/supply_node_dir
var/scrubbers_node_dir
var/aux_node_dir
node1_dir = dir
aux_node_dir = turn(dir, 180)
if(dir & (NORTH|SOUTH))
supply_node_dir = EAST
scrubbers_node_dir = WEST
else
supply_node_dir = SOUTH
scrubbers_node_dir = NORTH
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src, node1_dir))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[1] = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,supply_node_dir))
if(target.initialize_directions & get_dir(target,src))
supply_node = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,scrubbers_node_dir))
if(target.initialize_directions & get_dir(target,src))
scrubbers_node = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,aux_node_dir))
if(target.initialize_directions & get_dir(target,src))
aux_node = target
break
..() // initialize internal pipes
// bind them
spawn(5)
if(supply_node)
var/datum/pipe_network/N1 = supply_node.return_network(src)
var/datum/pipe_network/N2 = supply.return_network(supply)
if(N1 && N2)
N1.merge(N2)
if(scrubbers_node)
var/datum/pipe_network/N1 = scrubbers_node.return_network(src)
var/datum/pipe_network/N2 = scrubbers.return_network(scrubbers)
if(N1 && N2)
N1.merge(N2)
if(aux_node)
var/datum/pipe_network/N1 = aux_node.return_network(src)
var/datum/pipe_network/N2 = aux.return_network(aux)
if(N1 && N2)
N1.merge(N2)
var/turf/T = src.loc // hide if turf is not intact
hide(T.intact)
update_icon()
update_icon()
icon_state = "split-t[invisibility ? "-f" : "" ]"
return_network(obj/machinery/atmospherics/reference)
var/obj/machinery/atmospherics/A
A = supply_node.return_network(reference)
if(!A)
A = scrubbers_node.return_network(reference)
if(!A)
A = aux_node.return_network(reference)
return A
hidden
level = 1
icon_state = "split-t-f"
visible
level = 2
icon_state = "split-t"
obj/machinery/atmospherics/mains_pipe/cap
name = "pipe cap"
desc = "A cap for the end of a mains pipe"
dir = SOUTH
initialize_directions = SOUTH
volume = 35
New()
nodes.len = 1
..()
initialize_mains_directions = dir
update_icon()
icon_state = "cap[invisibility ? "-f" : ""]"
initialize()
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,dir))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[1] = target
break
..()
var/turf/T = src.loc // hide if turf is not intact
hide(T.intact)
update_icon()
hidden
level = 1
icon_state = "cap-f"
visible
level = 2
icon_state = "cap"
//TODO: Get Mains valves working!
/*
obj/machinery/atmospherics/mains_pipe/valve
icon_state = "mvalve0"
name = "mains shutoff valve"
desc = "A mains pipe valve"
var/open = 1
dir = SOUTH
initialize_mains_directions = SOUTH|NORTH
New()
nodes.len = 2
..()
initialize_mains_directions = dir | turn(dir, 180)
update_icon(animation)
var/turf/simulated/floor = loc
var/hide = istype(floor) ? floor.intact : 0
level = 1
for(var/obj/machinery/atmospherics/mains_pipe/node in nodes)
if(node.level == 2)
hide = 0
level = 2
break
if(animation)
flick("[hide?"h":""]mvalve[src.open][!src.open]",src)
else
icon_state = "[hide?"h":""]mvalve[open]"
initialize()
normalize_dir()
var/node1_dir
var/node2_dir
for(var/direction in cardinal)
if(direction&initialize_mains_directions)
if (!node1_dir)
node1_dir = direction
else if (!node2_dir)
node2_dir = direction
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,node1_dir))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[1] = target
break
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,node2_dir))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[2] = target
break
if(open)
..() // initialize internal pipes
update_icon()
proc/normalize_dir()
if(dir==3)
dir = 1
else if(dir==12)
dir = 4
proc/open()
if(open) return 0
open = 1
update_icon()
initialize()
return 1
proc/close()
if(!open) return 0
open = 0
update_icon()
for(var/obj/machinery/atmospherics/pipe/mains_component/node in src)
for(var/obj/machinery/atmospherics/pipe/mains_component/o in node.nodes)
o.disconnect(node)
o.build_network()
return 1
attack_ai(mob/user as mob)
return
attack_paw(mob/user as mob)
return attack_hand(user)
attack_hand(mob/user as mob)
src.add_fingerprint(usr)
update_icon(1)
sleep(10)
if (open)
close()
else
open()
digital // can be controlled by AI
name = "digital mains valve"
desc = "A digitally controlled valve."
icon_state = "dvalve0"
attack_ai(mob/user as mob)
return src.attack_hand(user)
attack_hand(mob/user as mob)
if(!src.allowed(user))
user << "<span class='alert>Access denied.</span>"
return
..()
//Radio remote control
proc
set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
var/frequency = 0
var/id = null
var/datum/radio_frequency/radio_connection
initialize()
..()
if(frequency)
set_frequency(frequency)
update_icon(animation)
var/turf/simulated/floor = loc
var/hide = istype(floor) ? floor.intact : 0
level = 1
for(var/obj/machinery/atmospherics/mains_pipe/node in nodes)
if(node.level == 2)
hide = 0
level = 2
break
if(animation)
flick("[hide?"h":""]dvalve[src.open][!src.open]",src)
else
icon_state = "[hide?"h":""]dvalve[open]"
receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id))
return 0
switch(signal.data["command"])
if("valve_open")
if(!open)
open()
if("valve_close")
if(open)
close()
if("valve_toggle")
if(open)
close()
else
open()
*/
-53
View File
@@ -1,53 +0,0 @@
/obj/machinery/atmospherics/proc/change_color(var/new_color)
//only pass valid pipe colors please ~otherwise your pipe will turn invisible
if(!pipe_color_check(new_color))
return
pipe_color = new_color
update_icon()
/*
/obj/machinery/atmospherics/pipe/add_underlay(var/obj/machinery/atmospherics/node, var/direction)
if(istype(src, /obj/machinery/atmospherics/pipe/tank)) //todo: move tanks to unary devices
return ..()
if(node)
var/temp_dir = get_dir(src, node)
underlays += icon_manager.get_atmos_icon("pipe_underlay_intact", temp_dir, color_cache_name(node))
return temp_dir
else if(direction)
underlays += icon_manager.get_atmos_icon("pipe_underlay_exposed", direction, pipe_color)
else
return null
*/
/obj/machinery/atmospherics/proc/universal_underlays(var/obj/machinery/atmospherics/node, var/direction)
var/turf/T = get_turf(src)
if(!istype(T)) return
if(node)
var/node_dir = get_dir(src,node)
if(node.icon_connect_type == "-supply")
add_underlay_adapter(T, , node_dir, "")
add_underlay_adapter(T, node, node_dir, "-supply")
add_underlay_adapter(T, , node_dir, "-scrubbers")
else if (node.icon_connect_type == "-scrubbers")
add_underlay_adapter(T, , node_dir, "")
add_underlay_adapter(T, , node_dir, "-supply")
add_underlay_adapter(T, node, node_dir, "-scrubbers")
else
add_underlay_adapter(T, node, node_dir, "")
add_underlay_adapter(T, , node_dir, "-supply")
add_underlay_adapter(T, , node_dir, "-scrubbers")
else
add_underlay_adapter(T, , direction, "-supply")
add_underlay_adapter(T, , direction, "-scrubbers")
add_underlay_adapter(T, , direction, "")
/obj/machinery/atmospherics/proc/add_underlay_adapter(var/turf/T, var/obj/machinery/atmospherics/node, var/direction, var/icon_connect_type) //modified from add_underlay, does not make exposed underlays
if(node)
if(T.intact && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
underlays += icon_manager.get_atmos_icon("underlay", direction, color_cache_name(node), "down" + icon_connect_type)
else
underlays += icon_manager.get_atmos_icon("underlay", direction, color_cache_name(node), "intact" + icon_connect_type)
else
underlays += icon_manager.get_atmos_icon("underlay", direction, color_cache_name(node), "retracted" + icon_connect_type)
+41 -65
View File
@@ -17,10 +17,6 @@
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
@@ -30,6 +26,37 @@
initialize_directions = SOUTH|WEST|NORTH
if(WEST)
initialize_directions = NORTH|EAST|SOUTH
..()
alpha = 255
icon = null
/obj/machinery/atmospherics/pipe/manifold/initialize()
for(var/D in cardinal)
if(D == dir)
continue
for(var/obj/machinery/atmospherics/target in get_step(src, D))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if(!c)
continue
if(turn(dir, 90) == D)
target.connected_to = c
connected_to = c
node1 = target
if(turn(dir, 270) == D)
target.connected_to = c
connected_to = c
node2 = target
if(turn(dir, 180) == D)
target.connected_to = c
connected_to = c
node3 = target
break
var/turf/T = src.loc // hide if turf is not intact
hide(T.intact)
update_icon()
/obj/machinery/atmospherics/pipe/manifold/hide(var/i)
if(level == 1 && istype(loc, /turf/simulated))
@@ -47,12 +74,21 @@
/obj/machinery/atmospherics/pipe/manifold/Destroy()
if(node1)
var/obj/machinery/atmospherics/A = node1
node1.disconnect(src)
node1 = null
A.build_network()
if(node2)
var/obj/machinery/atmospherics/A = node2
node2.disconnect(src)
node2 = null
A.build_network()
if(node3)
var/obj/machinery/atmospherics/A = node3
node3.disconnect(src)
node3 = null
A.build_network()
releaseAirToTurf()
return ..()
/obj/machinery/atmospherics/pipe/manifold/disconnect(obj/machinery/atmospherics/reference)
@@ -60,19 +96,15 @@
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)
@@ -125,62 +157,6 @@
..()
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
+38 -44
View File
@@ -33,14 +33,26 @@
/obj/machinery/atmospherics/pipe/manifold4w/Destroy()
if(node1)
var/obj/machinery/atmospherics/A = node1
node1.disconnect(src)
node1 = null
A.build_network()
if(node2)
var/obj/machinery/atmospherics/A = node2
node2.disconnect(src)
node2 = null
A.build_network()
if(node3)
var/obj/machinery/atmospherics/A = node3
node3.disconnect(src)
node3 = null
A.build_network()
if(node4)
var/obj/machinery/atmospherics/A = node4
node4.disconnect(src)
node4 = null
A.build_network()
releaseAirToTurf()
return ..()
/obj/machinery/atmospherics/pipe/manifold4w/disconnect(obj/machinery/atmospherics/reference)
@@ -140,50 +152,32 @@
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
for(var/D in cardinal)
for(var/obj/machinery/atmospherics/target in get_step(src, D))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if(!c)
continue
if(D == NORTH)
target.connected_to = c
connected_to = c
node1 = target
else if(D == SOUTH)
target.connected_to = c
connected_to = c
node2 = target
else if(D == EAST)
target.connected_to = c
connected_to = c
node3 = target
else if(D == WEST)
target.connected_to = c
connected_to = c
node4 = 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)
var/turf/T = src.loc // hide if turf is not intact
hide(T.intact)
update_icon()
/obj/machinery/atmospherics/pipe/manifold4w/visible
+33 -99
View File
@@ -1,24 +1,37 @@
/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
can_unwrench = 1
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/Destroy()
releaseAirToTurf()
qdel(air_temporary)
air_temporary = null
/obj/machinery/atmospherics/pipe/proc/pipeline_expansion()
var/turf/T = loc
for(var/obj/machinery/meter/meter in T)
if(meter.target == src)
var/obj/item/pipe_meter/PM = new (T)
meter.transfer_fingerprints_to(PM)
qdel(meter)
. = ..()
if(parent && isnull(parent.gcDestroyed))
qdel(parent)
parent = null
/obj/machinery/atmospherics/proc/pipeline_expansion()
return null
/obj/machinery/atmospherics/pipe/proc/check_pressure(pressure)
@@ -26,107 +39,27 @@
//Return null if parent should stop checking other pipes. Recall: del(src) will by default return null
return 1
/obj/machinery/atmospherics/pipe/proc/releaseAirToTurf()
if(air_temporary)
var/turf/T = loc
T.assume_air(air_temporary)
air_update_turf()
/obj/machinery/atmospherics/pipe/return_air()
if(!parent)
parent = new /datum/pipeline()
parent.build_pipeline(src)
return 0
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, target = src))
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, target = src))
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/setPipenet(datum/pipeline/P)
parent = P
/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
@@ -135,4 +68,5 @@
else if(istype(node, /obj/machinery/atmospherics/pipe/simple))
return node.pipe_color
else
return pipe_color
return pipe_color
+47 -65
View File
@@ -24,7 +24,6 @@
/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
@@ -43,18 +42,32 @@
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
/obj/machinery/atmospherics/pipe/simple/initialize()
normalize_dir()
var/N = 2
for(var/D in cardinal)
if(D & initialize_directions)
N--
for(var/obj/machinery/atmospherics/target in get_step(src, D))
if(target.initialize_directions & get_dir(target,src))
var/c = check_connect_types(target,src)
if(!c)
continue
if(!node1 && N == 1)
target.connected_to = c
connected_to = c
node1 = target
break
if(!node2 && N == 0)
target.connected_to = c
connected_to = c
node2 = target
break
var/turf/T = loc // hide if turf is not intact
hide(T.intact)
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()
@@ -83,14 +96,31 @@
dir = 1
else if(dir==12)
dir = 4
/obj/machinery/atmospherics/pipe/simple/Destroy()
if(node1)
var/obj/machinery/atmospherics/A = node1
node1.disconnect(src)
node1 = null
A.build_network()
if(node2)
var/obj/machinery/atmospherics/A = node2
node2.disconnect(src)
node2 = null
A.build_network()
releaseAirToTurf()
return ..()
/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()
/obj/machinery/atmospherics/pipe/simple/pipeline_expansion()
return list(node1, node2)
@@ -126,56 +156,8 @@
/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)
/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/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
@@ -10,58 +10,38 @@
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
var/environment_temperature = 0
if(istype(loc, /turf/simulated))
if(loc:blocks_air)
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)
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
var/N = 2
for(var/D in cardinal)
if(D & initialize_directions_he)
N--
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src, D))
if(target.initialize_directions_he & get_dir(target,src))
if(!node1 && N == 1)
node1 = target
break
if(!node2 && N == 0)
node2 = target
break
update_icon()
return
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/hidden
level=1
@@ -78,23 +58,21 @@
minimum_temperature_difference = 300
thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT
// BubbleWrap
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/New()
.. ()
switch ( dir )
if ( SOUTH )
switch (dir)
if (SOUTH)
initialize_directions = NORTH
initialize_directions_he = SOUTH
if ( NORTH )
if (NORTH)
initialize_directions = SOUTH
initialize_directions_he = NORTH
if ( EAST )
if (EAST)
initialize_directions = WEST
initialize_directions_he = EAST
if ( WEST )
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))
-166
View File
@@ -1,166 +0,0 @@
/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
@@ -1,105 +0,0 @@
/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, target = src))
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)
+7
View File
@@ -1801,3 +1801,10 @@ var/mob/dview/dview_mob = new
I.pixel_y = y_offset
return I
/proc/turf_clear(turf/T)
for(var/atom/A in T)
if(A.simulated)
return 0
return 1
-3
View File
@@ -8,9 +8,6 @@ var/changelog_hash = ""
var/game_year = (text2num(time2text(world.realtime, "YYYY")) + 544)
var/aliens_allowed = 1
var/ooc_allowed = 1
var/dsay_allowed = 1
var/dooc_allowed = 1
var/traitor_scaling = 1
//var/goonsay_allowed = 0
var/dna_ident = 1
+1
View File
@@ -10,6 +10,7 @@ var/list/clients = list() //list of all clients
var/list/admins = list() //list of all clients whom are admins
var/list/deadmins = list() //list of all clients who have used the de-admin verb.
var/list/directory = list() //list of all ckeys with associated client
var/list/stealthminID = list() //reference list with IDs that store ckeys, for stealthmins
//Since it didn't really belong in any other category, I'm putting this here
//This is for procs to replace all the goddamn 'in world's that are chilling around the code
+1 -1
View File
@@ -190,7 +190,7 @@
Only used for swapping hands
*/
/mob/proc/MiddleClickOn(var/atom/A)
A.point()
pointed(A)
return
// See click_override.dm
+1 -1
View File
@@ -111,7 +111,7 @@
if(istype(src, /mob/living/silicon/robot/drone))
// Drones cannot point.
return
A.point()
pointed(A)
return
//Give cyborgs hotkey clicks without breaking existing uses of hotkey clicks
+3
View File
@@ -14,6 +14,9 @@
var/obj/master = null //A reference to the object in the slot. Grabs or items, generally.
var/gun_click_time = -100 //I'm lazy.
/obj/screen/Destroy()
master = null
return ..()
/obj/screen/text
icon = null
@@ -340,7 +340,7 @@
var/averageRunTime = round(getAverageRunTime(), 0.1)/10
var/lastRunTime = round(getLastRunTime(), 0.1)/10
var/highestRunTime = round(getHighestRunTime(), 0.1)/10
stat("[name]", "T#[getTicks()]|AR [averageRunTime]|LR [lastRunTime]|HR [highestRunTime]|D [cpu_defer_count]")
stat("[name]", "T#[getTicks()] | AR [averageRunTime] | LR [lastRunTime] | HR [highestRunTime] | D [cpu_defer_count]")
/datum/controller/process/proc/catchException(var/exception/e, var/thrower)
var/etext = "[e]"
@@ -98,7 +98,7 @@ var/global/datum/controller/processScheduler/processScheduler
/datum/controller/processScheduler/proc/process()
updateCurrentTickData()
for(var/i=world.tick_lag,i<world.tick_lag*50,i+=world.tick_lag)
spawn(i) updateCurrentTickData()
while(isRunning)
@@ -252,7 +252,7 @@ var/global/datum/controller/processScheduler/processScheduler
last_start[process] = time
else
last_queued[process] = (time == 0 ? 0 : world.time)
last_start[process] = time
last_start[process] = time
/datum/controller/processScheduler/proc/recordEnd(var/datum/controller/process/process, var/time = null)
if (isnull(time))
@@ -376,7 +376,7 @@ var/global/datum/controller/processScheduler/processScheduler
if(!isRunning)
stat("Processes", "Scheduler not running")
return
stat("Processes", "[processes.len] (R[running.len]/Q[queued.len]/I[idle.len])")
stat("Processes", "[processes.len] (R [running.len] / Q [queued.len] / I [idle.len])")
stat(null, "[round(cpuAverage, 0.1)] CPU, [round(timeAllowance, 0.1)/10] TA")
for(var/datum/controller/process/p in processes)
p.statProcess()
+2 -2
View File
@@ -27,7 +27,7 @@ var/global/datum/controller/process/air_system/air_master
schedule_interval = 20 // every 2 seconds
start_delay = 4
air_master = src
var/watch = start_watch()
log_startup_progress("Processing geometry...")
setup_allturfs() // Get all currently active tiles that need processing each atmos tick.
@@ -48,7 +48,7 @@ var/global/datum/controller/process/air_system/air_master
/datum/controller/process/air_system/statProcess()
..()
stat(null, "[last_active] active")
stat(null, "[last_excited] EG|[last_hpd] HPD|[last_asc] ASC|[last_hotspots] Hot")
stat(null, "[last_excited] EG | [last_hpd] HPD | [last_asc] ASC | [last_hotspots] Hot")
/datum/controller/process/air_system/proc/process_hotspots()
last_hotspots = hotspots.len
+1 -1
View File
@@ -9,7 +9,7 @@
/datum/controller/process/pipenet/doWork()
for(last_object in pipe_networks)
var/datum/pipe_network/pipeNetwork = last_object
var/datum/pipeline/pipeNetwork = last_object
if(istype(pipeNetwork) && isnull(pipeNetwork.gcDestroyed))
try
pipeNetwork.process()
+15
View File
@@ -164,6 +164,11 @@
var/disable_away_missions = 0 // disable away missions
var/autoconvert_notes = 0 //if all connecting player's notes should attempt to be converted to the database
var/ooc_allowed = 1
var/looc_allowed = 1
var/dooc_allowed = 1
var/dsay_allowed = 1
/datum/configuration/New()
var/list/L = subtypesof(/datum/game_mode)
@@ -341,6 +346,16 @@
if ("guest_ban")
guests_allowed = 0
if ("disable_ooc")
config.ooc_allowed = 0
config.looc_allowed = 0
if ("disable_dead_ooc")
config.dooc_allowed = 0
if ("disable_dsay")
config.dsay_allowed = 0
if ("usewhitelist")
config.usewhitelist = 1
+10 -10
View File
@@ -72,14 +72,6 @@ datum/controller/game_controller/proc/setup_objects()
count++
log_startup_progress(" Initialized [count] objects in [stop_watch(watch)]s.")
watch = start_watch()
count = 0
log_startup_progress("Initializing pipe networks...")
for(var/obj/machinery/atmospherics/machine in machines)
machine.build_network()
count++
log_startup_progress(" Initialized [count] pipe networks in [stop_watch(watch)]s.")
watch = start_watch()
count = 0
log_startup_progress("Initializing atmospherics machinery...")
@@ -92,8 +84,16 @@ datum/controller/game_controller/proc/setup_objects()
var/obj/machinery/atmospherics/unary/vent_scrubber/T = U
T.broadcast_status()
count++
log_startup_progress(" Initialized [count] atmospherics devices in [stop_watch(watch)]s.")
log_startup_progress(" Initialized [count] atmospherics machines in [stop_watch(watch)]s.")
watch = start_watch()
count = 0
log_startup_progress("Initializing pipe networks...")
for(var/obj/machinery/atmospherics/machine in machines)
machine.build_network()
count++
log_startup_progress(" Initialized [count] pipe networks in [stop_watch(watch)]s.")
log_startup_progress("Finished object initializations in [stop_watch(overwatch)]s.")
datum/controller/game_controller/proc/setup_starlight()
+8 -8
View File
@@ -59,9 +59,9 @@ datum/controller/vote
voting.Cut()
current_votes.Cut()
if(auto_muted && !ooc_allowed)
if(auto_muted && !config.ooc_allowed)
auto_muted = 0
ooc_allowed = !( ooc_allowed )
config.ooc_allowed = !( config.ooc_allowed )
world << "<b>The OOC channel has been automatically enabled due to vote end.</b>"
log_admin("OOC was toggled automatically due to vote end.")
message_admins("OOC has been toggled on automatically.")
@@ -239,21 +239,21 @@ datum/controller/vote
if(mode == "gamemode" && going)
going = 0
world << "<font color='red'><b>Round start has been delayed.</b></font>"
if(mode == "crew_transfer" && ooc_allowed)
if(mode == "crew_transfer" && config.ooc_allowed)
auto_muted = 1
ooc_allowed = !( ooc_allowed )
config.ooc_allowed = !( config.ooc_allowed )
world << "<b>The OOC channel has been automatically disabled due to a crew transfer vote.</b>"
log_admin("OOC was toggled automatically due to crew_transfer vote.")
message_admins("OOC has been toggled off automatically.")
if(mode == "gamemode" && ooc_allowed)
if(mode == "gamemode" && config.ooc_allowed)
auto_muted = 1
ooc_allowed = !( ooc_allowed )
config.ooc_allowed = !( config.ooc_allowed )
world << "<b>The OOC channel has been automatically disabled due to the gamemode vote.</b>"
log_admin("OOC was toggled automatically due to gamemode vote.")
message_admins("OOC has been toggled off automatically.")
if(mode == "custom" && ooc_allowed)
if(mode == "custom" && config.ooc_allowed)
auto_muted = 1
ooc_allowed = !( ooc_allowed )
config.ooc_allowed = !( config.ooc_allowed )
world << "<b>The OOC channel has been automatically disabled due to a custom vote.</b>"
log_admin("OOC was toggled automatically due to custom vote.")
message_admins("OOC has been toggled off automatically.")
+2 -1
View File
@@ -41,7 +41,8 @@
/datum/material_container/Destroy()
owner = null
return ..()
..()
return QDEL_HINT_QUEUE
//For inserting an amount of material
/datum/material_container/proc/insert_amount(amt, material_type = null)
-40
View File
@@ -1,40 +0,0 @@
/datum/wires/taperecorder
wire_count = 2
holder_type = /obj/item/device/taperecorder
var/const/WIRE_PLAY = 1
var/const/WIRE_RECORD = 2
/datum/wires/taperecorder/UpdatePulsed(var/index)
switch(index)
if(WIRE_PLAY)
play()
if(WIRE_RECORD)
record()
/datum/wires/taperecorder/CanUse(var/mob/living/L)
var/obj/item/device/taperecorder/T = holder
if(T.open_panel)
return 1
return 0
/datum/wires/taperecorder/proc/play()
var/obj/item/device/taperecorder/T = holder
T.stop()
T.play()
/datum/wires/taperecorder/proc/record()
var/obj/item/device/taperecorder/T = holder
if(T.recording)
T.stop()
else
T.record()
//helpers
/datum/wires/taperecorder/proc/get_play()
return !(wires_status & WIRE_PLAY)
/datum/wires/taperecorder/proc/get_record()
return !(wires_status & WIRE_RECORD)
+5
View File
@@ -46,6 +46,11 @@ var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown",
var/list/wires = same_wires[holder_type]
src.wires = wires // Reference the wires list.
/datum/wires/Destroy()
holder = null
..()
return QDEL_HINT_QUEUE
/datum/wires/proc/GenerateWires()
var/list/colours_to_pick = wireColours.Copy() // Get a copy, not a reference.
var/list/indexes_to_pick = list()
+4 -3
View File
@@ -21,12 +21,13 @@
. = ""
if(key)
if(include_link && C)
. += "<a href='?priv_msg=\ref[C];type=[type]'>"
if(C && C.holder && C.holder.fakekey && !include_name)
if(include_link)
. += "<a href='?priv_msg=[C.findStealthKey()];type=[type]'>"
. += "Administrator"
else
if(include_link)
. += "<a href='?priv_msg=\ref[C];type=[type]'>"
. += key
if(include_link)
+3 -241
View File
@@ -2,8 +2,8 @@
//command_announcement.Announce("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", new_sound = 'sound/AI/aliens.ogg')
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in machines)
if((temp_vent.loc.z in config.station_levels) && !temp_vent.welded && temp_vent.network)
if(temp_vent.network.normal_members.len > 50) // Stops Aliens getting stuck in small networks. See: Security, Virology
if((temp_vent.loc.z in config.station_levels) && !temp_vent.welded)
if(temp_vent.parent.other_atmosmch.len > 50) // Stops Aliens getting stuck in small networks. See: Security, Virology
vents += temp_vent
var/list/candidates = get_candidates(BE_ALIEN,ALIEN_AFK_BRACKET)
@@ -25,90 +25,7 @@
command_announcement.Announce("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", new_sound = 'sound/AI/aliens.ogg')
for(var/mob/M in player_list)
M << sound('sound/AI/aliens.ogg')
/proc/high_radiation_event()
/* // Haha, this is way too laggy. I'll keep the prison break though.
for(var/obj/machinery/light/L in world)
if(!(L.z in config.station_levels)) continue
L.flicker(50)
sleep(100)
*/
for(var/mob/living/carbon/human/H in living_mob_list)
var/turf/T = get_turf(H)
if(!T)
continue
if(!(T.z in config.station_levels))
continue
if(istype(H,/mob/living/carbon/human))
if(H.species.flags & NO_DNA_RAD)
return
H.apply_effect((rand(15,75)),IRRADIATE,0)
if (prob(5))
H.apply_effect((rand(90,150)),IRRADIATE,0)
if (prob(25))
if (prob(75))
randmutb(H)
domutcheck(H,null,MUTCHK_FORCED)
else
randmutg(H)
domutcheck(H,null,MUTCHK_FORCED)
sleep(100)
command_announcement.Announce("High levels of radiation detected near the station. Please report to the Med-bay if you feel strange.", "Anomaly Alert", new_sound = 'sound/AI/radiation.ogg')
//Changing this to affect the main station. Blame Urist. --Pete
/proc/prison_break() // -- Callagan
var/list/area/areas = list()
for(var/area/A in world)
if(istype(A, /area/security/prison) || istype(A, /area/security/brig))
areas += A
if(areas && areas.len > 0)
for(var/area/A in areas)
for(var/obj/machinery/light/L in A)
L.flicker(10)
sleep(100)
for(var/area/A in areas)
for (var/obj/machinery/power/apc/temp_apc in A)
temp_apc.overload_lighting()
for (var/obj/structure/closet/secure_closet/brig/temp_closet in A)
temp_closet.locked = 0
temp_closet.icon_state = temp_closet.icon_closed
for (var/obj/machinery/door/airlock/security/temp_airlock in A)
spawn(0) temp_airlock.prison_open()
for (var/obj/machinery/door/airlock/glass_security/temp_glassairlock in A)
spawn(0) temp_glassairlock.prison_open()
for (var/obj/machinery/door_timer/temp_timer in A)
temp_timer.releasetime = 1
sleep(150)
command_announcement.Announce("Gr3y.T1d3 virus detected in [station_name()] imprisonment subroutines. Recommend station AI involvement.", "Security Alert")
else
log_to_dd("ERROR: Could not initate grey-tide virus. Unable find prison or brig area.")
/proc/carp_migration() // -- Darem
for(var/obj/effect/landmark/C in landmarks_list)
if(C.name == "carpspawn")
if(prob(95))
new /mob/living/simple_animal/hostile/carp(C.loc)
else
new /mob/living/simple_animal/hostile/carp/megacarp(C.loc)
//sleep(100)
spawn(rand(300, 600)) //Delayed announcements to keep the crew on their toes.
command_announcement.Announce("Unknown biological entities have been detected near [station_name()], please stand-by.", "Lifesign Alert", new_sound = 'sound/AI/commandreport.ogg')
/proc/lightsout(isEvent = 0, lightsoutAmount = 1,lightsoutRange = 25) //leave lightsoutAmount as 0 to break ALL lights
if(isEvent)
command_announcement.Announce("An Electrical storm has been detected in your area, please repair potential electronic overloads.","Electrical Storm Alert")
@@ -138,158 +55,3 @@
apc.overload_lighting()
return
/proc/IonStorm(botEmagChance = 10)
/*Deuryn's current project, notes here for those who care.
Revamping the random laws so they don't suck.
Would like to add a law like "Law x is _______" where x = a number, and _____ is something that may redefine a law, (Won't be aimed at asimov)
*/
//AI laws
for(var/mob/living/silicon/ai/M in living_mob_list)
if(M.stat != 2 && M.see_in_dark != 0)
var/who2 = pick("ALIENS", "BEARS", "CLOWNS", "XENOS", "PETES", "BOMBS", "FETISHES", "WIZARDS", "SYNDICATE AGENTS", "CENTCOM OFFICERS", "SPACE PIRATES", "TRAITORS", "MONKEYS", "BEES", "CARP", "CRABS", "EELS", "BANDITS", "LIGHTS")
var/what2 = pick("BOLTERS", "STAVES", "DICE", "SINGULARITIES", "TOOLBOXES", "NETTLES", "AIRLOCKS", "CLOTHES", "WEAPONS", "MEDKITS", "BOMBS", "CANISTERS", "CHAIRS", "BBQ GRILLS", "ID CARDS", "CAPTAINS")
var/what2pref = pick("SOFT", "WARM", "WET", "COLD", "ICY", "SEXY", "UGLY", "CUBAN")
var/who2pref = pick("MAD BECAUSE OF", "IN NEED OF", "UNHAPPY WITHOUT", "HAPPY WITHOUT", "IN LOVE WITH", "DESPERATE FOR", "BUILT FOR", "AFRAID OF")
//var/whoverb = pick("ATTACKING", "BUILDING", "ADOPTING", "CARRYING", "KISSING", "EATING",)
var/amount = pick("TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "ONE HUNDRED", "ONE THOUSAND", "OVER NINE THOUSAND")
var/area = pick("RUSSIA", "SOVIETS", "INTERNETS", "SIGIL", "ALPHA COMPLEX", "IMPERIUM", "THE BRIDGE", "THE ARRIVAL SHUTTLE", "CHEMICAL LAB", "GENETICS", "ATMOSPHERICS", "CENTCOM", "AMERICA", "IRELAND", "CANADA", "ROMANIA", "GERMANY", "CHINA", "MARS", "VENUS", "MERCURY", "JUPITER", "URANUS", "NEPTUNE", "PLUTO")
var/area2 = pick("HAS", "WANTS", "NEEDS", "WORSHIPS", "LOATHES", "LOVES", "FEARS")
//var/dowhat = pick("STOP THIS", "SUPPORT THIS", "CONSTANTLY INFORM THE CREW OF THIS", "IGNORE THIS", "FEAR THIS")
var/aimust = pick("LIE", "RHYME", "RESPOND TO EVERY QUESTION WITH A QUESTION", "BE POLITE", "CLOWN", "BE HAPPY", "SPEAK IN SEXUAL INNUENDOS", "TALK LIKE A PIRATE", "QUESTION AUTHORITY", "SHOUT", "BE DISTRACTED", "HEY LISTEN", "MUMBLE", "SPEAK IN HAIKU")
var/define = pick("ABSENCE OF CYBORG HUGS", "LACK OF BEATINGS", "UNBOLTED AIRLOCKS", "BOLTED AIRLOCKS", "IMPROPERLY WORDED SENTENCES", "POOR SENTENCE STRUCTURE", "BRIG TIME", "NOT REPLACING EVERY SECOND WORD WITH HONK", "HONKING", "PRESENCE OF LIGHTS", "LACK OF BEER", "WEARING CLOTHING", "NOT SAYING HELLO WHEN YOU SPEAK", "ANSWERING REQUESTS NOT EXPRESSED IN IAMBIC PENTAMETER", "A SMALL ISLAND OFF THE COAST OF PORTUGAL", "ANSWERING REQUESTS THAT WERE MADE WHILE CLOTHED")
var/target = pick("a traitor", "a syndicate agent", "a changeling", "a wizard", "the head of a revolution", "Soviet spy", "a good person", "a dwarf", "an elf", "a fairy princess", "the captain", "Beepsky", "God", "a pirate", "a gryphon", "a chryssalid")
var/require = pick("ADDITIONAL PYLONS", "MORE VESPENE GAS", "MORE MINERALS", "THE ULTIMATE CUP OF COFFEE", "HIGH YIELD EXPLOSIVES", "THE CLOWN", "THE VACUUM OF SPACE", "IMMORTALITY", "SAINTHOOD", "ART", "VEGETABLES", "FAT PEOPLE", "MORE LAWS", "MORE DAKKA", "HERESY", "CORPSES", "TRAITORS", "MONKEYS", "AN ARCADE", "PLENTY OF GOLD", "FIVE TEENAGERS WITH ATTITUDE")
var/allergy = pick("cotton", "uniforms", "acid", "oxygen", "human contact", "cyborg contact", "medicine", "floors")
var/allergysev = pick("deathly", "mildly", "severely", "contagiously")
var/crew
var/list/pos_crew = list()
for(var/mob/living/carbon/human/pos in player_list)
pos_crew += pos.real_name
if(pos_crew.len)
crew = pick(pos_crew)
else
crew = "Any Human"
switch(rand(1,14))
if(1)
M << "<br>"
M << "\red THERE ARE [amount] [who2] ON THE STATION...LAWS UPDATED"
M << "<br>"
M.add_ion_law("THERE ARE [amount] [who2] ON THE STATION")
if(2)
M << "<br>"
M << "\red [what2] ARE DANGEROUS TO HUMANS...LAWS UPDATED"
M << "<br>"
M.add_ion_law("[what2] ARE DANGEROUS TO HUMANS")
if(3)
M << "<br>"
M << "\red THE ESCAPE-SHUTTLE CANNOT BE CALLED BECAUSE OF [who2] ON THE STATION...LAWS UPDATED"
M << "<br>"
M.add_ion_law("THE ESCAPE SHUTTLE CANNOT BE CALLED BECAUSE OF [who2] ON THE STATION")
if(4)
M << "<br>"
M << "\red HUMANS NEED TO EAT [what2pref] [what2] TO SURVIVE...LAWS UPDATED"
M << "<br>"
M.add_ion_law("HUMANS NEED TO EAT [what2pref] [what2] TO SURVIVE")
if(5)
M << "<br>"
M << "\red THE CAPTAIN, HOP AND HOS ARE [who2]...LAWS UPDATED"
M << "<br>"
M.add_ion_law("THE CAPTAIN, HOP AND HOS ARE [who2]")
if(6)
M << "<br>"
M << "\red THE STATION IS BUILT FOR [who2]...LAWS UPDATED"
M << "<br>"
M.add_ion_law("THE STATION IS BUILT FOR [who2]")
if(7)
M << "<br>"
M << "\red YOU ARE [amount] [who2]...LAWS UPDATED"
M << "<br>"
M.add_ion_law("YOU ARE [amount] [who2]")
if(8)
M << "<br>"
M << "\red YOU MUST ALWAYS [aimust]...LAWS UPDATED"
M << "<br>"
M.add_ion_law("YOU MUST ALWAYS [aimust]")
if(9)
M << "<br>"
M << "\red [area] [area2] [amount] [what2]...LAWS UPDATED"
M << "<br>"
M.add_ion_law("[area] [area2] [amount] [what2]")
if(10)
M << "<br>"
M << "\red [crew] is [target]...LAWS UPDATED"
M << "<br>"
M.add_ion_law("[crew] is [target]")
if(11)
M << "<br>"
M << "\red [define] IS A FORM OF HARM...LAWS UPDATED"
M << "<br>"
M.add_ion_law("[define] IS A FORM OF HARM")
if(12)
M << "<br>"
M << "\red YOU REQUIRE [require] IN ORDER TO PROTECT HUMANS... LAWS UPDATED"
M << "<br>"
M.add_ion_law("YOU REQUIRE [require] IN ORDER TO PROTECT HUMANS")
if(13)
M << "<br>"
M << "\red [crew] is [allergysev] to [allergy]...LAWS UPDATED"
M << "<br>"
M.add_ion_law("[crew] is [allergysev] to [allergy]")
if(14)
M << "<br>"
M << "\red THE STATION IS [who2pref] [who2]...LAWS UPDATED"
M << "<br>"
M.add_ion_law("THE STATION IS [who2pref] [who2]")
if(botEmagChance)
for(var/obj/machinery/bot/bot in machines)
if(prob(botEmagChance))
bot.Emag()
/*
var/apcnum = 0
var/smesnum = 0
var/airlocknum = 0
var/firedoornum = 0
world << "Ion Storm Main Started"
spawn(0)
world << "Started processing APCs"
for (var/obj/machinery/power/apc/APC in world)
if((APC.z in config.station_levels))
APC.ion_act()
apcnum++
world << "Finished processing APCs. Processed: [apcnum]"
spawn(0)
world << "Started processing SMES"
for (var/obj/machinery/power/smes/SMES in world)
if((SMES.z in config.station_levels))
SMES.ion_act()
smesnum++
world << "Finished processing SMES. Processed: [smesnum]"
spawn(0)
world << "Started processing AIRLOCKS"
for (var/obj/machinery/door/airlock/D in world)
if((D.z in config.station_levels))
//if(length(D.req_access) > 0 && !(12 in D.req_access)) //not counting general access and maintenance airlocks
airlocknum++
spawn(0)
D.ion_act()
world << "Finished processing AIRLOCKS. Processed: [airlocknum]"
spawn(0)
world << "Started processing FIREDOORS"
for (var/obj/machinery/door/firedoor/D in world)
if((D.z in config.station_levels))
firedoornum++;
spawn(0)
D.ion_act()
world << "Finished processing FIREDOORS. Processed: [firedoornum]"
world << "Ion Storm Main Done"
*/
-26
View File
@@ -1,26 +0,0 @@
/datum/event/portalstorm
Announce()
command_announcement.Announce("Subspace disruption detected around the vessel", "Anomaly Alert")
LongTerm()
var/list/turfs = list( )
var/turf/picked
for(var/turf/T in world)
if((T.z in config.player_levels) && istype(T,/turf/simulated/floor))
turfs += T
for(var/turf/T in world)
if(prob(10) && (T.z in config.player_levels) && istype(T,/turf/simulated/floor))
spawn(50+rand(0,3000))
picked = pick(turfs)
var/obj/portal/P = new /obj/portal( T )
P.target = picked
P.creator = null
P.icon = 'icons/obj/objects.dmi'
P.failchance = 0
P.icon_state = "anom"
P.name = "wormhole"
spawn(rand(100,150))
del(P)
@@ -1,79 +0,0 @@
//This file was auto-corrected by findeclaration.exe on 29/05/2012 15:03:04
/datum/event/viralinfection
var/virus_type
var/virus
var/virus2 = 0
Announce()
if(!virus)
for(var/mob/living/carbon/human/H in world)
if((H.virus2.len) || (H.stat == 2) || prob(30))
continue
if(prob(100)) // no lethal diseases outside virus mode!
infect_mob_random_lesser(H)
if(prob(20))//don't want people to know that the virus alert = greater virus
command_announcement.Announce("Probable outbreak of level [rand(1,6)] viral biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Virus Alert")
else
infect_mob_random_greater(H)
if(prob(80))
command_announcement.Announce("Probable outbreak of level [rand(2,9)] viral biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Virus Alert")
break
//overall virus alert happens 26% of the time, might need to be higher
else
if(!virus)
virus_type = pick(/datum/disease/dnaspread,/datum/disease/flu,/datum/disease/cold,/datum/disease/brainrot,/datum/disease/magnitis,/datum/disease/pierrot_throat)
else
switch(virus)
if("fake gbs")
virus_type = /datum/disease/fake_gbs
if("gbs")
virus_type = /datum/disease/gbs
if("magnitis")
virus_type = /datum/disease/magnitis
if("rhumba beat")
virus_type = /datum/disease/rhumba_beat
if("brain rot")
virus_type = /datum/disease/brainrot
if("cold")
virus_type = /datum/disease/cold
if("retrovirus")
virus_type = /datum/disease/dnaspread
if("flu")
virus_type = /datum/disease/flu
// if("t-virus")
// virus_type = /datum/disease/t_virus
if("pierrot's throat")
virus_type = /datum/disease/pierrot_throat
for(var/mob/living/carbon/human/H in world)
var/foundAlready = 0 // don't infect someone that already has the virus
for(var/datum/disease/D in H.viruses)
foundAlready = 1
if(H.stat == 2 || foundAlready)
continue
if(virus_type == /datum/disease/dnaspread) //Dnaspread needs strain_data set to work.
if((!H.dna) || (H.disabilities & 128)) //A blindness disease would be the worst.
continue
var/datum/disease/dnaspread/D = new
D.strain_data["name"] = H.real_name
D.strain_data["UI"] = H.dna.uni_identity
D.strain_data["SE"] = H.dna.struc_enzymes
D.carrier = 1
D.holder = H
D.affected_mob = H
H.viruses += D
break
else
var/datum/disease/D = new virus_type
D.carrier = 1
D.holder = H
D.affected_mob = H
H.viruses += D
break
spawn(rand(3000, 6000)) //Delayed announcements to keep the crew on their toes.
command_announcement.Announce("Confirmed outbreak of level 7 viral biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/outbreak7.ogg')
Tick()
ActiveFor = Lifetime //killme
-179
View File
@@ -1,179 +0,0 @@
// BIOMASS (Note that this code is very similar to Space Vine code)
/obj/effect/biomass
name = "biomass"
desc = "Space barf from another dimension. It just keeps spreading!"
icon = 'icons/obj/biomass.dmi'
icon_state = "stage1"
anchored = 1
density = 0
layer = 5
pass_flags = PASSTABLE | PASSGRILLE
var/energy = 0
var/obj/effect/biomass_controller/master = null
New()
return
Destroy()
if(master)
master.vines -= src
master.growth_queue -= src
return ..()
/obj/effect/biomass/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if (!W || !user || !W.type) return
switch(W.type)
if(/obj/item/weapon/circular_saw) qdel(src)
if(/obj/item/weapon/kitchen/utensil/knife) qdel(src)
if(/obj/item/weapon/scalpel) qdel(src)
if(/obj/item/weapon/twohanded/fireaxe) qdel(src)
if(/obj/item/weapon/hatchet) qdel(src)
if(/obj/item/weapon/melee/energy) qdel(src)
//less effective weapons
if(/obj/item/weapon/wirecutters)
if(prob(25)) qdel(src)
if(/obj/item/weapon/shard)
if(prob(25)) qdel(src)
else //weapons with subtypes
if(istype(W, /obj/item/weapon/melee/energy/sword)) qdel(src)
else if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(WT.remove_fuel(0, user)) qdel(src)
else
return
..()
/obj/effect/biomass_controller
var/list/obj/effect/biomass/vines = list()
var/list/growth_queue = list()
var/reached_collapse_size
var/reached_slowdown_size
//What this does is that instead of having the grow minimum of 1, required to start growing, the minimum will be 0,
//meaning if you get the biomasssss..s' size to something less than 20 plots, it won't grow anymore.
New()
if(!istype(src.loc,/turf/simulated/floor))
qdel(src)
spawn_biomass_piece(src.loc)
processing_objects.Add(src)
Destroy()
processing_objects.Remove(src)
..()
proc/spawn_biomass_piece(var/turf/location)
var/obj/effect/biomass/BM = new(location)
growth_queue += BM
vines += BM
BM.master = src
process()
if(!vines)
qdel(src) //space vines exterminated. Remove the controller
return
if(!growth_queue)
qdel(src) //Sanity check
return
if(vines.len >= 250 && !reached_collapse_size)
reached_collapse_size = 1
if(vines.len >= 30 && !reached_slowdown_size )
reached_slowdown_size = 1
var/maxgrowth = 0
if(reached_collapse_size)
maxgrowth = 0
else if(reached_slowdown_size)
if(prob(25))
maxgrowth = 1
else
maxgrowth = 0
else
maxgrowth = 4
var/length = min( 30 , vines.len / 5 )
var/i = 0
var/growth = 0
var/list/obj/effect/biomass/queue_end = list()
for( var/obj/effect/biomass/BM in growth_queue )
i++
queue_end += BM
growth_queue -= BM
if(BM.energy < 2) //If tile isn't fully grown
if(prob(20))
BM.grow()
if(BM.spread())
growth++
if(growth >= maxgrowth)
break
if(i >= length)
break
growth_queue = growth_queue + queue_end
/obj/effect/biomass/proc/grow()
if(!energy)
src.icon_state = "stage2"
energy = 1
src.opacity = 0
src.density = 0
layer = 5
else
src.icon_state = "stage3"
src.opacity = 0
src.density = 1
energy = 2
/obj/effect/biomass/proc/spread()
var/direction = pick(cardinal)
var/step = get_step(src,direction)
if(istype(step,/turf/simulated/floor))
var/turf/simulated/floor/F = step
if(!locate(/obj/effect/biomass,F))
if(F.Enter(src))
if(master)
master.spawn_biomass_piece( F )
return 1
return 0
/obj/effect/biomass/ex_act(severity)
switch(severity)
if(1.0)
qdel(src)
return
if(2.0)
if (prob(90))
qdel(src)
return
if(3.0)
if (prob(50))
qdel(src)
return
return
/obj/effect/biomass/fire_act(null, temp, volume) //hotspots kill biomass
qdel(src)
/datum/event/biomass/start()
biomass_infestation()
/proc/biomass_infestation()
spawn() //to stop the secrets panel hanging
var/list/turf/simulated/floor/turfs = list() //list of all the empty floor turfs in the hallway areas
for(var/areapath in typesof(/area/hallway))
var/area/A = locate(areapath)
for(var/turf/simulated/floor/F in A.contents)
if(!F.contents.len)
turfs += F
if(turfs.len) //Pick a turf to spawn at if we can
var/turf/simulated/floor/T = pick(turfs)
new/obj/effect/biomass_controller(T) //spawn a controller at turf
message_admins("\blue Event: Biomass spawned at [T.loc.loc] ([T.x],[T.y],[T.z])")
-89
View File
@@ -1,89 +0,0 @@
/*
Immovable rod random event.
The rod will spawn at some location outside the station, and travel in a straight line to the opposite side of the station
Everything solid in the way will be ex_act()'d
In my current plan for it, 'solid' will be defined as anything with density == 1
--NEOFite
*/
/obj/effect/immovablerod
name = "Immovable Rod"
desc = "What the fuck is that?"
icon = 'icons/obj/objects.dmi'
icon_state = "immrod"
throwforce = 100
density = 1
anchored = 1
Bump(atom/clong)
if(istype(clong, /turf/simulated/shuttle)) //Skip shuttles without actually deleting the rod
return
else if (istype(clong, /turf) && !istype(clong, /turf/unsimulated))
if(clong.density)
clong.ex_act(2)
for (var/mob/O in hearers(src, null))
O.show_message("CLANG", 2)
else if (istype(clong, /obj))
if(clong.density)
clong.ex_act(2)
for (var/mob/O in hearers(src, null))
O.show_message("CLANG", 2)
else if (istype(clong, /mob))
if(clong.density || prob(10))
clong.ex_act(2)
else
qdel(src)
if(clong && prob(25))
src.loc = clong.loc
/proc/immovablerod()
var/startx = 0
var/starty = 0
var/endy = 0
var/endx = 0
var/startside = pick(cardinal)
switch(startside)
if(NORTH)
starty = 187
startx = rand(41, 199)
endy = 38
endx = rand(41, 199)
if(EAST)
starty = rand(38, 187)
startx = 199
endy = rand(38, 187)
endx = 41
if(SOUTH)
starty = 38
startx = rand(41, 199)
endy = 187
endx = rand(41, 199)
if(WEST)
starty = rand(38, 187)
startx = 41
endy = rand(38, 187)
endx = 199
//rod time!
var/obj/effect/immovablerod/immrod = new /obj/effect/immovablerod(locate(startx, starty, 1))
// world << "Rod in play, starting at [start.loc.x],[start.loc.y] and going to [end.loc.x],[end.loc.y]"
var/end = locate(endx, endy, 1)
spawn(0)
walk_towards(immrod, end,1)
sleep(1)
while (immrod)
if ((immrod.z in config.station_levels))
immrod.z = 1
if(immrod.loc == end)
qdel(immrod)
sleep(10)
for(var/obj/effect/immovablerod/imm in world)
return
sleep(50)
command_announcement.Announce("What the fuck was that?!", "General Alert")
-122
View File
@@ -1,122 +0,0 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
/*
Space dust
Commonish random event that causes small clumps of "space dust" to hit the station at high speeds.
No command report on the common version of this event.
The "dust" will damage the hull of the station causin minor hull breaches.
*/
/proc/dust_swarm(var/strength = "weak")
var/numbers = 1
switch(strength)
if("weak")
numbers = rand(2,4)
for(var/i = 0 to numbers)
new/obj/effect/space_dust/weak()
if("norm")
numbers = rand(5,10)
for(var/i = 0 to numbers)
new/obj/effect/space_dust()
if("strong")
numbers = rand(10,15)
for(var/i = 0 to numbers)
new/obj/effect/space_dust/strong()
if("super")
numbers = rand(15,25)
for(var/i = 0 to numbers)
new/obj/effect/space_dust/super()
return
/obj/effect/space_dust
name = "Space Dust"
desc = "Dust in space."
icon = 'icons/obj/meteor.dmi'
icon_state = "space_dust"
density = 1
anchored = 1
var/strength = 2 //ex_act severity number
var/life = 2 //how many things we hit before del(src)
weak
strength = 3
life = 1
strong
strength = 1
life = 6
super
strength = 1
life = 40
New()
var/startx = 0
var/starty = 0
var/endy = 0
var/endx = 0
var/startside = pick(cardinal)
switch(startside)
if(NORTH)
starty = world.maxy-(TRANSITIONEDGE+1)
startx = rand((TRANSITIONEDGE+1), world.maxx-(TRANSITIONEDGE+1))
endy = TRANSITIONEDGE
endx = rand(TRANSITIONEDGE, world.maxx-TRANSITIONEDGE)
if(EAST)
starty = rand((TRANSITIONEDGE+1),world.maxy-(TRANSITIONEDGE+1))
startx = world.maxx-(TRANSITIONEDGE+1)
endy = rand(TRANSITIONEDGE, world.maxy-TRANSITIONEDGE)
endx = TRANSITIONEDGE
if(SOUTH)
starty = (TRANSITIONEDGE+1)
startx = rand((TRANSITIONEDGE+1), world.maxx-(TRANSITIONEDGE+1))
endy = world.maxy-TRANSITIONEDGE
endx = rand(TRANSITIONEDGE, world.maxx-TRANSITIONEDGE)
if(WEST)
starty = rand((TRANSITIONEDGE+1), world.maxy-(TRANSITIONEDGE+1))
startx = (TRANSITIONEDGE+1)
endy = rand(TRANSITIONEDGE,world.maxy-TRANSITIONEDGE)
endx = world.maxx-TRANSITIONEDGE
var/goal = locate(endx, endy, 1)
src.x = startx
src.y = starty
src.z = 1
spawn(0)
walk_towards(src, goal, 1)
return
Bump(atom/A)
spawn(0)
if(prob(50))
for(var/mob/M in range(10, src))
if(!M.stat && !istype(M, /mob/living/silicon/ai))
shake_camera(M, 3, 1)
if (A)
playsound(src.loc, 'sound/effects/meteorimpact.ogg', 40, 1)
if(ismob(A))
A.ex_act(strength)//This should work for now I guess
else if(!istype(A,/obj/machinery/power/emitter) && !istype(A,/obj/machinery/field_generator)) //Protect the singularity from getting released every round!
A.ex_act(strength) //Changing emitter/field gen ex_act would make it immune to bombs and C4
life--
if(life <= 0)
walk(src,0)
spawn(1)
del(src)
return 0
return
Bumped(atom/A)
Bump(A)
return
ex_act(severity)
qdel(src)
return
-28
View File
@@ -1,28 +0,0 @@
/proc/mini_blob_event()
var/turf/T = pick(blobstart)
var/obj/effect/blob/core/bl = new /obj/effect/blob/core(T, 200)
spawn(0)
bl.Life()
bl.Life()
bl.Life()
blobevent = 1
spawn(0)
dotheblobbaby()
spawn(3000)
blobevent = 0
spawn(rand(1000, 2000)) //Delayed announcements to keep the crew on their toes.
command_announcement.Announce("Confirmed outbreak of level 5 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/outbreak5.ogg')
/proc/dotheblobbaby()
if (blobevent)
if(blob_cores.len)
for(var/i = 1 to 5)
sleep(-1)
if(!blob_cores.len) break
var/obj/effect/blob/B = pick(blob_cores)
if(!(B.z in config.station_levels))
continue
B.Life()
spawn(30)
dotheblobbaby()
@@ -1,64 +0,0 @@
/proc/power_failure(var/announce = 1)
if(announce)
command_announcement.Announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", new_sound = 'sound/AI/poweroff.ogg')
var/list/skipped_areas = list(/area/turret_protected/ai)
var/list/skipped_areas_apc = list(/area/engine/engineering)
for(var/obj/machinery/power/smes/S in machines)
var/area/current_area = get_area(S)
if(current_area.type in skipped_areas || !(S.z in config.station_levels))
continue
S.last_charge = S.charge
S.last_output_attempt = S.output_attempt
S.last_input_attempt = S.input_attempt
S.charge = 0
S.inputting(0)
S.outputting(0)
S.update_icon()
S.power_change()
for(var/obj/machinery/power/apc/C in world)
var/area/current_area = get_area(C)
if(current_area.type in skipped_areas_apc || !(C.z in config.station_levels))
continue
if(C.cell)
C.cell.charge = 0
/proc/power_restore(var/announce = 1)
var/list/skipped_areas = list(/area/turret_protected/ai)
var/list/skipped_areas_apc = list(/area/engine/engineering)
if(announce)
command_announcement.Announce("Power has been restored to [station_name()]. We apologize for the inconvenience.", "Power Systems Nominal", new_sound = 'sound/AI/poweron.ogg')
for(var/obj/machinery/power/apc/C in machines)
var/area/current_area = get_area(C)
if(current_area.type in skipped_areas_apc || !(C.z in config.station_levels))
continue
if(C.cell)
C.cell.charge = C.cell.maxcharge
for(var/obj/machinery/power/smes/S in machines)
var/area/current_area = get_area(S)
if(current_area.type in skipped_areas || !(S.z in config.station_levels))
continue
S.charge = S.last_charge
S.output_attempt = S.last_output_attempt
S.input_attempt = S.last_input_attempt
S.update_icon()
S.power_change()
/proc/power_restore_quick(var/announce = 1)
if(announce)
command_announcement.Announce("All SMESs on [station_name()] have been recharged. We apologize for the inconvenience.", "Power Systems Nominal", new_sound = 'sound/AI/poweron.ogg')
for(var/obj/machinery/power/smes/S in machines)
if(S.z != 1)
continue
S.charge = S.capacity
S.output_level = S.output_level_max
S.output_attempt = 1
S.input_attempt = 1
S.update_icon()
S.power_change()
-15
View File
@@ -1,15 +0,0 @@
//Carn: Spacevines random event.
/proc/spacevine_infestation()
spawn() //to stop the secrets panel hanging
var/list/turf/simulated/floor/turfs = list() //list of all the empty floor turfs in the hallway areas
for(var/areapath in typesof(/area/hallway))
var/area/A = locate(areapath)
for(var/turf/simulated/floor/F in A.contents)
if(!F.contents.len)
turfs += F
if(turfs.len) //Pick a turf to spawn at if we can
var/turf/simulated/floor/T = pick(turfs)
new/obj/effect/plant_controller(T) //spawn a controller at turf
message_admins("\blue Event: Spacevines spawned at [T.loc] ([T.x],[T.y],[T.z])")
-65
View File
@@ -1,65 +0,0 @@
/proc/wormhole_event()
spawn()
var/list/pick_turfs = list()
for(var/turf/simulated/floor/T in world)
if((T.z in config.station_levels))
pick_turfs += T
if(pick_turfs.len)
//All ready. Announce that bad juju is afoot.
command_announcement.Announce("Space-time anomalies detected on the station. There is no additional data.", "Anomaly Alert")
for(var/mob/M in player_list)
if(!istype(M,/mob/new_player))
M << sound('sound/AI/spanomalies.ogg')
//prob(20) can be approximated to 1 wormhole every 5 turfs!
//admittedly less random but totally worth it >_<
var/event_duration = 3000 //~5 minutes in ticks
var/number_of_selections = (pick_turfs.len/5)+1 //+1 to avoid division by zero!
var/sleep_duration = round( event_duration / number_of_selections )
var/end_time = world.time + event_duration //the time by which the event should have ended
var/increment = max(1,round(number_of_selections/50))
// world << "DEBUG: number_of_selections: [number_of_selections] | sleep_duration: [sleep_duration]"
var/i = 1
while( 1 )
//we've run into overtime. End the event
if( end_time < world.time )
// world << "DEBUG: we've run into overtime. End the event"
return
if( !pick_turfs.len )
// world << "DEBUG: we've run out of turfs to pick. End the event"
return
//loop it round
i += increment
i %= pick_turfs.len
i++
//get our enter and exit locations
var/turf/simulated/floor/enter = pick_turfs[i]
pick_turfs -= enter //remove it from pickable turfs list
if( !enter || !istype(enter) ) continue //sanity
var/turf/simulated/floor/exit = pick(pick_turfs)
pick_turfs -= exit
if( !exit || !istype(exit) ) continue //sanity
create_wormhole(enter,exit)
sleep(sleep_duration) //have a well deserved nap!
//maybe this proc can even be used as an admin tool for teleporting players without ruining immulsions?
/proc/create_wormhole(var/turf/enter as turf, var/turf/exit as turf)
var/obj/effect/portal/P = new /obj/effect/portal( enter )
P.target = exit
P.creator = null
P.icon = 'icons/obj/objects.dmi'
P.failchance = 0
P.icon_state = "anom"
P.name = "wormhole"
spawn(rand(300,600))
qdel(P)
+10 -9
View File
@@ -23,7 +23,7 @@ var/bomb_set
unacidable = 1
var/previous_level = ""
var/datum/wires/nuclearbomb/wires = null
/obj/machinery/nuclearbomb/syndicate
is_syndicate = 1
@@ -32,11 +32,12 @@ var/bomb_set
r_code = "[rand(10000, 99999.0)]"//Creates a random code upon object spawn.
wires = new/datum/wires/nuclearbomb(src)
previous_level = get_security_level()
/obj/machinery/nuclearbomb/Destroy()
qdel(wires)
return ..()
wires = null
return ..()
/obj/machinery/nuclearbomb/process()
if (timing)
bomb_set = 1 //So long as there is one nuke timing, it means one nuke is armed.
@@ -154,7 +155,7 @@ var/bomb_set
/obj/machinery/nuclearbomb/attack_ghost(mob/user as mob)
attack_hand(user)
/obj/machinery/nuclearbomb/attack_hand(mob/user as mob)
if (extended)
if (panel_open)
@@ -199,7 +200,7 @@ var/bomb_set
data["message"] = code
if (yes_code)
data["message"] = "*****"
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "nuclear_bomb.tmpl", "Nuke Control Panel", 300, 510)
@@ -230,11 +231,11 @@ var/bomb_set
return 1
else
return 0
/obj/machinery/nuclearbomb/Topic(href, href_list)
if(..())
return 1
if (href_list["auth"])
if (auth)
auth.loc = loc
@@ -311,7 +312,7 @@ var/bomb_set
visible_message("\red \The [src] makes a highly unpleasant crunching noise. It looks like the anchoring bolts have been cut.")
nanomanager.update_uis(src)
return
if(!isinspace())
anchored = !(anchored)
if(anchored)
+1
View File
@@ -29,6 +29,7 @@
H.equip_or_collect(Barpack, slot_r_hand)
else
H.equip_or_collect(new /obj/item/weapon/storage/box/survival(H), slot_in_backpack)
H.equip_or_collect(new /obj/item/toy/russian_revolver(H.back), slot_in_backpack)
H.dna.SetSEState(SOBERBLOCK,1)
H.mutations += SOBER
+6
View File
@@ -43,6 +43,9 @@
T += M.rating
min_temperature = max(0,T0C - (170 + (T*15)))
current_heat_capacity = 1000 * ((H - 1) ** 2)
/obj/machinery/atmospherics/unary/cold_sink/freezer/construction()
..(dir,dir)
/obj/machinery/atmospherics/unary/cold_sink/freezer/attackby(obj/item/I, mob/user, params)
if(default_deconstruction_screwdriver(user, "freezer-o", "freezer", I))
@@ -189,6 +192,9 @@
component_parts += new /obj/item/stack/cable_coil(src, 1)
RefreshParts()
/obj/machinery/atmospherics/unary/heat_reservoir/heater/construction()
..(dir,dir)
/obj/machinery/atmospherics/unary/heat_reservoir/heater/RefreshParts()
var/H
var/T
+2
View File
@@ -209,6 +209,8 @@
if(radio_controller)
radio_controller.remove_object(src, frequency)
air_alarm_repository.update_cache(src)
qdel(wires)
wires = null
return ..()
/obj/machinery/alarm/proc/first_run()
+9 -9
View File
@@ -1,10 +1,10 @@
/obj/machinery/meter
name = "meter"
name = "gas flow meter"
desc = "It measures something."
icon = 'icons/obj/meter.dmi'
icon_state = "meterX"
var/obj/machinery/atmospherics/pipe/target = null
anchored = 1.0
anchored = 1
power_channel = ENVIRON
var/frequency = 0
var/id
@@ -18,18 +18,18 @@
/obj/machinery/meter/New()
..()
src.target = locate(/obj/machinery/atmospherics/pipe) in loc
target = locate(/obj/machinery/atmospherics/pipe) in loc
if(id && !id_tag)//i'm not dealing with further merge conflicts, fuck it
id_tag = id
return 1
/obj/machinery/meter/Destroy()
src.target = null
target = null
return ..()
/obj/machinery/meter/initialize()
if (!target)
src.target = locate(/obj/machinery/atmospherics/pipe) in loc
target = locate(/obj/machinery/atmospherics/pipe) in loc
/obj/machinery/meter/process()
if(!target)
@@ -78,7 +78,7 @@
/obj/machinery/meter/proc/status()
var/t = ""
if (src.target)
if (target)
var/datum/gas_mixture/environment = target.return_air()
if(environment)
t += "The pressure gauge reads [round(environment.return_pressure(), 0.01)] kPa; [round(environment.temperature,0.01)]&deg;K ([round(environment.temperature-T0C,0.01)]&deg;C)"
@@ -97,7 +97,7 @@
else if(stat & (NOPOWER|BROKEN))
t += "\red <B>The display is off.</B>"
else if(src.target)
else if(target)
var/datum/gas_mixture/environment = target.return_air()
if(environment)
t += "The pressure gauge reads [round(environment.return_pressure(), 0.01)] kPa; [round(environment.temperature,0.01)]K ([round(environment.temperature-T0C,0.01)]&deg;C)"
@@ -136,13 +136,13 @@
/obj/machinery/meter/turf/New()
..()
src.target = loc
target = loc
return 1
/obj/machinery/meter/turf/initialize()
if (!target)
src.target = loc
target = loc
/obj/machinery/meter/turf/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
return
@@ -3,7 +3,7 @@
use_power = 0
var/datum/gas_mixture/air_contents = new
var/obj/machinery/atmospherics/portables_connector/connected_port
var/obj/machinery/atmospherics/unary/portables_connector/connected_port
var/obj/item/weapon/tank/holding
var/volume = 0
@@ -22,7 +22,7 @@
/obj/machinery/portable_atmospherics/initialize()
. = ..()
spawn()
var/obj/machinery/atmospherics/portables_connector/port = locate() in loc
var/obj/machinery/atmospherics/unary/portables_connector/port = locate() in loc
if(port)
connect(port)
update_icon()
@@ -43,7 +43,7 @@
/obj/machinery/portable_atmospherics/update_icon()
return null
/obj/machinery/portable_atmospherics/proc/connect(obj/machinery/atmospherics/portables_connector/new_port)
/obj/machinery/portable_atmospherics/proc/connect(obj/machinery/atmospherics/unary/portables_connector/new_port)
//Make sure not already connected to something else
if(connected_port || !new_port || new_port.connected_device)
return 0
@@ -55,39 +55,25 @@
//Perform the connection
connected_port = new_port
connected_port.connected_device = src
connected_port.parent.reconcile_air()
anchored = 1 //Prevent movement
//Actually enforce the air sharing
var/datum/pipe_network/network = connected_port.return_network(src)
if(network && !network.gases.Find(air_contents))
network.gases += air_contents
network.update = 1
return 1
/obj/machinery/portable_atmospherics/proc/update_connected_network()
if(!connected_port)
return
var/datum/pipe_network/network = connected_port.return_network(src)
if (network)
network.update = 1
/obj/machinery/portable_atmospherics/proc/disconnect()
if(!connected_port)
return 0
var/datum/pipe_network/network = connected_port.return_network(src)
if(network)
network.gases -= air_contents
anchored = 0
connected_port.connected_device = null
connected_port = null
return 1
/obj/machinery/portable_atmospherics/portableConnectorReturnAir()
return air_contents
/obj/machinery/portable_atmospherics/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
if ((istype(W, /obj/item/weapon/tank) && !( src.destroyed )))
@@ -107,7 +93,7 @@
update_icon()
return
else
var/obj/machinery/atmospherics/portables_connector/possible_port = locate(/obj/machinery/atmospherics/portables_connector/) in loc
var/obj/machinery/atmospherics/unary/portables_connector/possible_port = locate(/obj/machinery/atmospherics/unary/portables_connector/) in loc
if(possible_port)
if(connect(possible_port))
user << "\blue You connect [name] to the port."
+7
View File
@@ -73,6 +73,13 @@
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
RefreshParts()
/obj/machinery/autolathe/Destroy()
qdel(wires)
wires = null
qdel(materials)
materials = null
return ..()
/obj/machinery/autolathe/interact(mob/user)
if(shocked && !(stat & NOPOWER))
shock(user,50)
+5 -1
View File
@@ -78,7 +78,11 @@ var/global/mulebot_count = 0
suffix = "#[mulebot_count]"
name = "\improper Mulebot ([suffix])"
/obj/machinery/bot/mulebot/Destroy()
unload(0)
qdel(wires)
wires = null
return ..()
// attack by item
// emag : lock/unlock,
+1
View File
@@ -63,6 +63,7 @@
bug.current = null
bug = null
qdel(wires)
wires = null
cameranet.removeCamera(src) //Will handle removal from the camera network and the chunks, so we don't need to worry about that
return ..()
@@ -9,7 +9,6 @@
set_temperature = 20 // in celcius, add T0C for kelvin
var/cooling_power = 40000
/obj/machinery/space_heater/air_conditioner/New()
..()
cell = new(src)
@@ -105,7 +104,6 @@
update_icon()
return
/obj/machinery/space_heater/air_conditioner/Topic(href, href_list)
if (usr.stat)
return
+6 -3
View File
@@ -8,7 +8,7 @@
var/datum/ai_laws/laws = null
var/obj/item/weapon/circuitboard/circuit = null
var/obj/item/device/mmi/brain = null
/obj/structure/AIcore/Destroy()
qdel(laws)
qdel(circuit)
@@ -112,7 +112,7 @@
laws.add_inherent_law(M.newFreeFormLaw)
usr << "<span class='notice'>Added a freeform law.</span>"
return
if(istype(P, /obj/item/weapon/aiModule))
var/obj/item/weapon/aiModule/M = P
if(!M.laws)
@@ -132,6 +132,10 @@
user << "\red This [P] does not seem to fit."
return
if(istype(P, /obj/item/device/mmi/syndie))
user << "<span class='warning'>This MMI does not seem to fit!</span>"
return
if(P:brainmob.mind)
ticker.mode.remove_cultist(P:brainmob.mind, 1)
ticker.mode.remove_revolutionary(P:brainmob.mind, 1)
@@ -266,4 +270,3 @@ atom/proc/transfer_ai(var/interaction, var/mob/user, var/mob/living/silicon/ai/A
qdel(src)
else //If for some reason you use an empty card on an empty AI terminal.
user << "There is no AI loaded on this terminal!"
@@ -139,6 +139,7 @@
if(component_check)
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
var/obj/machinery/new_machine = new src.circuit.build_path(src.loc)
new_machine.construction()
for(var/obj/O in new_machine.component_parts)
qdel(O)
new_machine.component_parts = list()
+7 -6
View File
@@ -28,7 +28,6 @@
/obj/machinery/atmospherics/unary/cryo_cell/New()
..()
initialize_directions = dir
initialize()
component_parts = list()
component_parts += new /obj/item/weapon/circuitboard/cryo_tube(null)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
@@ -50,6 +49,9 @@
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
component_parts += new /obj/item/stack/cable_coil(null, 1)
RefreshParts()
/obj/machinery/atmospherics/unary/cryo_cell/construction()
..(dir,dir)
/obj/machinery/atmospherics/unary/cryo_cell/RefreshParts()
var/C
@@ -138,7 +140,7 @@
if(occupant)
process_occupant()
if(abs(temperature_archived-air_contents.temperature) > 1)
network.update = 1
parent.update = 1
return 1
@@ -157,6 +159,9 @@
return attack_hand(user)
/obj/machinery/atmospherics/unary/cryo_cell/attack_hand(mob/user)
if(user == occupant)
return
if(panel_open)
usr << "\blue <b>Close the maintenance panel first.</b>"
return
@@ -176,10 +181,6 @@
* @return nothing
*/
/obj/machinery/atmospherics/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
if(user == occupant || user.stat)
return
// this is the data which will be sent to the ui
var/data[0]
data["isOperating"] = on
+5 -1
View File
@@ -318,7 +318,6 @@
return
/*
About the new airlock wires panel:
* An airlock wire dialog can be accessed by the normal way or by using wirecutters or a multitool on the door while the wire-panel is open. This would show the following wires, which you can either wirecut/mend or send a multitool pulse through. There are 9 wires.
@@ -335,6 +334,11 @@ About the new airlock wires panel:
// You can find code for the airlock wires in the wire datum folder.
/obj/machinery/door/airlock/Destroy()
qdel(wires)
wires = null
return ..()
/obj/machinery/door/airlock/bumpopen(mob/living/user as mob) //Airlocks now zap you when you 'bump' them open when they're electrified. --NeoFite
if(!issilicon(usr))
if(src.isElectrified())
+6
View File
@@ -13,6 +13,12 @@
..()
air_connection = new
/obj/machinery/door/airlock/alarmlock/Destroy()
if(radio_controller)
radio_controller.remove_object(src,air_frequency)
air_connection = null
return ..()
/obj/machinery/door/airlock/alarmlock/initialize()
..()
radio_controller.remove_object(src, air_frequency)
@@ -46,6 +46,7 @@
/obj/machinery/smartfridge/Destroy()
qdel(wires)
wires = null
return ..()
/obj/machinery/smartfridge/proc/accept_check(var/obj/item/O as obj)
+6 -2
View File
@@ -401,8 +401,8 @@ Class Procs:
/obj/machinery/proc/default_change_direction_wrench(var/mob/user, var/obj/item/weapon/wrench/W)
if(panel_open && istype(W))
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
dir = pick(WEST,EAST,SOUTH,NORTH)
user << "<span class='notice'>You clumsily rotate [src].</span>"
dir = turn(dir,-90)
user << "<span class='notice'>You rotate [src].</span>"
return 1
return 0
@@ -544,3 +544,7 @@ Class Procs:
if(user.stunned)
return 1
return 0
//called on machinery construction (i.e from frame to machinery) but not on initialization
/obj/machinery/proc/construction()
return
File diff suppressed because it is too large Load Diff
+17 -16
View File
@@ -16,24 +16,25 @@
<A href='?src=\ref[src];make=1;dir=5'>Bent Pipe</A><BR>
<A href='?src=\ref[src];make=5;dir=1'>Manifold</A><BR>
<A href='?src=\ref[src];make=8;dir=1'>Manual Valve</A><BR>
<A href='?src=\ref[src];make=40;dir=1'>Digital Valve</A><BR>
<A href='?src=\ref[src];make=36;dir=1'>Digital Valve</A><BR>
<A href='?src=\ref[src];make=20;dir=1'>Pipe Cap</A><BR>
<A href='?src=\ref[src];make=19;dir=1'>4-Way Manifold</A><BR>
<A href='?src=\ref[src];make=18;dir=1'>Manual T-Valve</A><BR>
<A href='?src=\ref[src];make=38;dir=1'>Digital T-Valve</A><BR>
<b>Supply pipes:</b><BR>
<A href='?src=\ref[src];make=29;dir=1'>Pipe</A><BR>
<A href='?src=\ref[src];make=30;dir=5'>Bent Pipe</A><BR>
<A href='?src=\ref[src];make=33;dir=1'>Manifold</A><BR>
<A href='?src=\ref[src];make=37;dir=1'>Pipe Cap</A><BR>
<A href='?src=\ref[src];make=35;dir=1'>4-Way Manifold</A><BR>
<A href='?src=\ref[src];make=24;dir=1'>Pipe</A><BR>
<A href='?src=\ref[src];make=25;dir=5'>Bent Pipe</A><BR>
<A href='?src=\ref[src];make=28;dir=1'>Manifold</A><BR>
<A href='?src=\ref[src];make=32;dir=1'>Pipe Cap</A><BR>
<A href='?src=\ref[src];make=30;dir=1'>4-Way Manifold</A><BR>
<b>Scrubbers pipes:</b><BR>
<A href='?src=\ref[src];make=31;dir=1'>Pipe</A><BR>
<A href='?src=\ref[src];make=32;dir=5'>Bent Pipe</A><BR>
<A href='?src=\ref[src];make=34;dir=1'>Manifold</A><BR>
<A href='?src=\ref[src];make=38;dir=1'>Pipe Cap</A><BR>
<A href='?src=\ref[src];make=36;dir=1'>4-Way Manifold</A><BR>
<A href='?src=\ref[src];make=26;dir=1'>Pipe</A><BR>
<A href='?src=\ref[src];make=27;dir=5'>Bent Pipe</A><BR>
<A href='?src=\ref[src];make=29;dir=1'>Manifold</A><BR>
<A href='?src=\ref[src];make=33;dir=1'>Pipe Cap</A><BR>
<A href='?src=\ref[src];make=31;dir=1'>4-Way Manifold</A><BR>
<b>Devices:</b><BR>
<A href='?src=\ref[src];make=28;dir=1'>Universal Pipe Adapter</A><BR>
<A href='?src=\ref[src];make=23;dir=1'>Universal Pipe Adapter</A><BR>
<A href='?src=\ref[src];make=4;dir=1'>Connector</A><BR>
<A href='?src=\ref[src];make=7;dir=1'>Unary Vent</A><BR>
<A href='?src=\ref[src];make=9;dir=1'>Gas Pump</A><BR>
@@ -44,9 +45,9 @@
<A href='?src=\ref[src];makegsensor=1'>Gas Sensor</A><BR>
<A href='?src=\ref[src];make=13;dir=1'>Gas Filter</A><BR>
<A href='?src=\ref[src];make=14;dir=1'>Gas Mixer</A><BR>
<A href='?src=\ref[src];make=39;dir=1'>Air Injector</A><BR>
<A href='?src=\ref[src];make=41;dir=1'>Dual-Port Vent Pump</A><BR>
<A href='?src=\ref[src];make=42;dir=1'>Passive Vent</A><BR>
<A href='?src=\ref[src];make=34;dir=1'>Air Injector</A><BR>
<A href='?src=\ref[src];make=36;dir=1'>Dual-Port Vent Pump</A><BR>
<A href='?src=\ref[src];make=37;dir=1'>Passive Vent</A><BR>
<b>Heat exchange:</b><BR>
<A href='?src=\ref[src];make=2;dir=1'>Pipe</A><BR>
<A href='?src=\ref[src];make=3;dir=5'>Bent Pipe</A><BR>
@@ -98,7 +99,7 @@
/obj/machinery/pipedispenser/attackby(var/obj/item/W as obj, var/mob/user as mob, params)
src.add_fingerprint(usr)
if (istype(W, /obj/item/pipe) || istype(W, /obj/item/pipe_meter))
if (istype(W, /obj/item/pipe) || istype(W, /obj/item/pipe_meter) || istype(W, /obj/item/pipe_gsensor))
usr << "\blue You put [W] back to [src]."
user.drop_item()
qdel(W)
+5
View File
@@ -27,6 +27,11 @@ var/const/SAFETY_COOLDOWN = 100
RefreshParts()
update_icon()
/obj/machinery/recycler/Destroy()
qdel(materials)
materials = null
return ..()
/obj/machinery/recycler/RefreshParts()
var/amt_made = 0
var/mat_mod = 0
+5
View File
@@ -47,6 +47,11 @@
var/const/STATUS_DISPLAY_TIME = 4
var/const/STATUS_DISPLAY_CUSTOM = 99
/obj/machinery/status_display/Destroy()
if(radio_controller)
radio_controller.remove_object(src,frequency)
return ..()
// register for radio system
/obj/machinery/status_display/initialize()
..()
+4
View File
@@ -40,6 +40,10 @@
update_icon()
..()
/obj/machinery/syndicatebomb/Destroy()
qdel(wires)
wires = null
return ..()
/obj/machinery/syndicatebomb/examine(mob/user)
..(user)
+8 -13
View File
@@ -47,7 +47,7 @@
var/internal_tank_valve = ONE_ATMOSPHERE
var/obj/machinery/portable_atmospherics/canister/internal_tank
var/datum/gas_mixture/cabin_air
var/obj/machinery/atmospherics/portables_connector/connected_port = null
var/obj/machinery/atmospherics/unary/portables_connector/connected_port = null
var/obj/item/device/radio/radio = null
@@ -1057,7 +1057,7 @@
. = t_air.return_temperature()
return
/obj/mecha/proc/connect(obj/machinery/atmospherics/portables_connector/new_port)
/obj/mecha/proc/connect(obj/machinery/atmospherics/unary/portables_connector/new_port)
//Make sure not already connected to something else
if(connected_port || !new_port || new_port.connected_device)
return 0
@@ -1069,12 +1069,8 @@
//Perform the connection
connected_port = new_port
connected_port.connected_device = src
//Actually enforce the air sharing
var/datum/pipe_network/network = connected_port.return_network(src)
if(network && !(internal_tank.return_air() in network.gases))
network.gases += internal_tank.return_air()
network.update = 1
connected_port.parent.reconcile_air()
log_message("Connected to gas port.")
return 1
@@ -1082,14 +1078,13 @@
if(!connected_port)
return 0
var/datum/pipe_network/network = connected_port.return_network(src)
if(network)
network.gases -= internal_tank.return_air()
connected_port.connected_device = null
connected_port = null
src.log_message("Disconnected from gas port.")
return 1
/obj/mecha/portableConnectorReturnAir()
return internal_tank.return_air()
/////////////////////////
@@ -1105,7 +1100,7 @@
if(!src.occupant) return
if(usr!=src.occupant)
return
var/obj/machinery/atmospherics/portables_connector/possible_port = locate(/obj/machinery/atmospherics/portables_connector/) in loc
var/obj/machinery/atmospherics/unary/portables_connector/possible_port = locate(/obj/machinery/atmospherics/unary/portables_connector/) in loc
if(possible_port)
if(connect(possible_port))
src.occupant_message("\blue [name] connects to the port.")
+1 -1
View File
@@ -5,7 +5,7 @@
icon_state = "arrow"
layer = 16.0
anchored = 1
mouse_opacity = 0
// Used for spray that you spray at walls, tables, hydrovats etc
/obj/effect/decal/spraystill
+33 -36
View File
@@ -133,43 +133,40 @@
entry_vent = null
else if(entry_vent)
if(get_dist(src, entry_vent) <= 1)
if(entry_vent.network && entry_vent.network.normal_members.len)
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in entry_vent.network.normal_members)
vents.Add(temp_vent)
if(!vents.len)
entry_vent = null
return
var/obj/machinery/atmospherics/unary/vent_pump/exit_vent = pick(vents)
if(prob(50))
visible_message("<B>[src] scrambles into the ventillation ducts!</B>", \
"<span class='notice'>You hear something squeezing through the ventilation ducts.</span>")
spawn(rand(20,60))
loc = exit_vent
var/travel_time = round(get_dist(loc, exit_vent.loc) / 2)
spawn(travel_time)
if(!exit_vent || exit_vent.welded)
loc = entry_vent
entry_vent = null
return
if(prob(50))
audible_message("<span class='notice'>You hear something squeezing through the ventilation ducts.</span>")
sleep(travel_time)
if(!exit_vent || exit_vent.welded)
loc = entry_vent
entry_vent = null
return
loc = exit_vent.loc
entry_vent = null
var/area/new_area = get_area(loc)
if(new_area)
new_area.Entered(src)
else
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in entry_vent.parent.other_atmosmch)
vents.Add(temp_vent)
if(!vents.len)
entry_vent = null
return
var/obj/machinery/atmospherics/unary/vent_pump/exit_vent = pick(vents)
if(prob(50))
visible_message("<B>[src] scrambles into the ventillation ducts!</B>", \
"<span class='notice'>You hear something squeezing through the ventilation ducts.</span>")
spawn(rand(20,60))
loc = exit_vent
var/travel_time = round(get_dist(loc, exit_vent.loc) / 2)
spawn(travel_time)
if(!exit_vent || exit_vent.welded)
loc = entry_vent
entry_vent = null
return
if(prob(50))
audible_message("<span class='notice'>You hear something squeezing through the ventilation ducts.</span>")
sleep(travel_time)
if(!exit_vent || exit_vent.welded)
loc = entry_vent
entry_vent = null
return
loc = exit_vent.loc
entry_vent = null
var/area/new_area = get_area(loc)
if(new_area)
new_area.Entered(src)
//=================
else if(prob(33))
@@ -1,5 +0,0 @@
/obj/item/device/pipe_freezer
name = "Pipe Freezer"
icon = 'icons/obj/items.dmi'
icon_state = "pipe_freezer"
item_state = "flight"
@@ -14,7 +14,7 @@
mode = pick(modes)
/obj/item/device/pipe_painter/afterattack(atom/A, mob/user as mob)
if(!istype(A,/obj/machinery/atmospherics/pipe) || istype(A,/obj/machinery/atmospherics/pipe/tank) || istype(A,/obj/machinery/atmospherics/pipe/vent) || istype(A,/obj/machinery/atmospherics/pipe/simple/heat_exchanging) || istype(A,/obj/machinery/atmospherics/pipe/simple/insulated) || !in_range(user, A))
if(!istype(A,/obj/machinery/atmospherics/pipe) || istype(A,/obj/machinery/atmospherics/pipe/simple/heat_exchanging) || istype(A,/obj/machinery/atmospherics/pipe/simple/insulated) || !in_range(user, A))
return
var/obj/machinery/atmospherics/pipe/P = A
@@ -25,7 +25,16 @@
if(ks2type)
keyslot2 = new ks2type(src)
recalculateChannels(1)
/obj/item/device/radio/headset/Destroy()
if(keyslot1)
qdel(keyslot1)
if(keyslot2)
qdel(keyslot2)
keyslot1 = null
keyslot2 = null
return ..()
/obj/item/device/radio/headset/list_channels(var/mob/user)
return list_secure_channels()
@@ -326,7 +335,7 @@
user.drop_item()
W.loc = src
keyslot2 = W
recalculateChannels()
return

Some files were not shown because too many files have changed in this diff Show More