anchor.diff:  				del liquid
   			else
   				total_fuel += liquid.amount
  -				fuel_sources++
  -
  -			//Toxins
  -		if(toxins > 0.3) fuel_sources++
  -
  -		if(!fuel_sources) return 0 //If there's no fuel, there's no burn. Can't divide by zero anyway.
  -
  -		if(oxygen > 0.3)
  -
  -				//Calculate the firelevel.
  -			var/firelevel = calculate_firelevel(liquid)
  -
  -				//Reaches a maximum practical temperature of around 4500.
  -
  -			//Increase temperature.
  -			temperature = max( 1700*log(0.4*firelevel + 1.23) , temperature )
  -
  -			//Consume some gas.
  -			var/consumed_gas = min(oxygen,0.05*firelevel,total_fuel) / fuel_sources
  -
  -			oxygen = max(0,oxygen-consumed_gas)
  -
  -			toxins = max(0,toxins-consumed_gas)
  -
  -			carbon_dioxide += consumed_gas*2
  -
  -			if(fuel)
  -				fuel.moles -= consumed_gas
  -				if(fuel.moles <= 0) del fuel
  -
  -			if(liquid)
  -				liquid.amount -= consumed_gas
  -				if(liquid.amount <= 0) del liquid
  -
  -			update_values()
  -			return consumed_gas*fuel_sources
  -	return 0
  -
  +
  +		//Calculate the firelevel.
  +		var/firelevel = calculate_firelevel(liquid)
  +
  +		//get the current inner energy of the gas mix
  +		//this must be taken here to prevent the addition or deletion of energy by a changing heat capacity
  +		var/starting_energy = temperature * heat_capacity()
  +
  +		//determine the amount of oxygen used
  +		var/total_oxygen = min(oxygen, 2 * total_fuel)
  +		
  +		//determine the amount of fuel actually used
  +		var/used_fuel_ratio = min(oxygen / 2 , total_fuel) / total_fuel
  +		total_fuel = total_fuel * used_fuel_ratio
  +
  +		var/total_reactants = total_fuel + total_oxygen
  +
  +		//determine the amount of reactants actually reacting
  +		var/used_reactants_ratio = min( max(total_reactants * firelevel / vsc.fire_firelevel_multiplier, 0.2), total_reactants) / total_reactants
  +
  +		//remove and add gasses as calculated
  +		oxygen -= min(oxygen, total_oxygen * used_reactants_ratio )
  +
  +		toxins -= min(toxins, toxins * used_fuel_ratio * used_reactants_ratio )
  +
  +		carbon_dioxide += max(2 * total_fuel, 0)
  +
  +		if(fuel)
  +			fuel.moles -= fuel.moles * used_fuel_ratio * used_reactants_ratio
  +			if(fuel.moles <= 0) del fuel
  +
  +		if(liquid)
  +			liquid.amount -= liquid.amount * used_fuel_ratio * used_reactants_ratio
  +			if(liquid.amount <= 0) del liquid
  +
  +		//calculate the energy produced by the reaction and then set the new temperature of the mix
  +		temperature = (starting_energy + vsc.fire_fuel_energy_release * total_fuel) / heat_capacity()
  +		
  +		update_values()
  +		value = total_reactants * used_reactants_ratio
  +	return value
  +
  +datum/gas_mixture/proc/check_combustability(obj/effect/decal/cleanable/liquid_fuel/liquid)
  +	//this check comes up very often and is thus centralized here to ease adding stuff
  +	
  +	var/datum/gas/volatile_fuel/fuel = locate() in trace_gases	
  +	var/value = 0
  +	
  +	if(oxygen && (toxins || fuel || liquid))
  +		value = 1
  +	
  +	return value
   
   datum/gas_mixture/proc/calculate_firelevel(obj/effect/decal/cleanable/liquid_fuel/liquid)
  -		//Calculates the firelevel based on one equation instead of having to do this multiple times in different areas.
  -	var
  -		datum/gas/volatile_fuel/fuel = locate() in trace_gases
  -		liquid_concentration = 0
  -
  -		oxy_concentration = oxygen / volume
  -		tox_concentration = toxins / volume
  -		fuel_concentration = 0
  -
  -	if(fuel) fuel_concentration = (fuel.moles) / volume
  -	if(liquid) liquid_concentration = (liquid.amount*15) / volume
  -	return (oxy_concentration + tox_concentration + liquid_concentration + fuel_concentration)*100
  -
  -/mob/living/carbon/human/proc/FireBurn(last_temperature, mx as num)
  +	//Calculates the firelevel based on one equation instead of having to do this multiple times in different areas.
  +	
  +	var/datum/gas/volatile_fuel/fuel = locate() in trace_gases
  +	var/total_fuel = 0
  +	var/firelevel = 0
  +	
  +	if(check_combustability(liquid))
  +	
  +		total_fuel += toxins
  +
  +		if(liquid)
  +			total_fuel += liquid.amount
  +
  +		if(fuel)
  +			total_fuel += fuel.moles
  +
  +		var/total_combustables = (total_fuel + oxygen)
  +		
  +		if(total_fuel > 0 && oxygen > 0)
  +			
  +			//slows down the burning when the concentration of the reactants is low
  +			var/dampening_multiplier = total_combustables / (total_combustables + nitrogen + carbon_dioxide)
  +			//calculates how close the mixture of the reactants is to the optimum
  +			var/mix_multiplier = 1 / (1 + (5 * ((oxygen / total_combustables) ^2)))
  +			//toss everything together
  +			firelevel = vsc.fire_firelevel_multiplier * mix_multiplier * dampening_multiplier
  +			
  +	return max( 0, firelevel)
  +
  +
  +/mob/living/carbon/human/proc/FireBurn(var/firelevel, var/last_temperature, var/pressure)
  +// mostly using the old proc from Sky until I can think of something better
   	//Burns mobs due to fire. Respects heat transfer coefficients on various body parts.
  +	//Due to TG reworking how fireprotection works, this is kinda less meaningful.
   
   	var
   		head_exposure = 1
  
positive.code: 	apply_damage(0.4*mx*arms_exposure, BURN, "l_arm", 0, 0, "Fire")
  	apply_damage(0.4*mx*arms_exposure, BURN, "r_arm", 0, 0, "Fire")
  
  	//flash_pain()
negative.code: 		layer = TURF_LAYER
  
  		var
  			firelevel = 10000 //Calculated by gas_mixture.calculate_firelevel()
  
  		process()
  			. = 1
  			
  			//get location and check if it is in a proper ZAS zone
  			var/turf/simulated/floor/S = loc
  			if(!S.zone)
  				del src
  			
  			if(!istype(S))
  				del src
  				
  			var/datum/gas_mixture/air_contents = S.return_air()
  			//get liquid fuels on the ground.
  			var/obj/effect/decal/cleanable/liquid_fuel/liquid = locate() in S
  			//and the volatile stuff from the air
  			var/datum/gas/volatile_fuel/fuel = locate() in air_contents.trace_gases
  			
  			//since the air is processed in fractions, we need to make sure not to have any minuscle residue or
  			//the amount of moles might get to low for some functions to catch them and thus result in wonky behaviour
  			if(air_contents.oxygen < 0.001)
  				air_contents.oxygen = 0
  			if(air_contents.toxins < 0.001)
  				air_contents.toxins = 0
  			if(fuel)
  				if(fuel.moles < 0.001)
  					air_contents.trace_gases.Remove(fuel)
  			
  			//check if there is something to combust
  			if(!air_contents.check_combustability(liquid))
  				del src
  			
  			//get a firelevel and set the icon
  			firelevel = air_contents.calculate_firelevel(liquid)
  			
  			if(firelevel > 6)
  				icon_state = "3"
  				SetLuminosity(7)
  			else if(firelevel > 2.5)
  				icon_state = "2"
  				SetLuminosity(5)
  			else
  				icon_state = "1"
  				SetLuminosity(3)
  				
  			//im not sure how to implement a version that works for every creature so for now monkeys are firesafe
  			for(var/mob/living/carbon/human/M in loc)
  				M.FireBurn(firelevel, air_contents.temperature, air_contents.return_pressure() ) //Burn the humans!
  
  			
  			//spread!
  			for(var/direction in cardinal)
  				if(S.air_check_directions&direction) //Grab all valid bordering tiles
  
  					var/turf/simulated/enemy_tile = get_step(S, direction)
  
  					if(istype(enemy_tile))
  						//If extinguisher mist passed over the turf it's trying to spread to, don't spread and
  						//reduce firelevel.
  						if(enemy_tile.fire_protection > world.time-30)
  							firelevel -= 1.5
  							continue
  
  						//Spread the fire.
  						if(!(locate(/obj/fire) in enemy_tile))
  							if( prob( 50 + 50 * (firelevel/vsc.fire_firelevel_multiplier) ) && S.CanPass(null, enemy_tile, 0,0) && enemy_tile.CanPass(null, S, 0,0))
  								new/obj/fire(enemy_tile,firelevel)
  			
  			//seperate part of the present gas
  			//this is done to prevent the fire burning all gases in a single pass
  			var/datum/gas_mixture/flow = air_contents.remove_ratio(vsc.fire_consuption_rate)
  			
  ///////////////////////////////// FLOW HAS BEEN CREATED /// DONT DELETE THE FIRE UNTIL IT IS MERGED BACK OR YOU WILL DELETE AIR ///////////////////////////////////////////////
  			
  			if(flow)
  				if(flow.check_combustability(liquid))
  					//Ensure flow temperature is higher than minimum fire temperatures.
  						//this creates some energy ex nihilo but is necessary to get a fire started
  						//lets just pretend this energy comes from the ignition source and dont mention this again
  					//flow.temperature = max(PLASMA_MINIMUM_BURN_TEMPERATURE+0.1,flow.temperature)
  					
  					//burn baby burn!
  					flow.zburn(liquid,1)
  				
  				//merge the air back
  				S.assume_air(flow)
  
  ///////////////////////////////// FLOW HAS BEEN REMERGED /// feel free to delete the fire again from here on //////////////////////////////////////////////////////////////////
  
  					
  		New(newLoc,fl)
  			..()
  
  