From 34936ee5aff671b269c4c40f2ecdf597c71f7a75 Mon Sep 17 00:00:00 2001 From: Putnam3145 Date: Mon, 18 Oct 2021 03:44:40 -0700 Subject: [PATCH] Properly implements hysteresis --- .../machinery/components/unary_devices/heat_exchanger.dm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm index c0dfc5633e..4ad3bbf575 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm @@ -12,6 +12,8 @@ var/obj/machinery/atmospherics/components/unary/heat_exchanger/partner = null var/update_cycle + var/old_temperature = 0 + var/other_old_temperature = 0 pipe_state = "heunary" @@ -59,9 +61,6 @@ var/other_air_heat_capacity = partner_air_contents.heat_capacity() var/combined_heat_capacity = other_air_heat_capacity + air_heat_capacity - var/old_temperature = air_contents.return_temperature() - var/other_old_temperature = partner_air_contents.return_temperature() - if(combined_heat_capacity > 0) var/combined_energy = partner_air_contents.return_temperature()*other_air_heat_capacity + air_heat_capacity*air_contents.return_temperature() @@ -71,6 +70,8 @@ if(abs(old_temperature-air_contents.return_temperature()) > 1) update_parents() + old_temperature = air_contents.return_temperature() if(abs(other_old_temperature-partner_air_contents.return_temperature()) > 1) partner.update_parents() + other_old_temperature = partner_air_contents.return_temperature()