<commit_before>// Foam
// Similar to smoke, but slower and mobs absorb its reagent through their exposed skin.
#define ALUMINUM_FOAM 1
#define IRON_FOAM 2
#define RESIN_FOAM 3


/obj/effect/particle_effect/foam
	name = "foam"
	icon_state = "foam"
	opacity = 0
	anchored = TRUE
	density = FALSE
	layer = EDGED_TURF_LAYER
	mouse_opacity = MOUSE_OPACITY_TRANSPARENT
	var/amount = 3
	animate_movement = 0
	var/metal = 0
	var/lifetime = 40
	var/reagent_divisor = 7
	var/static/list/blacklisted_turfs = typecacheof(list(
	/turf/open/space/transit,
	/turf/open/chasm,
	/turf/open/lava))

/obj/effect/particle_effect/foam/firefighting
	name = "firefighting foam"
	lifetime = 20 //doesn't last as long as normal foam
	amount = 0 //no spread
	var/absorbed_plasma = 0

/obj/effect/particle_effect/foam/firefighting/MakeSlippery()
	return

/obj/effect/particle_effect/foam/firefighting/process()
	..()

	var/turf/open/T = get_turf(src)
	var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T)
	if(hotspot && istype(T) && T.air)
		qdel(hotspot)
		var/datum/gas_mixture/G = T.air
		var/plas_amt = min(30,G.get_moles(GAS_PLASMA))  //Absorb some plasma
		G.adjust_moles(GAS_PLASMA,-plas_amt)
		absorbed_plasma += plas_amt
		if(G.return_temperature() > T20C)
			G.set_temperature(max(G.return_temperature()/2,T20C))
		T.air_update_turf()

/obj/effect/particle_effect/foam/firefighting/kill_foam()
	STOP_PROCESSING(SSfastprocess, src)

	if(absorbed_plasma)
		var/obj/effect/decal/cleanable/plasma/P = (locate(/obj/effect/decal/cleanable/plasma) in get_turf(src))
		if(!P)
			P = new(loc)
		P.reagents.add_reagent(/datum/reagent/stable_plasma, absorbed_plasma)

	flick("[icon_state]-disolve", src)
	QDEL_IN(src, 5)

/obj/effect/particle_effect/foam/firefighting/foam_mob(mob/living/L)
	if(!istype(L))
		return
	L.adjust_fire_stacks(-2)
	L.ExtinguishMob()

/obj/effect/particle_effect/foam/firefighting/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
	return

/obj/effect/particle_effect/foam/metal
	name = "aluminium foam"
	metal = ALUMINUM_FOAM
	icon_state = "mfoam"
<commit_msg>Makes adv. firefighter foam remove other gases<commit_after>// Foam
// Similar to smoke, but slower and mobs absorb its reagent through their exposed skin.
#define ALUMINUM_FOAM 1
#define IRON_FOAM 2
#define RESIN_FOAM 3


/obj/effect/particle_effect/foam
	name = "foam"
	icon_state = "foam"
	opacity = 0
	anchored = TRUE
	density = FALSE
	layer = EDGED_TURF_LAYER
	mouse_opacity = MOUSE_OPACITY_TRANSPARENT
	var/amount = 3
	animate_movement = 0
	var/metal = 0
	var/lifetime = 40
	var/reagent_divisor = 7
	var/static/list/blacklisted_turfs = typecacheof(list(
	/turf/open/space/transit,
	/turf/open/chasm,
	/turf/open/lava))

/obj/effect/particle_effect/foam/firefighting
	name = "firefighting foam"
	lifetime = 20 //doesn't last as long as normal foam
	amount = 0 //no spread
	var/absorbed_plasma = 0

/obj/effect/particle_effect/foam/firefighting/MakeSlippery()
	return

/obj/effect/particle_effect/foam/firefighting/process()
	..()

	var/turf/open/T = get_turf(src)
	var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T)
	if(hotspot && istype(T) && T.air)
		qdel(hotspot)
		var/datum/gas_mixture/G = T.air
		var/amt_removed = min(30,G.get_moles(GAS_PLASMA))  //Absorb some plasma
		G.adjust_moles(GAS_PLASMA,-amt_removed)
		absorbed_plasma += amt_removed
		var/list/fire_gases = GLOB.gas_data.fire_temperatures.Copy()
		for(var/gas in fire_gases - GAS_PLASMA)
			if(amt_removed <= 0)
				break
			var/this_amount = min(30-amt_removed, G.get_moles(gas))
			G.adjust_moles(gas, -this_amount)
			amt_removed -= this_amount
		if(G.return_temperature() > T20C)
			G.set_temperature(max(G.return_temperature()/2,T20C))
		T.air_update_turf()

/obj/effect/particle_effect/foam/firefighting/kill_foam()
	STOP_PROCESSING(SSfastprocess, src)

	if(absorbed_plasma)
		var/obj/effect/decal/cleanable/plasma/P = (locate(/obj/effect/decal/cleanable/plasma) in get_turf(src))
		if(!P)
			P = new(loc)
		P.reagents.add_reagent(/datum/reagent/stable_plasma, absorbed_plasma)

	flick("[icon_state]-disolve", src)
	QDEL_IN(src, 5)

/obj/effect/particle_effect/foam/firefighting/foam_mob(mob/living/L)
	if(!istype(L))
		return
	L.adjust_fire_stacks(-2)
	L.ExtinguishMob()

/obj/effect/particle_effect/foam/firefighting/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
	return

/obj/effect/particle_effect/foam/metal
	name = "aluminium foam"
	metal = ALUMINUM_FOAM
	icon_state = "mfoam"

{'fraction_non_alphanumeric': 0.1246954595791805, 'fraction_numerical': 0.010852713178294573, 'mean_word_length': 4.673366834170854, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7146751', 'n_tokens_mistral': 2017, 'n_tokens_neox': 1855, 'n_words': 292}