anchor.diff:  		layer = TURF_LAYER
   
   		var
  -			volume = CELL_VOLUME
  -			temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
   			firelevel = 10000 //Calculated by gas_mixture.calculate_firelevel()
  -			archived_firelevel = 0
   
   		process()
   			. = 1
  -
  -			if(firelevel > vsc.IgnitionLevel)
  -
  -				var/turf/simulated/floor/S = loc
  -				if(!S.zone) del src //Cannot exist where zones are broken.
  -
  -				if(istype(S))
  -					var
  -						datum/gas_mixture/air_contents = S.return_air()
  -						//Get whatever trace fuels are in the area
  -						datum/gas/volatile_fuel/fuel = locate() in air_contents.trace_gases
  -						//Also get liquid fuels on the ground.
  -						obj/effect/decal/cleanable/liquid_fuel/liquid = locate() in S
  -
  -					var/datum/gas_mixture/flow = air_contents.remove_ratio(0.25)
  -					//The reason we're taking a part of the air instead of all of it is so that it doesn't jump to
  -					//the fire's max temperature instantaneously.
  -
  -					firelevel = air_contents.calculate_firelevel(liquid)
  -
  -					//Ensure that there is an appropriate amount of fuel and O2 here.
  -					if(firelevel > 0.25 && flow.oxygen > 0.3 && (air_contents.toxins || fuel || liquid))
  -
  -						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( firelevel*10 ) && S.CanPass(null, enemy_tile, 0,0) && enemy_tile.CanPass(null, S, 0,0))
  -											new/obj/fire(enemy_tile,firelevel)
  -
  -					if(flow)
  -
  -						//Ensure adequate oxygen and fuel.
  -						if(flow.oxygen > 0.3 && (flow.toxins || fuel || liquid))
  -
  -							//Change icon depending on the fuel, and thus temperature.
  -							if(firelevel > 6)
  -								icon_state = "3"
  -							else if(firelevel > 2.5)
  -								icon_state = "2"
  -							else
  -								icon_state = "1"
  -
  -							//Ensure flow temperature is higher than minimum fire temperatures.
  -							flow.temperature = max(PLASMA_MINIMUM_BURN_TEMPERATURE+0.1,flow.temperature)
  -
  -							//Burn the gas mixture.
  -							flow.zburn(liquid)
  -							if(fuel && fuel.moles <= 0.00001)
  -								del fuel
  -
  -						else
  -
  -							del src
  -
  -
  -						S.assume_air(flow) //Then put it back where you found it.
  -
  -					else
  -						del src
  -				else
  -					del src
  +			
  +			//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
  -				del src
  -
  -
  +				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(temperature, min(max(0.1,firelevel / 20),10)) //Burn the humans!
  -
  -
  +				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)
   			..()
   
  
positive.code: */
  
  
  
  
  //Some legacy definitions so fires can be started.
  atom/proc/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
  	return null
  
negative.code: 				del src
  
  			dir = pick(cardinal)
  			SetLuminosity(3)
  			firelevel = fl
  			air_master.active_hotspots.Add(src)
  
  
  		Del()
  			if (istype(loc, /turf/simulated))
  				SetLuminosity(0)
  
  				loc = null
  			air_master.active_hotspots.Remove(src)
  
  			..()
  
  
  
  turf/simulated/var/fire_protection = 0 //Protects newly extinguished tiles from being overrun again.
  