Files
vgstation13/code/ATMOSPHERICS/components/unary/heat_source.dm
clusterfack 147c5bd5a7 A process scheduler thing
Included:
-The process lists use |= instead of += due to the increased stability of the former against double additions.

-Atmospherics machinery is moved under the pipenet processing.

-Modified the atmospherics processes to return 1 when theyve done something, and 0 if they aint done jack shit. Then called scheck() if they return 1, possibly  reducing unnecessary scheck calls while still managing to smooth out the atmospherics processing.

-If a powernet happens to get rebuilt by either powernets or power machinery scheck() is also called
2015-05-08 01:15:19 -05:00

44 lines
1.3 KiB
Plaintext

/obj/machinery/atmospherics/unary/heat_reservoir
//currently the same code as cold_sink but anticipating process() changes
icon = 'icons/obj/atmospherics/cold_sink.dmi'
icon_state = "intact_off"
density = 1
use_power = 1
name = "Heat Reservoir"
desc = "Heats gas when connected to pipe network"
var/on = 0
var/current_temperature = T20C
var/current_heat_capacity = 50000 //totally random
/obj/machinery/atmospherics/unary/heat_reservoir/update_icon()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed"
on = 0
return
/obj/machinery/atmospherics/unary/heat_reservoir/process()
. = ..()
if(!on)
return
var/air_heat_capacity = air_contents.heat_capacity()
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
var/old_temperature = air_contents.temperature
if(combined_heat_capacity > 0)
var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
if(air_contents.temperature < current_temperature) //if its colder than we can heat it, heat it
air_contents.temperature = combined_energy/combined_heat_capacity
//todo: have current temperature affected. require power to bring up current temperature again
if(abs(old_temperature-air_contents.temperature) > 1)
network.update = 1
return 1