Files
vgstation13/code/ATMOSPHERICS/components/unary/oxygen_generator.dm
ComicIronic 4d432e5240 Gas Datums
Moved gas_mixture gas numbers to a list which is connected to a global gas_datum list, like with reagents.
Modified some maths procs to be more sane, added adjust_gas and set_gas to help with processing.
Added a modular system for gas flags - gases can now be marked as fuel and oxidiser with a flag, logged with a flag, scanned with a flag, etc.
Changed scrubbers to use a list of scrubbing gases rather than a set of vars.
Made miners and xenoarch effects more sensible - they now produce gas by ID, not manually.
Made turfs' starting gases into a list, removed turf gas number vars.
2015-05-04 10:36:04 +01:00

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 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.adjust_gas(OXYGEN, added_oxygen, 0)
if(network)
network.update = 1
return 1