anchor.diff:  	var/datum/gas_mixture/air1 = airs[1]
   	var/datum/gas_mixture/air2 = airs[2]
   
  -	if(!air1 || !air2 || air1.temperature <= 0 || air2.temperature <= 0)
  +	if(!air1 || !air2)
   		return
   
   	var/datum/gas_mixture/air3 = airs[3]
  
positive.code: 	data["on"] = on
  	data["set_pressure"] = round(target_pressure)
  	data["max_pressure"] = round(MAX_OUTPUT_PRESSURE)
  	data["node1_concentration"] = round(node1_concentration*100)
  	data["node2_concentration"] = round(node2_concentration*100)
  	return data
  
  /obj/machinery/atmospherics/components/trinary/mixer/ui_act(action, params)
  
negative.code: 		return
  
  	//Calculate necessary moles to transfer using PV=nRT
  	var/general_transfer = (target_pressure - output_starting_pressure) * air3.volume / R_IDEAL_GAS_EQUATION
  
  	var/transfer_moles1 = air1.temperature ? node1_concentration * general_transfer / air1.temperature : 0
  	var/transfer_moles2 = air2.temperature ? node2_concentration * general_transfer / air2.temperature : 0
  
  	var/air1_moles = air1.total_moles()
  	var/air2_moles = air2.total_moles()
  
  	if(!node2_concentration)
  		if(air1.temperature <= 0)
  			return	
  		transfer_moles1 = min(transfer_moles1, air1_moles)
  		transfer_moles2 = 0
  	else if(!node1_concentration)
  		if(air2.temperature <= 0)
  			return	
  		transfer_moles2 = min(transfer_moles2, air2_moles)
  		transfer_moles1 = 0
  	else
  		if(air1.temperature <= 0 || air2.temperature <= 0)
  			return
  		if((transfer_moles2 <= 0) || (transfer_moles1 <= 0))
  			return
  		if((air1_moles < transfer_moles1) || (air2_moles < transfer_moles2))
  			var/ratio = 0
  			ratio = min(air1_moles / transfer_moles1, air2_moles / transfer_moles2)
  			transfer_moles1 *= ratio
  			transfer_moles2 *= ratio
  
  	//Actually transfer the gas
  
  	if(transfer_moles1)
  		var/datum/gas_mixture/removed1 = air1.remove(transfer_moles1)
  		air3.merge(removed1)
  		var/datum/pipeline/parent1 = parents[1]
  		parent1.update = TRUE
  
  	if(transfer_moles2)
  		var/datum/gas_mixture/removed2 = air2.remove(transfer_moles2)
  		air3.merge(removed2)
  		var/datum/pipeline/parent2 = parents[2]
  		parent2.update = TRUE
  
  