Optimization to the radiation of thermal plates. Instead of each thermal plate calling radiate() every single tick, thermal plates in the same network (which equalizes every tick) will simply copy over the gases once the first radiate() is called. Then the networks radiate() value will be reset.

This commit is contained in:
clusterfack
2015-03-28 12:45:49 -05:00
parent 19ba1e9dce
commit c336d76e5a
2 changed files with 6 additions and 0 deletions

View File

@@ -69,6 +69,9 @@
return
/obj/machinery/atmospherics/unary/thermal_plate/proc/radiate()
if(network && network.radiate) //Since each member of a network has the same gases each tick
air_contents.copy_from(network.radiate) //We can cut down on processing time by only calculating radiate() once and then applying the result
return 1
var/internal_transfer_moles = 0.25 * air_contents.total_moles()
var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles)
@@ -86,5 +89,6 @@
if (network)
network.update = 1
network.radiate = air_contents
return 1