Merge pull request #10568 from r4d6/Passive-Vents

Add passive vents
This commit is contained in:
Ghom
2020-01-18 22:13:23 +01:00
committed by GitHub
5 changed files with 57 additions and 0 deletions
+1
View File
@@ -35,6 +35,7 @@ GLOBAL_LIST_INIT(atmos_pipe_recipes, list(
new /datum/pipe_info/meter("Meter"),
new /datum/pipe_info/pipe("Gas Filter", /obj/machinery/atmospherics/components/trinary/filter),
new /datum/pipe_info/pipe("Gas Mixer", /obj/machinery/atmospherics/components/trinary/mixer),
new /datum/pipe_info/pipe("Passive Vent", /obj/machinery/atmospherics/components/unary/passive_vent),
),
"Heat Exchange" = list(
new /datum/pipe_info/pipe("Pipe", /obj/machinery/atmospherics/pipe/heat_exchanging/simple),
@@ -0,0 +1,55 @@
/obj/machinery/atmospherics/components/unary/passive_vent
icon_state = "passive_vent_map-2"
name = "passive vent"
desc = "It is an open vent."
can_unwrench = TRUE
level = 1
layer = GAS_SCRUBBER_LAYER
pipe_state = "pvent"
/obj/machinery/atmospherics/components/unary/passive_vent/update_icon_nopipes()
cut_overlays()
if(showpipe)
var/image/cap = getpipeimage(icon, "vent_cap", initialize_directions)
add_overlay(cap)
icon_state = "passive_vent"
/obj/machinery/atmospherics/components/unary/passive_vent/process_atmos()
..()
var/datum/gas_mixture/environment = loc.return_air()
var/environment_pressure = environment.return_pressure()
var/pressure_delta = abs(environment_pressure - airs[1].return_pressure())
if((environment.temperature || airs[1].temperature) && pressure_delta > 0.5)
if(environment_pressure < airs[1].return_pressure())
var/air_temperature = (environment.temperature > 0) ? environment.temperature : airs[1].temperature
var/transfer_moles = (pressure_delta * environment.volume) / (air_temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = airs[1].remove(transfer_moles)
loc.assume_air(removed)
air_update_turf()
else
var/air_temperature = (airs[1].temperature > 0) ? airs[1].temperature : environment.temperature
var/output_volume = airs[1].volume
var/transfer_moles = (pressure_delta * output_volume) / (air_temperature * R_IDEAL_GAS_EQUATION)
transfer_moles = min(transfer_moles, environment.total_moles()*airs[1].volume/environment.volume)
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
if(isnull(removed))
return
airs[1].merge(removed)
air_update_turf()
update_parents()
/obj/machinery/atmospherics/components/unary/passive_vent/can_crawl_through()
return TRUE
/obj/machinery/atmospherics/components/unary/passive_vent/layer1
piping_layer = PIPING_LAYER_MIN
icon_state = "passive_vent_map-1"
/obj/machinery/atmospherics/components/unary/passive_vent/layer3
piping_layer = PIPING_LAYER_MAX
icon_state = "passive_vent_map-3"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 29 KiB

+1
View File
@@ -1480,6 +1480,7 @@
#include "code\modules\atmospherics\machinery\components\unary_devices\cryo.dm"
#include "code\modules\atmospherics\machinery\components\unary_devices\heat_exchanger.dm"
#include "code\modules\atmospherics\machinery\components\unary_devices\outlet_injector.dm"
#include "code\modules\atmospherics\machinery\components\unary_devices\passive_vent.dm"
#include "code\modules\atmospherics\machinery\components\unary_devices\portables_connector.dm"
#include "code\modules\atmospherics\machinery\components\unary_devices\relief_valve.dm"
#include "code\modules\atmospherics\machinery\components\unary_devices\tank.dm"