mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Removed update_values(). RIP, shine on you CPU diamond. Removed get_moles_by_id and get_archived_moles_by_id, all moles are now accessed directly to reduce call cost. Added set_temperature and set_volume procs which recalc pressure when temperature or pressure change. Heat_capacity is now a var updated when gases update. Modified adjust_gas to use set_gas, modified set_gas to alter heat_capacity, total_moles, and pressure as needed.
49 lines
1.1 KiB
Plaintext
49 lines
1.1 KiB
Plaintext
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
|
|
|
|
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.adjust_gas(OXYGEN, added_oxygen, 0)
|
|
|
|
if(network)
|
|
network.update = 1
|
|
|
|
return 1 |