mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-23 21:26:30 +01:00
Pipe Clamps, Shutoff Valves, and Leaking Tubes, oh my. (#6279)
* Pipe Clamps, Shutoff Valves, and Leaking Tubes, oh my. * Fix processing fuckery. * Deal with Forever-Seals, and Infini-clamps. * Update clamp.dm
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
/obj/machinery/atmospherics/valve/shutoff
|
||||
icon = 'icons/atmos/clamp.dmi'
|
||||
icon_state = "map_vclamp0"
|
||||
|
||||
name = "automatic shutoff valve"
|
||||
desc = "An automatic valve with control circuitry and pipe integrity sensor, capable of automatically isolating damaged segments of the pipe network."
|
||||
var/close_on_leaks = TRUE // If false it will be always open
|
||||
level = 1
|
||||
connect_types = CONNECT_TYPE_SCRUBBER | CONNECT_TYPE_SUPPLY | CONNECT_TYPE_REGULAR
|
||||
|
||||
/obj/machinery/atmospherics/valve/shutoff/update_icon()
|
||||
icon_state = "vclamp[open]"
|
||||
|
||||
/obj/machinery/atmospherics/valve/shutoff/examine(var/mob/user)
|
||||
..()
|
||||
to_chat(user, "The automatic shutoff circuit is [close_on_leaks ? "enabled" : "disabled"].")
|
||||
|
||||
/obj/machinery/atmospherics/valve/shutoff/Initialize()
|
||||
. = ..()
|
||||
open()
|
||||
hide(1)
|
||||
|
||||
/obj/machinery/atmospherics/valve/shutoff/attack_ai(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/atmospherics/valve/shutoff/attack_hand(var/mob/user)
|
||||
src.add_fingerprint(usr)
|
||||
update_icon(1)
|
||||
close_on_leaks = !close_on_leaks
|
||||
to_chat(user, "You [close_on_leaks ? "enable" : "disable"] the automatic shutoff circuit.")
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/atmospherics/valve/shutoff/process()
|
||||
..()
|
||||
|
||||
if (!network_node1 || !network_node2)
|
||||
if(open)
|
||||
close()
|
||||
return
|
||||
|
||||
if (!close_on_leaks)
|
||||
if (!open)
|
||||
open()
|
||||
return
|
||||
|
||||
if (network_node1.leaks.len || network_node2.leaks.len)
|
||||
if (open)
|
||||
close()
|
||||
else if (!open)
|
||||
open()
|
||||
@@ -8,76 +8,83 @@ var/global/list/datum/pipe_network/pipe_networks = list() // TODO - Move into SS
|
||||
var/list/datum/pipeline/line_members = list()
|
||||
//membership roster to go through for updates and what not
|
||||
|
||||
var/list/leaks = list()
|
||||
|
||||
var/update = 1
|
||||
//var/datum/gas_mixture/air_transient = null
|
||||
|
||||
Destroy()
|
||||
STOP_PROCESSING_PIPENET(src)
|
||||
for(var/datum/pipeline/line_member in line_members)
|
||||
line_member.network = null
|
||||
for(var/obj/machinery/atmospherics/normal_member in normal_members)
|
||||
normal_member.reassign_network(src, null)
|
||||
gases.Cut() // Do not qdel the gases, we don't own them
|
||||
return ..()
|
||||
/datum/pipe_network/Destroy()
|
||||
STOP_PROCESSING_PIPENET(src)
|
||||
for(var/datum/pipeline/line_member in line_members)
|
||||
line_member.network = null
|
||||
for(var/obj/machinery/atmospherics/normal_member in normal_members)
|
||||
normal_member.reassign_network(src, null)
|
||||
gases.Cut() // Do not qdel the gases, we don't own them
|
||||
leaks.Cut()
|
||||
return ..()
|
||||
|
||||
process()
|
||||
//Equalize gases amongst pipe if called for
|
||||
if(update)
|
||||
update = 0
|
||||
reconcile_air() //equalize_gases(gases)
|
||||
/datum/pipe_network/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()
|
||||
listclearnulls(leaks) // Let's not have forever-seals.
|
||||
|
||||
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()
|
||||
//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()
|
||||
|
||||
if(!start_normal)
|
||||
qdel(src)
|
||||
return
|
||||
/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()
|
||||
|
||||
start_normal.network_expand(src, reference)
|
||||
if(!start_normal)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
update_network_gases()
|
||||
start_normal.network_expand(src, reference)
|
||||
|
||||
if((normal_members.len>0)||(line_members.len>0))
|
||||
START_PROCESSING_PIPENET(src)
|
||||
else
|
||||
qdel(src)
|
||||
update_network_gases()
|
||||
|
||||
proc/merge(datum/pipe_network/giver)
|
||||
if(giver==src) return 0
|
||||
if((normal_members.len>0)||(line_members.len>0))
|
||||
START_PROCESSING_PIPENET(src)
|
||||
else
|
||||
qdel(src)
|
||||
|
||||
normal_members |= giver.normal_members
|
||||
/datum/pipe_network/proc/merge(datum/pipe_network/giver)
|
||||
if(giver==src) return 0
|
||||
|
||||
line_members |= giver.line_members
|
||||
normal_members |= giver.normal_members
|
||||
|
||||
for(var/obj/machinery/atmospherics/normal_member in giver.normal_members)
|
||||
normal_member.reassign_network(giver, src)
|
||||
line_members |= giver.line_members
|
||||
|
||||
for(var/datum/pipeline/line_member in giver.line_members)
|
||||
line_member.network = src
|
||||
leaks |= giver.leaks
|
||||
|
||||
update_network_gases()
|
||||
return 1
|
||||
for(var/obj/machinery/atmospherics/normal_member in giver.normal_members)
|
||||
normal_member.reassign_network(giver, src)
|
||||
|
||||
proc/update_network_gases()
|
||||
//Go through membership roster and make sure gases is up to date
|
||||
for(var/datum/pipeline/line_member in giver.line_members)
|
||||
line_member.network = src
|
||||
|
||||
gases = list()
|
||||
volume = 0
|
||||
update_network_gases()
|
||||
return 1
|
||||
|
||||
for(var/obj/machinery/atmospherics/normal_member in normal_members)
|
||||
var/result = normal_member.return_network_air(src)
|
||||
if(result) gases += result
|
||||
/datum/pipe_network/proc/update_network_gases()
|
||||
//Go through membership roster and make sure gases is up to date
|
||||
|
||||
for(var/datum/pipeline/line_member in line_members)
|
||||
gases += line_member.air
|
||||
gases = list()
|
||||
volume = 0
|
||||
|
||||
for(var/datum/gas_mixture/air in gases)
|
||||
volume += air.volume
|
||||
for(var/obj/machinery/atmospherics/normal_member in normal_members)
|
||||
var/result = normal_member.return_network_air(src)
|
||||
if(result) gases += result
|
||||
|
||||
proc/reconcile_air()
|
||||
equalize_gases(gases)
|
||||
for(var/datum/pipeline/line_member in line_members)
|
||||
gases += line_member.air
|
||||
|
||||
for(var/datum/gas_mixture/air in gases)
|
||||
volume += air.volume
|
||||
|
||||
/datum/pipe_network/proc/reconcile_air()
|
||||
equalize_gases(gases)
|
||||
|
||||
+176
-161
@@ -1,219 +1,234 @@
|
||||
|
||||
datum/pipeline
|
||||
/datum/pipeline
|
||||
var/datum/gas_mixture/air
|
||||
|
||||
var/list/obj/machinery/atmospherics/pipe/members
|
||||
var/list/obj/machinery/atmospherics/pipe/edges //Used for building networks
|
||||
|
||||
// Nodes that are leaking. Used for A.S. Valves.
|
||||
var/list/leaks = list()
|
||||
|
||||
var/datum/pipe_network/network
|
||||
|
||||
var/alert_pressure = 0
|
||||
|
||||
Destroy()
|
||||
QDEL_NULL(network)
|
||||
/datum/pipeline/Destroy()
|
||||
QDEL_NULL(network)
|
||||
|
||||
if(air && air.volume)
|
||||
temporarily_store_air()
|
||||
for(var/obj/machinery/atmospherics/pipe/P in members)
|
||||
P.parent = null
|
||||
members = null
|
||||
edges = null
|
||||
. = ..()
|
||||
if(air && air.volume)
|
||||
temporarily_store_air()
|
||||
for(var/obj/machinery/atmospherics/pipe/P in members)
|
||||
P.parent = null
|
||||
members = null
|
||||
edges = null
|
||||
leaks = null
|
||||
. = ..()
|
||||
|
||||
process()//This use to be called called from the pipe networks
|
||||
|
||||
//Check to see if pressure is within acceptable limits
|
||||
var/pressure = air.return_pressure()
|
||||
if(pressure > alert_pressure)
|
||||
for(var/obj/machinery/atmospherics/pipe/member in members)
|
||||
if(!member.check_pressure(pressure))
|
||||
break //Only delete 1 pipe per process
|
||||
|
||||
proc/temporarily_store_air()
|
||||
//Update individual gas_mixtures by volume ratio
|
||||
/datum/pipeline/process()//This use to be called called from the pipe networks
|
||||
|
||||
//Check to see if pressure is within acceptable limits
|
||||
var/pressure = air.return_pressure()
|
||||
if(pressure > alert_pressure)
|
||||
for(var/obj/machinery/atmospherics/pipe/member in members)
|
||||
member.air_temporary = new
|
||||
member.air_temporary.copy_from(air)
|
||||
member.air_temporary.volume = member.volume
|
||||
member.air_temporary.multiply(member.volume / air.volume)
|
||||
if(!member.check_pressure(pressure))
|
||||
break //Only delete 1 pipe per process
|
||||
|
||||
proc/build_pipeline(obj/machinery/atmospherics/pipe/base)
|
||||
/datum/pipeline/proc/temporarily_store_air()
|
||||
//Update individual gas_mixtures by volume ratio
|
||||
|
||||
for(var/obj/machinery/atmospherics/pipe/member in members)
|
||||
member.air_temporary = new
|
||||
member.air_temporary.copy_from(air)
|
||||
member.air_temporary.volume = member.volume
|
||||
member.air_temporary.multiply(member.volume / air.volume)
|
||||
|
||||
/datum/pipeline/proc/build_pipeline(obj/machinery/atmospherics/pipe/base)
|
||||
air = new
|
||||
|
||||
var/list/possible_expansions = list(base)
|
||||
members = list(base)
|
||||
edges = list()
|
||||
|
||||
var/volume = base.volume
|
||||
base.parent = src
|
||||
alert_pressure = base.alert_pressure
|
||||
|
||||
if(base.air_temporary)
|
||||
air = base.air_temporary
|
||||
base.air_temporary = null
|
||||
else
|
||||
air = new
|
||||
|
||||
var/list/possible_expansions = list(base)
|
||||
members = list(base)
|
||||
edges = list()
|
||||
if(base.leaking)
|
||||
leaks |= base
|
||||
|
||||
var/volume = base.volume
|
||||
base.parent = src
|
||||
alert_pressure = base.alert_pressure
|
||||
while(possible_expansions.len>0)
|
||||
for(var/obj/machinery/atmospherics/pipe/borderline in possible_expansions)
|
||||
|
||||
if(base.air_temporary)
|
||||
air = base.air_temporary
|
||||
base.air_temporary = null
|
||||
else
|
||||
air = new
|
||||
var/list/result = borderline.pipeline_expansion()
|
||||
var/edge_check = result.len
|
||||
|
||||
while(possible_expansions.len>0)
|
||||
for(var/obj/machinery/atmospherics/pipe/borderline in possible_expansions)
|
||||
if(result.len>0)
|
||||
for(var/obj/machinery/atmospherics/pipe/item in result)
|
||||
|
||||
var/list/result = borderline.pipeline_expansion()
|
||||
var/edge_check = result.len
|
||||
if(item.in_stasis)
|
||||
continue
|
||||
|
||||
if(result.len>0)
|
||||
for(var/obj/machinery/atmospherics/pipe/item in result)
|
||||
if(!members.Find(item))
|
||||
members += item
|
||||
possible_expansions += item
|
||||
if(!members.Find(item))
|
||||
members += item
|
||||
possible_expansions += item
|
||||
|
||||
volume += item.volume
|
||||
item.parent = src
|
||||
volume += item.volume
|
||||
item.parent = src
|
||||
|
||||
alert_pressure = min(alert_pressure, item.alert_pressure)
|
||||
alert_pressure = min(alert_pressure, item.alert_pressure)
|
||||
|
||||
if(item.air_temporary)
|
||||
air.merge(item.air_temporary)
|
||||
if(item.air_temporary)
|
||||
air.merge(item.air_temporary)
|
||||
|
||||
edge_check--
|
||||
if(item.leaking)
|
||||
leaks |= item
|
||||
|
||||
if(edge_check>0)
|
||||
edges += borderline
|
||||
edge_check--
|
||||
|
||||
possible_expansions -= borderline
|
||||
if(edge_check>0)
|
||||
edges += borderline
|
||||
|
||||
air.volume = volume
|
||||
possible_expansions -= borderline
|
||||
|
||||
proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||
air.volume = volume
|
||||
|
||||
if(new_network.line_members.Find(src))
|
||||
return 0
|
||||
/datum/pipeline/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||
|
||||
new_network.line_members += src
|
||||
if(new_network.line_members.Find(src))
|
||||
return 0
|
||||
|
||||
network = new_network
|
||||
new_network.line_members += src
|
||||
|
||||
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)
|
||||
network = new_network
|
||||
network.leaks |= leaks
|
||||
|
||||
return 1
|
||||
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)
|
||||
|
||||
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 1
|
||||
|
||||
return network
|
||||
/datum/pipeline/proc/return_network(obj/machinery/atmospherics/reference)
|
||||
if(!network)
|
||||
network = new /datum/pipe_network()
|
||||
network.build_network(src, null)
|
||||
//technically passing these parameters should not be allowed
|
||||
//however pipe_network.build_network(..) and pipeline.network_extend(...)
|
||||
// were setup to properly handle this case
|
||||
|
||||
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
|
||||
return network
|
||||
|
||||
if(istype(target) && target.zone)
|
||||
//Have to consider preservation of group statuses
|
||||
var/datum/gas_mixture/turf_copy = new
|
||||
var/datum/gas_mixture/turf_original = new
|
||||
/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
|
||||
|
||||
turf_copy.copy_from(target.zone.air)
|
||||
turf_copy.volume = target.zone.air.volume //Copy a good representation of the turf from parent group
|
||||
turf_original.copy_from(turf_copy)
|
||||
if(istype(target) && target.zone)
|
||||
//Have to consider preservation of group statuses
|
||||
var/datum/gas_mixture/turf_copy = new
|
||||
var/datum/gas_mixture/turf_original = new
|
||||
|
||||
equalize_gases(list(air_sample, turf_copy))
|
||||
air.merge(air_sample)
|
||||
turf_copy.copy_from(target.zone.air)
|
||||
turf_copy.volume = target.zone.air.volume //Copy a good representation of the turf from parent group
|
||||
turf_original.copy_from(turf_copy)
|
||||
|
||||
equalize_gases(list(air_sample, turf_copy))
|
||||
air.merge(air_sample)
|
||||
|
||||
|
||||
target.zone.air.remove(turf_original.total_moles)
|
||||
target.zone.air.merge(turf_copy)
|
||||
target.zone.air.remove(turf_original.total_moles)
|
||||
target.zone.air.merge(turf_copy)
|
||||
|
||||
else
|
||||
var/datum/gas_mixture/turf_air = target.return_air()
|
||||
else
|
||||
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()
|
||||
equalize_gases(list(air_sample, turf_air))
|
||||
air.merge(air_sample)
|
||||
//turf_air already modified by equalize_gases()
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
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)
|
||||
/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)
|
||||
|
||||
if(istype(target, /turf/simulated))
|
||||
var/turf/simulated/modeled_location = target
|
||||
if(istype(target, /turf/simulated))
|
||||
var/turf/simulated/modeled_location = target
|
||||
|
||||
if(modeled_location.blocks_air)
|
||||
if(modeled_location.blocks_air)
|
||||
|
||||
if((modeled_location.heat_capacity>0) && (partial_heat_capacity>0))
|
||||
var/delta_temperature = air.temperature - modeled_location.temperature
|
||||
|
||||
var/heat = thermal_conductivity*delta_temperature* \
|
||||
(partial_heat_capacity*modeled_location.heat_capacity/(partial_heat_capacity+modeled_location.heat_capacity))
|
||||
|
||||
air.temperature -= heat/total_heat_capacity
|
||||
modeled_location.temperature += heat/modeled_location.heat_capacity
|
||||
|
||||
else
|
||||
var/delta_temperature = 0
|
||||
var/sharer_heat_capacity = 0
|
||||
|
||||
if(modeled_location.zone)
|
||||
delta_temperature = (air.temperature - modeled_location.zone.air.temperature)
|
||||
sharer_heat_capacity = modeled_location.zone.air.heat_capacity()
|
||||
else
|
||||
delta_temperature = (air.temperature - modeled_location.air.temperature)
|
||||
sharer_heat_capacity = modeled_location.air.heat_capacity()
|
||||
|
||||
var/self_temperature_delta = 0
|
||||
var/sharer_temperature_delta = 0
|
||||
|
||||
if((sharer_heat_capacity>0) && (partial_heat_capacity>0))
|
||||
var/heat = thermal_conductivity*delta_temperature* \
|
||||
(partial_heat_capacity*sharer_heat_capacity/(partial_heat_capacity+sharer_heat_capacity))
|
||||
|
||||
self_temperature_delta = -heat/total_heat_capacity
|
||||
sharer_temperature_delta = heat/sharer_heat_capacity
|
||||
else
|
||||
return 1
|
||||
|
||||
air.temperature += self_temperature_delta
|
||||
|
||||
if(modeled_location.zone)
|
||||
modeled_location.zone.air.temperature += sharer_temperature_delta/modeled_location.zone.air.group_multiplier
|
||||
else
|
||||
modeled_location.air.temperature += sharer_temperature_delta
|
||||
|
||||
|
||||
else
|
||||
if((target.heat_capacity>0) && (partial_heat_capacity>0))
|
||||
var/delta_temperature = air.temperature - target.temperature
|
||||
if((modeled_location.heat_capacity>0) && (partial_heat_capacity>0))
|
||||
var/delta_temperature = air.temperature - modeled_location.temperature
|
||||
|
||||
var/heat = thermal_conductivity*delta_temperature* \
|
||||
(partial_heat_capacity*target.heat_capacity/(partial_heat_capacity+target.heat_capacity))
|
||||
(partial_heat_capacity*modeled_location.heat_capacity/(partial_heat_capacity+modeled_location.heat_capacity))
|
||||
|
||||
air.temperature -= heat/total_heat_capacity
|
||||
if(network)
|
||||
network.update = 1
|
||||
modeled_location.temperature += heat/modeled_location.heat_capacity
|
||||
|
||||
//surface must be the surface area in m^2
|
||||
proc/radiate_heat_to_space(surface, thermal_conductivity)
|
||||
var/gas_density = air.total_moles/air.volume
|
||||
thermal_conductivity *= min(gas_density / ( RADIATOR_OPTIMUM_PRESSURE/(R_IDEAL_GAS_EQUATION*GAS_CRITICAL_TEMPERATURE) ), 1) //mult by density ratio
|
||||
else
|
||||
var/delta_temperature = 0
|
||||
var/sharer_heat_capacity = 0
|
||||
|
||||
// We only get heat from the star on the exposed surface area.
|
||||
// If the HE pipes gain more energy from AVERAGE_SOLAR_RADIATION than they can radiate, then they have a net heat increase.
|
||||
var/heat_gain = AVERAGE_SOLAR_RADIATION * (RADIATOR_EXPOSED_SURFACE_AREA_RATIO * surface) * thermal_conductivity
|
||||
if(modeled_location.zone)
|
||||
delta_temperature = (air.temperature - modeled_location.zone.air.temperature)
|
||||
sharer_heat_capacity = modeled_location.zone.air.heat_capacity()
|
||||
else
|
||||
delta_temperature = (air.temperature - modeled_location.air.temperature)
|
||||
sharer_heat_capacity = modeled_location.air.heat_capacity()
|
||||
|
||||
// Previously, the temperature would enter equilibrium at 26C or 294K.
|
||||
// Only would happen if both sides (all 2 square meters of surface area) were exposed to sunlight. We now assume it aligned edge on.
|
||||
// It currently should stabilise at 129.6K or -143.6C
|
||||
heat_gain -= surface * STEFAN_BOLTZMANN_CONSTANT * thermal_conductivity * (air.temperature - COSMIC_RADIATION_TEMPERATURE) ** 4
|
||||
var/self_temperature_delta = 0
|
||||
var/sharer_temperature_delta = 0
|
||||
|
||||
air.add_thermal_energy(heat_gain)
|
||||
if(network)
|
||||
network.update = 1
|
||||
if((sharer_heat_capacity>0) && (partial_heat_capacity>0))
|
||||
var/heat = thermal_conductivity*delta_temperature* \
|
||||
(partial_heat_capacity*sharer_heat_capacity/(partial_heat_capacity+sharer_heat_capacity))
|
||||
|
||||
self_temperature_delta = -heat/total_heat_capacity
|
||||
sharer_temperature_delta = heat/sharer_heat_capacity
|
||||
else
|
||||
return 1
|
||||
|
||||
air.temperature += self_temperature_delta
|
||||
|
||||
if(modeled_location.zone)
|
||||
modeled_location.zone.air.temperature += sharer_temperature_delta/modeled_location.zone.air.group_multiplier
|
||||
else
|
||||
modeled_location.air.temperature += sharer_temperature_delta
|
||||
|
||||
|
||||
else
|
||||
if((target.heat_capacity>0) && (partial_heat_capacity>0))
|
||||
var/delta_temperature = air.temperature - target.temperature
|
||||
|
||||
var/heat = thermal_conductivity*delta_temperature* \
|
||||
(partial_heat_capacity*target.heat_capacity/(partial_heat_capacity+target.heat_capacity))
|
||||
|
||||
air.temperature -= heat/total_heat_capacity
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
//surface must be the surface area in m^2
|
||||
/datum/pipeline/proc/radiate_heat_to_space(surface, thermal_conductivity)
|
||||
var/gas_density = air.total_moles/air.volume
|
||||
thermal_conductivity *= min(gas_density / ( RADIATOR_OPTIMUM_PRESSURE/(R_IDEAL_GAS_EQUATION*GAS_CRITICAL_TEMPERATURE) ), 1) //mult by density ratio
|
||||
|
||||
// We only get heat from the star on the exposed surface area.
|
||||
// If the HE pipes gain more energy from AVERAGE_SOLAR_RADIATION than they can radiate, then they have a net heat increase.
|
||||
var/heat_gain = AVERAGE_SOLAR_RADIATION * (RADIATOR_EXPOSED_SURFACE_AREA_RATIO * surface) * thermal_conductivity
|
||||
|
||||
// Previously, the temperature would enter equilibrium at 26C or 294K.
|
||||
// Only would happen if both sides (all 2 square meters of surface area) were exposed to sunlight. We now assume it aligned edge on.
|
||||
// It currently should stabilise at 129.6K or -143.6C
|
||||
heat_gain -= surface * STEFAN_BOLTZMANN_CONSTANT * thermal_conductivity * (air.temperature - COSMIC_RADIATION_TEMPERATURE) ** 4
|
||||
|
||||
air.add_thermal_energy(heat_gain)
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
@@ -67,8 +67,22 @@
|
||||
return
|
||||
|
||||
update_icon()
|
||||
handle_leaking()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/set_leaking(var/new_leaking) // They already process, no need for manual processing toggles.
|
||||
if(new_leaking && !leaking)
|
||||
leaking = TRUE
|
||||
if(parent)
|
||||
parent.leaks |= src
|
||||
if(parent.network)
|
||||
parent.network.leaks |= src
|
||||
else if (!new_leaking && leaking)
|
||||
leaking = FALSE
|
||||
if(parent)
|
||||
parent.leaks -= src
|
||||
if(parent.network)
|
||||
parent.network.leaks -= src
|
||||
|
||||
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/process()
|
||||
if(!parent)
|
||||
@@ -180,4 +194,5 @@
|
||||
return
|
||||
|
||||
update_icon()
|
||||
handle_leaking()
|
||||
return
|
||||
|
||||
@@ -68,9 +68,16 @@
|
||||
node3 = null
|
||||
|
||||
update_icon()
|
||||
handle_leaking()
|
||||
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/pipe/manifold/handle_leaking()
|
||||
if(node1 && node2 && node3)
|
||||
set_leaking(FALSE)
|
||||
else
|
||||
set_leaking(TRUE)
|
||||
|
||||
/obj/machinery/atmospherics/pipe/manifold/change_color(var/new_color)
|
||||
..()
|
||||
//for updating connected atmos device pipes (i.e. vents, manifolds, etc)
|
||||
@@ -154,6 +161,7 @@
|
||||
var/turf/T = get_turf(src)
|
||||
if(level == 1 && !T.is_plating()) hide(1)
|
||||
update_icon()
|
||||
handle_leaking()
|
||||
|
||||
/obj/machinery/atmospherics/pipe/manifold/visible
|
||||
icon_state = "map"
|
||||
|
||||
@@ -66,9 +66,16 @@
|
||||
node4 = null
|
||||
|
||||
update_icon()
|
||||
handle_leaking()
|
||||
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/pipe/manifold4w/handle_leaking()
|
||||
if(node1 && node2 && node3 && node4)
|
||||
set_leaking(FALSE)
|
||||
else
|
||||
set_leaking(TRUE)
|
||||
|
||||
/obj/machinery/atmospherics/pipe/manifold4w/change_color(var/new_color)
|
||||
..()
|
||||
//for updating connected atmos device pipes (i.e. vents, manifolds, etc)
|
||||
@@ -156,6 +163,7 @@
|
||||
var/turf/T = get_turf(src)
|
||||
if(level == 1 && !T.is_plating()) hide(1)
|
||||
update_icon()
|
||||
handle_leaking()
|
||||
|
||||
/obj/machinery/atmospherics/pipe/manifold4w/visible
|
||||
icon_state = "map_4way"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
var/datum/gas_mixture/air_temporary // used when reconstructing a pipeline that broke
|
||||
var/datum/pipeline/parent
|
||||
var/volume = 0
|
||||
var/leaking = FALSE // Do not set directly, use set_leaking(TRUE/FALSE)
|
||||
|
||||
layer = PIPES_LAYER
|
||||
use_power = 0
|
||||
@@ -13,6 +14,7 @@
|
||||
pipe_flags = 0 // Does not have PIPING_DEFAULT_LAYER_ONLY flag.
|
||||
|
||||
var/alert_pressure = 80*ONE_ATMOSPHERE
|
||||
var/in_stasis = FALSE
|
||||
//minimum pressure before check_pressure(...) should be called
|
||||
|
||||
can_buckle = 1
|
||||
@@ -30,6 +32,31 @@
|
||||
/obj/machinery/atmospherics/pipe/hides_under_flooring()
|
||||
return level != 2
|
||||
|
||||
/obj/machinery/atmospherics/pipe/proc/set_leaking(var/new_leaking)
|
||||
if(new_leaking && !leaking)
|
||||
if(!speed_process)
|
||||
START_MACHINE_PROCESSING(src)
|
||||
else
|
||||
START_PROCESSING(SSfastprocess, src)
|
||||
leaking = TRUE
|
||||
if(parent)
|
||||
parent.leaks |= src
|
||||
if(parent.network)
|
||||
parent.network.leaks |= src
|
||||
else if (!new_leaking && leaking)
|
||||
if(!speed_process)
|
||||
STOP_MACHINE_PROCESSING(src)
|
||||
else
|
||||
STOP_PROCESSING(SSfastprocess, src)
|
||||
leaking = FALSE
|
||||
if(parent)
|
||||
parent.leaks -= src
|
||||
if(parent.network)
|
||||
parent.network.leaks -= src
|
||||
|
||||
/obj/machinery/atmospherics/pipe/proc/handle_leaking() // Used specifically to update leaking status on different pipes.
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/pipe/proc/pipeline_expansion()
|
||||
return null
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// Simple Pipes - Just a tube, maybe bent
|
||||
//
|
||||
//
|
||||
/obj/machinery/atmospherics/pipe/simple
|
||||
icon = 'icons/atmos/pipes.dmi'
|
||||
icon_state = ""
|
||||
@@ -34,6 +34,14 @@
|
||||
icon = null
|
||||
alpha = 255
|
||||
|
||||
/obj/machinery/atmospherics/pipe/simple/process()
|
||||
if(!parent)
|
||||
..()
|
||||
else if(leaking)
|
||||
parent.mingle_with_turf(loc, volume)
|
||||
else
|
||||
. = PROCESS_KILL
|
||||
|
||||
/obj/machinery/atmospherics/pipe/simple/check_pressure(pressure)
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
|
||||
@@ -147,6 +155,7 @@
|
||||
var/turf/T = loc
|
||||
if(level == 1 && !T.is_plating()) hide(1)
|
||||
update_icon()
|
||||
handle_leaking()
|
||||
|
||||
/obj/machinery/atmospherics/pipe/simple/disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference == node1)
|
||||
@@ -160,9 +169,16 @@
|
||||
node2 = null
|
||||
|
||||
update_icon()
|
||||
handle_leaking()
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/pipe/simple/handle_leaking()
|
||||
if(node1 && node2)
|
||||
set_leaking(FALSE)
|
||||
else
|
||||
set_leaking(TRUE)
|
||||
|
||||
/obj/machinery/atmospherics/pipe/simple/visible
|
||||
icon_state = "intact"
|
||||
level = 2
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
construction_type = /obj/item/pipe/binary
|
||||
pipe_state = "universal"
|
||||
|
||||
/obj/machinery/atmospherics/pipe/simple/hidden/universal/update_icon(var/safety = 0)
|
||||
/obj/machinery/atmospherics/pipe/simple/hidden/universal/update_icon(var/safety = 0) // Doesn't leak. It's a special pipe.
|
||||
if(!check_icon_cache())
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user