diff --git a/code/game/objects/items/RPD.dm b/code/game/objects/items/RPD.dm index c66df872c4..e6e39d3ff1 100644 --- a/code/game/objects/items/RPD.dm +++ b/code/game/objects/items/RPD.dm @@ -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), diff --git a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm new file mode 100644 index 0000000000..94d8959987 --- /dev/null +++ b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm @@ -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" diff --git a/icons/obj/atmospherics/components/unary_devices.dmi b/icons/obj/atmospherics/components/unary_devices.dmi index e18ee92849..3f09e99156 100644 Binary files a/icons/obj/atmospherics/components/unary_devices.dmi and b/icons/obj/atmospherics/components/unary_devices.dmi differ diff --git a/icons/obj/atmospherics/pipes/pipe_item.dmi b/icons/obj/atmospherics/pipes/pipe_item.dmi index 76e3e687c5..c16e4c1bbb 100644 Binary files a/icons/obj/atmospherics/pipes/pipe_item.dmi and b/icons/obj/atmospherics/pipes/pipe_item.dmi differ diff --git a/tgstation.dme b/tgstation.dme index 168a5b53d4..1c7d5112e7 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -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"