Skip to content

Commit

Permalink
Chem heaters now heat up linerarly (yogstation13#10108)
Browse files Browse the repository at this point in the history
* omae

* Update code/modules/reagents/chemistry/machinery/chem_heater.dm

* Update code/modules/reagents/chemistry/machinery/chem_heater.dm

Co-authored-by: Jamie D <993128+JamieD1@users.noreply.github.com>
  • Loading branch information
Redmoogle and JamieD1 committed Oct 24, 2020
1 parent 6ac4e8d commit e79876d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions code/modules/reagents/chemistry/machinery/chem_heater.dm
Expand Up @@ -9,7 +9,8 @@
circuit = /obj/item/circuitboard/machine/chem_heater
var/obj/item/reagent_containers/beaker = null
var/target_temperature = 300
var/heater_coefficient = 0.1
var/currentspeed = 10
var/heater_speed = 10
var/on = FALSE

/obj/machinery/chem_heater/Destroy()
Expand Down Expand Up @@ -50,23 +51,25 @@
return TRUE

/obj/machinery/chem_heater/RefreshParts()
heater_coefficient = 0.1
heater_speed = 10
for(var/obj/item/stock_parts/micro_laser/M in component_parts)
heater_coefficient *= M.rating
heater_speed *= M.rating

/obj/machinery/chem_heater/examine(mob/user)
. = ..()
if(in_range(user, src) || isobserver(user))
. += "<span class='notice'>The status display reads: Heating reagents at <b>[heater_coefficient*1000]%</b> speed.<span>"
. += "<span class='notice'>The status display reads: Heating reagents at <b>[heater_speed]K</b> per cycle.<span>"

/obj/machinery/chem_heater/process()
..()
if(stat & NOPOWER)
return
if(on)
if(beaker && beaker.reagents.total_volume)
beaker.reagents.adjust_thermal_energy((target_temperature - beaker.reagents.chem_temp) * heater_coefficient * SPECIFIC_HEAT_DEFAULT * beaker.reagents.total_volume)
beaker.reagents.handle_reactions()
if(on && beaker?.reagents.total_volume)
currentspeed = heater_speed
if((beaker.reagents.chem_temp + heater_speed) >= target_temperature)
currentspeed = target_temperature - beaker.reagents.chem_temp
beaker.reagents.adjust_thermal_energy(currentspeed * SPECIFIC_HEAT_DEFAULT * beaker.reagents.total_volume)
beaker.reagents.handle_reactions()

/obj/machinery/chem_heater/attackby(obj/item/I, mob/user, params)
if(default_deconstruction_screwdriver(user, "mixer0b", "mixer0b", I))
Expand Down

0 comments on commit e79876d

Please sign in to comment.