code:
//Grey
/datum/chemical_reaction/slimespawn
	name = "Slime Spawn"
	id = "m_spawn"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/grey
	required_other = 1

/datum/chemical_reaction/slimespawn/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	for(var/mob/O in viewers(get_turf(holder.my_atom), null))
		O.show_message(text("Infused with plasma, the core begins to quiver and grow, and soon a new baby slime emerges from it!"), 1)
	var/mob/living/carbon/slime/S = new /mob/living/carbon/slime
	S.loc = get_turf(holder.my_atom)

/datum/chemical_reaction/slimeinaprov
	name = "Slime inaprovaline"
	id = "m_inaprov"
	result = "inaprovaline"
	required_reagents = list("water" = 5)
	result_amount = 3
	required_other = 1
	required_container = /obj/item/slime_extract/grey

/datum/chemical_reaction/slimeinaprov/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")

/datum/chemical_reaction/slimemonkey
	name = "Slime Monkey"
	id = "m_monkey"
	result = null
	required_reagents = list("blood" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/grey
	required_other = 1

/datum/chemical_reaction/slimemonkey/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	for(var/i = 1, i <= 3, i++)
		var /obj/item/weapon/reagent_containers/food/snacks/monkeycube/M = new /obj/item/weapon/reagent_containers/food/snacks/monkeycube
		M.loc = get_turf(holder.my_atom)

//Green
/datum/chemical_reaction/slimemutate
	name = "Mutation Toxin"
	id = "mutationtoxin"
	result = "mutationtoxin"
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_other = 1
	required_container = /obj/item/slime_extract/green

/datum/chemical_reaction/slimemutate/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")

//Mutated Green
/datum/chemical_reaction/slimemutate_unstable
	name = "Unstable Mutation Toxin"
	id = "unstablemutationtoxin"
	result = "unstablemutationtoxin"
	required_reagents = list("radium" = 1)
	result_amount = 1
	required_other = 1
	required_container = /obj/item/slime_extract/green
	mix_message = "The mixture rapidly expands and contracts, its appearance shifting into a sickening green."

/datum/chemical_reaction/slimemutate_unstable/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")

//Metal
/datum/chemical_reaction/slimemetal
	name = "Slime Metal"
	id = "m_metal"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/metal
	required_other = 1

/datum/chemical_reaction/slimemetal/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/obj/item/stack/sheet/metal/M = new /obj/item/stack/sheet/metal
	M.amount = 15
	M.loc = get_turf(holder.my_atom)
	var/obj/item/stack/sheet/plasteel/P = new /obj/item/stack/sheet/plasteel
	P.amount = 5
	P.loc = get_turf(holder.my_atom)

//Gold
/datum/chemical_reaction/slimecrit
	name = "Slime Crit"
	id = "m_tele"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/gold
	required_other = 1

/datum/chemical_reaction/slimecrit/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	for(var/mob/O in viewers(get_turf(holder.my_atom), null))
		O.show_message(text("The slime extract begins to vibrate violently !"), 1)
	spawn(50)

		chemical_mob_spawn(holder, 5, "Gold Slime")

/datum/chemical_reaction/slimecritlesser
	name = "Slime Crit Lesser"
	id = "m_tele3"
	result = null
	required_reagents = list("blood" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/gold
	required_other = 1

/datum/chemical_reaction/slimecritlesser/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	for(var/mob/O in viewers(get_turf(holder.my_atom), null))
		O.show_message(text("The slime extract begins to vibrate violently !"), 1)
	spawn(50)

		chemical_mob_spawn(holder, 1, "Lesser Gold Slime", "neutral")

//Silver
/datum/chemical_reaction/slimebork
	name = "Slime Bork"
	id = "m_tele2"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/silver
	required_other = 1

/datum/chemical_reaction/slimebork/on_reaction(var/datum/reagents/holder)

	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/list/blocked = list(/obj/item/weapon/reagent_containers/food/snacks,
		/obj/item/weapon/reagent_containers/food/snacks/store/bread,
		/obj/item/weapon/reagent_containers/food/snacks/breadslice,
		/obj/item/weapon/reagent_containers/food/snacks/store/cake,
		/obj/item/weapon/reagent_containers/food/snacks/cakeslice,
		/obj/item/weapon/reagent_containers/food/snacks/store,
		/obj/item/weapon/reagent_containers/food/snacks/pie,
		/obj/item/weapon/reagent_containers/food/snacks/kebab,
		/obj/item/weapon/reagent_containers/food/snacks/pizza,
		/obj/item/weapon/reagent_containers/food/snacks/pizzaslice,
		/obj/item/weapon/reagent_containers/food/snacks/salad,
		/obj/item/weapon/reagent_containers/food/snacks/meat,
		/obj/item/weapon/reagent_containers/food/snacks/soup,
		/obj/item/weapon/reagent_containers/food/snacks/grown,
		/obj/item/weapon/reagent_containers/food/snacks/grown/mushroom,
		)
	blocked |= typesof(/obj/item/weapon/reagent_containers/food/snacks/customizable)

	var/list/borks = typesof(/obj/item/weapon/reagent_containers/food/snacks) - blocked
	// BORK BORK BORK

	playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)

	for(var/mob/living/carbon/human/M in viewers(get_turf(holder.my_atom), null))
		M.flash_eyes()

	for(var/i = 1, i <= 4 + rand(1,2), i++)
		var/chosen = pick(borks)
		var/obj/B = new chosen
		if(B)
			B.loc = get_turf(holder.my_atom)
			if(prob(50))
				for(var/j = 1, j <= rand(1, 3), j++)
					step(B, pick(NORTH,SOUTH,EAST,WEST))

/datum/chemical_reaction/slimebork2
	name = "Slime Bork 2"
	id = "m_tele4"
	result = null
	required_reagents = list("water" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/silver
	required_other = 1

/datum/chemical_reaction/slimebork2/on_reaction(var/datum/reagents/holder)

	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/list/blocked = list(/obj/item/weapon/reagent_containers/food/drinks)

	var/list/borks = typesof(/obj/item/weapon/reagent_containers/food/drinks) - blocked
	// BORK BORK BORK

	playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)

	for(var/mob/living/carbon/human/M in viewers(get_turf(holder.my_atom), null))
		M.flash_eyes()

	for(var/i = 1, i <= 4 + rand(1,2), i++)
		var/chosen = pick(borks)
		var/obj/B = new chosen
		if(B)
			B.loc = get_turf(holder.my_atom)
			if(prob(50))
				for(var/j = 1, j <= rand(1, 3), j++)
					step(B, pick(NORTH,SOUTH,EAST,WEST))

//Blue
/datum/chemical_reaction/slimefrost
	name = "Slime Frost Oil"
	id = "m_frostoil"
	result = "frostoil"
	required_reagents = list("plasma" = 1)
	result_amount = 10
	required_container = /obj/item/slime_extract/blue
	required_other = 1

/datum/chemical_reaction/slimefrost/on_reaction(var/datum/reagents/holder)
		feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")

/datum/chemical_reaction/slimefrost
	name = "Slime Frost Oil"
	id = "m_frostoil"
	result = "frostoil"
	required_reagents = list("plasma" = 1)
	result_amount = 10
	required_container = /obj/item/slime_extract/blue
	required_other = 1
/datum/chemical_reaction/slimefrost/on_reaction(var/datum/reagents/holder)
		feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")

//Dark Blue
/datum/chemical_reaction/slimefreeze
	name = "Slime Freeze"
	id = "m_freeze"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/darkblue
	required_other = 1

/datum/chemical_reaction/slimefreeze/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	for(var/mob/O in viewers(get_turf(holder.my_atom), null))
		O.show_message(text("The slime extract begins to vibrate violently !"), 1)
	spawn(50)
		if(holder && holder.my_atom)
			playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
			for(var/mob/living/M in range (get_turf(holder.my_atom), 7))
				M.bodytemperature -= 240
				M << "You feel a chill!"

//Orange
/datum/chemical_reaction/slimecasp
	name = "Slime Capsaicin Oil"
	id = "m_capsaicinoil"
	result = "capsaicin"
	required_reagents = list("blood" = 1)
	result_amount = 10
	required_container = /obj/item/slime_extract/orange
	required_other = 1

/datum/chemical_reaction/slimecasp/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")

/datum/chemical_reaction/slimefire
	name = "Slime fire"
	id = "m_fire"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/orange
	required_other = 1

/datum/chemical_reaction/slimefire/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	for(var/mob/O in viewers(get_turf(holder.my_atom), null))
		O.show_message(text("The slime extract begins to vibrate violently !"), 1)
	spawn(50)
		if(holder && holder.my_atom)
			var/turf/simulated/T = get_turf(holder.my_atom)
			if(istype(T))
				T.atmos_spawn_air(SPAWN_HEAT | SPAWN_TOXINS, 50)

//Yellow

/datum/chemical_reaction/slimeoverload
	name = "Slime EMP"
	id = "m_emp"
	result = null
	required_reagents = list("blood" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/yellow
	required_other = 1

/datum/chemical_reaction/slimeoverload/on_reaction(var/datum/reagents/holder, var/created_volume)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	empulse(get_turf(holder.my_atom), 3, 7)

/datum/chemical_reaction/slimecell
	name = "Slime Powercell"
	id = "m_cell"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/yellow
	required_other = 1

/datum/chemical_reaction/slimecell/on_reaction(var/datum/reagents/holder, var/created_volume)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/obj/item/weapon/stock_parts/cell/high/slime/P = new /obj/item/weapon/stock_parts/cell/high/slime
	P.loc = get_turf(holder.my_atom)

/datum/chemical_reaction/slimeglow
	name = "Slime Glow"
	id = "m_glow"
	result = null
	required_reagents = list("water" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/yellow
	required_other = 1

/datum/chemical_reaction/slimeglow/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	for(var/mob/O in viewers(get_turf(holder.my_atom), null))
		O.show_message(text("The slime begins to emit a soft light. Squeezing it will cause it to grow brightly."), 1)
	var/obj/item/device/flashlight/slime/F = new /obj/item/device/flashlight/slime
	F.loc = get_turf(holder.my_atom)

//Purple

/datum/chemical_reaction/slimepsteroid
	name = "Slime Steroid"
	id = "m_steroid"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/purple
	required_other = 1

/datum/chemical_reaction/slimepsteroid/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/obj/item/weapon/slimesteroid/P = new /obj/item/weapon/slimesteroid
	P.loc = get_turf(holder.my_atom)

/datum/chemical_reaction/slimejam
	name = "Slime Jam"
	id = "m_jam"
	result = "slimejelly"
	required_reagents = list("sugar" = 1)
	result_amount = 10
	required_container = /obj/item/slime_extract/purple
	required_other = 1

/datum/chemical_reaction/slimejam/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")

//Dark Purple
/datum/chemical_reaction/slimeplasma
	name = "Slime Plasma"
	id = "m_plasma"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/darkpurple
	required_other = 1

/datum/chemical_reaction/slimeplasma/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/obj/item/stack/sheet/mineral/plasma/P = new /obj/item/stack/sheet/mineral/plasma
	P.amount = 10
	P.loc = get_turf(holder.my_atom)

//Red
/*/datum/chemical_reaction/slimeglycerol
	name = "Slime Glycerol"
	id = "m_glycerol"
	result = "glycerol"
	required_reagents = list("plasma" = 1)
	result_amount = 8
	required_container = /obj/item/slime_extract/red
	required_other = 1

/datum/chemical_reaction/slimeglycerol/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
*/

/datum/chemical_reaction/slimeglycerol
	name = "Slime Glycerol"
	id = "m_glycerol"
	result = "glycerol"
	required_reagents = list("plasma" = 1)
	result_amount = 8
	required_container = /obj/item/slime_extract/red
	required_other = 1
/datum/chemical_reaction/slimeglycerol/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")

/datum/chemical_reaction/slimebloodlust
	name = "Bloodlust"
	id = "m_bloodlust"
	result = null
	required_reagents = list("blood" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/red
	required_other = 1

/datum/chemical_reaction/slimebloodlust/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	for(var/mob/living/carbon/slime/slime in viewers(get_turf(holder.my_atom), null))
		slime.rabid = 1
		for(var/mob/O in viewers(get_turf(holder.my_atom), null))
			O.show_message(text("The [slime] is driven into a frenzy!"), 1)

//Pink
/datum/chemical_reaction/slimeppotion
	name = "Slime Potion"
	id = "m_potion"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/pink
	required_other = 1

/datum/chemical_reaction/slimeppotion/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/obj/item/slimepotion/P = new /obj/item/slimepotion
	P.loc = get_turf(holder.my_atom)

//Black
/datum/chemical_reaction/slimemutate2
	name = "Advanced Mutation Toxin"
	id = "mutationtoxin2"
	result = "amutationtoxin"
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_other = 1
	required_container = /obj/item/slime_extract/black

/datum/chemical_reaction/slimemutate2/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")

//Oil
/datum/chemical_reaction/slimeexplosion
	name = "Slime Explosion"
	id = "m_explosion"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/oil
	required_other = 1

/datum/chemical_reaction/slimeexplosion/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	for(var/mob/O in viewers(get_turf(holder.my_atom), null))
		O.show_message(text("The slime extract begins to vibrate violently !"), 1)
	spawn(50)
		if(holder && holder.my_atom)
			explosion(get_turf(holder.my_atom), 1 ,3, 6)

//Light Pink
/datum/chemical_reaction/slimepotion2
	name = "Slime Potion 2"
	id = "m_potion2"
	result = null
	result_amount = 1
	required_container = /obj/item/slime_extract/lightpink
	required_reagents = list("plasma" = 1)
	required_other = 1

/datum/chemical_reaction/slimepotion2/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/obj/item/slimepotion2/P = new /obj/item/slimepotion2
	P.loc = get_turf(holder.my_atom)

//Adamantine
/datum/chemical_reaction/slimegolem
	name = "Slime Golem"
	id = "m_golem"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/adamantine
	required_other = 1

/datum/chemical_reaction/slimegolem/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/obj/effect/golemrune/Z = new /obj/effect/golemrune
	Z.loc = get_turf(holder.my_atom)
	notify_ghosts("Golem rune created in [get_area(Z)].", 'sound/effects/ghost2.ogg')

//Bluespace
/datum/chemical_reaction/slimecrystal
	name = "Slime Crystal"
	id = "m_crystal"
	result = null
	required_reagents = list("blood" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/bluespace
	required_other = 1

/datum/chemical_reaction/slimecrystal/on_reaction(var/datum/reagents/holder, var/created_volume)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	if(holder.my_atom)
		var/obj/item/bluespace_crystal/BC = new(get_turf(holder.my_atom))
		BC.visible_message("The [BC.name] appears out of thin air!")

/datum/chemical_reaction/slimeteleport
	name = "Slime Teleport"
	id = "m_teleport"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/bluespace
	required_other = 1

/datum/chemical_reaction/slimeteleport/on_reaction(var/datum/reagents/holder, var/created_volume)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	if(holder.my_atom)
		var/obj/item/device/radio/beacon/chosen
		var/list/possible = list()
		for(var/obj/item/device/radio/beacon/W in world)
			possible += W

		if(possible.len > 0)
			chosen = pick(possible)

		if(chosen)
				// Calculate previous position for transition

			var/turf/FROM = get_turf(holder.my_atom) // the turf of origin we're travelling FROM
			var/turf/TO = get_turf(chosen)			 // the turf of origin we're travelling TO

			playsound(TO, 'sound/effects/phasein.ogg', 100, 1)

			var/list/flashers = list()
			for(var/mob/living/carbon/human/M in viewers(TO, null))
				if(M.flash_eyes())
					flashers += M

			var/y_distance = TO.y - FROM.y
			var/x_distance = TO.x - FROM.x
			for (var/atom/movable/A in range(5, FROM )) // iterate thru list of mobs in the area
				if(istype(A, /obj/item/device/radio/beacon)) continue // don't teleport beacons because that's just insanely stupid
				if(istype(A, /atom/movable/lighting_overlay)) continue //don't move the lighting while at it!
				if(A.anchored) continue

				var/turf/newloc = locate(A.x + x_distance, A.y + y_distance, TO.z) // calculate the new place
				if(!A.Move(newloc) && newloc) // if the atom, for some reason, can't move, FORCE them to move! :) We try Move() first to invoke any movement-related checks the atom needs to perform after moving
					A.loc = newloc

				spawn()
					if(ismob(A) && !(A in flashers)) // don't flash if we're already doing an effect
						var/mob/M = A
						if(M.client)
							var/obj/blueeffect = new /obj(src)
							blueeffect.screen_loc = "WEST,SOUTH to EAST,NORTH"
							blueeffect.icon = 'icons/effects/effects.dmi'
							blueeffect.icon_state = "shieldsparkles"
							blueeffect.layer = 17
							blueeffect.mouse_opacity = 0
							M.client.screen += blueeffect
							sleep(20)
							M.client.screen -= blueeffect
							qdel(blueeffect)

//Cerulean
/datum/chemical_reaction/slimepsteroid2
	name = "Slime Steroid 2"
	id = "m_steroid2"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/cerulean
	required_other = 1

/datum/chemical_reaction/slimepsteroid2/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/obj/item/weapon/slimesteroid2/P = new /obj/item/weapon/slimesteroid2
	P.loc = get_turf(holder.my_atom)

//Sepia
/datum/chemical_reaction/slimestop
	name = "Slime Stop"
	id = "m_stop"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/sepia
	required_other = 1

/datum/chemical_reaction/slimestop/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/mob/mob = get_mob_by_key(holder.my_atom.fingerprintslast)
	var/obj/effect/timestop/T = new /obj/effect/timestop
	T.loc = get_turf(holder.my_atom)
	T.immune = mob
	T.timestop()

/datum/chemical_reaction/slimecamera
	name = "Slime Camera"
	id = "m_camera"
	result = null
	required_reagents = list("blood" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/sepia
	required_other = 1

/datum/chemical_reaction/slimecamera/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/obj/item/device/camera/P = new /obj/item/device/camera
	P.loc = get_turf(holder.my_atom)

/datum/chemical_reaction/slimefilm
	name = "Slime Film"
	id = "m_film"
	result = null
	required_reagents = list("water" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/sepia
	required_other = 1

/datum/chemical_reaction/slimefilm/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/obj/item/device/camera_film/P = new /obj/item/device/camera_film
	P.loc = get_turf(holder.my_atom)

//Pyrite
/datum/chemical_reaction/slimepaint
	name = "Slime Paint"
	id = "s_paint"
	result = null
	required_reagents = list("plasma" = 1)
	result_amount = 1
	required_container = /obj/item/slime_extract/pyrite
	required_other = 1

/datum/chemical_reaction/slimepaint/on_reaction(var/datum/reagents/holder)
	feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
	var/list/paints = typesof(/obj/item/weapon/paint) - /obj/item/weapon/paint
	var/chosen = pick(paints)
	var/obj/P = new chosen
	if(P)
		P.loc = get_turf(holder.my_atom)


code:
/datum/chemical_reaction/formaldehyde
	name = "formaldehyde"
	id = "Formaldehyde"
	result = "formaldehyde"
	required_reagents = list("ethanol" = 1, "oxygen" = 1, "silver" = 1)
	result_amount = 3
	required_temp = 420

/datum/chemical_reaction/neurotoxin2
	name = "neurotoxin2"
	id = "neurotoxin2"
	result = "neurotoxin2"
	required_reagents = list("space_drugs" = 1)
	result_amount = 1
	required_temp = 674

/datum/chemical_reaction/cyanide
	name = "Cyanide"
	id = "cyanide"
	result = "cyanide"
	required_reagents = list("oil" = 1, "ammonia" = 1, "oxygen" = 1)
	result_amount = 3
	required_temp = 380

/datum/chemical_reaction/itching_powder
	name = "Itching Powder"
	id = "itching_powder"
	result = "itching_powder"
	required_reagents = list("fuel" = 1, "ammonia" = 1, "anti_toxin" = 1)
	result_amount = 3

/datum/chemical_reaction/sulfonal
	name = "sulfonal"
	id = "sulfonal"
	result = "sulfonal"
	required_reagents = list("acetone" = 1, "diethylamine" = 1, "sulfur" = 1)
	result_amount = 3

/datum/chemical_reaction/mutagen
	name = "Unstable mutagen"
	id = "mutagen"
	result = "mutagen"
	required_reagents = list("radium" = 1, "phosphorus" = 1, "chlorine" = 1)
	result_amount = 3

/datum/chemical_reaction/lexorin
	name = "Lexorin"
	id = "lexorin"
	result = "lexorin"
	required_reagents = list("plasma" = 1, "hydrogen" = 1, "nitrogen" = 1)
	result_amount = 3

/datum/chemical_reaction/chloralhydrate
	name = "Chloral Hydrate"
	id = "chloralhydrate"
	result = "chloralhydrate"
	required_reagents = list("ethanol" = 1, "chlorine" = 3, "water" = 1)
	result_amount = 1

/datum/chemical_reaction/mutetoxin //i'll just fit this in here snugly between other unfun chemicals :v
	name = "Mute toxin"
	id = "mutetoxin"
	result = "mutetoxin"
	required_reagents = list("uranium" = 2, "water" = 1, "carbon" = 1)
	result_amount = 2

/datum/chemical_reaction/zombiepowder
	name = "Zombie Powder"
	id = "zombiepowder"
	result = "zombiepowder"
	required_reagents = list("carpotoxin" = 5, "morphine" = 5, "copper" = 5)
	result_amount = 2

/datum/chemical_reaction/mindbreaker
	name = "Mindbreaker Toxin" //man I wish it was still named LSD
	id = "mindbreaker"
	result = "mindbreaker"
	required_reagents = list("silicon" = 1, "hydrogen" = 1, "anti_toxin" = 1)
	result_amount = 5

/datum/chemical_reaction/stoxin
	name = "Sleep Toxin"
	id = "stoxin"
	result = "stoxin"
	required_reagents = list("chloralhydrate" = 1, "sugar" = 4)
	result_amount = 5

/datum/chemical_reaction/pacid
	name = "Polytrinic acid"
	id = "pacid"
	result = "pacid"
	required_reagents = list("sacid" = 1, "chlorine" = 1, "potassium" = 1)
	result_amount = 3

license: mit


code:
digraph chemistry{
    rankdir=LR
    splines=none;
    bgcolor=grey
    node [shape=record, style=filled, fillcolor=white, bgcolor=white]
 #   subgraph cluster_dispenser{
 #      label="Dispenser reagents";
 #     rank=same;
 #       style=filled;
 #       fillcolor="grey";
 #       {  node
 #           [
 #            style=filled;
 #            fillcolor="white",
 #            shape=box;
 #            ]
 #
 #           "hydrogen","lithium","carbon","nitrogen","oxygen","fluorine",
 #           "sodium","aluminium","silicon","phosphorus","sulfur","chlorine","potassium","iron",
 #           "copper","mercury","radium","water","ethanol","sugar","sacid","fuel","silver","iodine","bromine","stable plasma","tungsten"
 #           };
 #           }

        subgraph cluster_medicine{
            label="Medicine"
            bgcolor=lightblue
            node [fillcolor=white]
            bicaridine [label="Bicaridine | Heals brute damage| OD: 60 |No addiction |{1: inaprovaline | 1: carbon }"]
            kelotane [label="Kelotane| Heals burn damage| OD: 60 | No addiction | {1: silicon | 1: carbon}"]
            dermaline [label="Dermaline| Heals burn damage efficiently| OD: 60| {1: oxygen| 1: phosporous| 1: kelotane}"]
            dylovene [label="Anti-toxin (Dylovene)| Heals toxin damage and purges other chemicals| No overdose| No addiction | {1: nitrogen| 1: silicon| 1: potassium}"]
            inaprovaline [label="Inaprovaline| Stabilizes people in crit| OD: 30 | No addiction | {1: carbon | 1: oxygen| 1: sugar}"]
            tricordrazine [label="Tricordrazine| Heals all damage slowly| OD: 60 | No addiction | {1: inaprovaline | 1: dylovene}"]
            alkysine [label="Alkysine| Heals brain damage| No overdose| No addiction | {1: dylovene| 1: chlorine | 1: nitrogen}"]
            dexalin [label="Dexalin| Heals oxygen damage| OD: 60| No addiction| {2: oxygen |CATALYST: 5 plasma}"]
            dexalinplus [label="Dexalin Plus| Heals oxygen damage very well| OD: 60| No addiction| {1: dexalin| 1: iron| 1: carbon}"]
            hyperzine [label="Hyperzine| Makes user go fast | OD: 60 | No addiction | {1: sugar| 1: phosporous | 1: sulfur}"]
            hyronalin [label="Hyronalin| Heals radiation damage| No overdose| No addiction| {1: dylovene| 1: radium}"]
            arithrazine [label="Arithrazine| Heals radiation damage efficiently| No overdose| No addiction | {1: hyronalin | 1: hydrogen}"]
            ryetalyn [label="Ryetalyn| Cures mutations| No overdose| No addiction| {1: arithrazine |1: carbon}"]
            cryoxadone [label="Cryoxadone| Heals damage when user is cold| No overdose| No addiction| {1: stable plasma| 1: acetone | 1: mutagen}"]
            clonexadone [label="Clonexadone | Heals damage when user is cold| No overdose| No addiction| {1: cryoxadone| 1: sodium| CATALYST: 5 plasma}"]
            spaceacillin [label="Spaceacillin| Cures viruses | No overdose | No addiction | {1: cryptobiolin | 1: inaprovaline}"]
            inacusiate [label="Inacusiate| Heals ear damage| No overdose | No addiction | {1: water | 1: carbon| 1: dylovene}"]
            imidazoline [label="Imidazoline| Heals eye damage| No overdose | No addiction | {1: hydrogen | 1: carbon| 1: dylovene}"]
            ethylredoxrazine [label="Ethylredoxrazine| Cures drunkness| No overdose | No addiction | {1: oxygen | 1: carbon| 1: dylovene}"]
            leporazine [label="Leporazine| Stabilizes patient temperature| No overdose| No addiction| {1: silicon| 1: copper| CATALYST: 5 plasma}"]
            rezadone [label="Rezadone| Heals clone damage (toxic in high concentrations) | No overdose | No addiction| {1: carpotoxin | 1: cryptobiolin | 1: copper}"]
            synaptizine [label="Synaptizine| Cures diseases | No overdose | No addiction | {1: sugar | 1: lithium | 1: water}"]
            salglu [label="Saline Glucose Solution| Slowly heals burns and brute| No overdose| No addiction |{1: salt | 1: water| 1: sugar}"]
            calomel [label="Calomel | Purges other chemicals quickly and deals toxin damage| No overdose| No addiction |{1: mercury | 1: chlorine| TEMP: 374K}"]
            potiod [label="Potassium Iodide| Heals low radiation damage| No overdose| No addiction| {1: potassium| 1:iodine}"]
            penacid [label="Pentetic Acid| Purges other chemicals and heals toxin damage| No overdose| No addiction| {1: fuel| 1: chlorine| 1: ammonia| 1: formaldehyde| 1: sodium| 1: cyanide}"]
            ephedrine [label="Ephedrine| Makes user go fast and lessens stuns| OD: 45 | AD: 30 | {1: sugar| 1: oil| 1:hydrogen| 1: diethylamine}"]
            dipenhydramine [label="Dipenhydramine| Purges histamine| No overdose| No addiction |{1: oil | 1: carbon | 1: bromine | 1: diethylamine| 1: ethanol}"]
            atropine [label="Atropine| Heals critted patients| OD: 35| No addiction | {1: ethanol| 1: acetone | 1: diethylamine| 1: phenol | 1: sacid}"]
            "strange reagent" [label="Strange Reagent| Can revive dead people, but hurts the living| No overdose| No addiction| {1: tricordrazine |1: holy water | 1:mutagen}"]
            insulin [label="Insulin | Removes sugar from patient| No overdose | No addiction"]
            morphine [label="Morphine | Knocks user out after some time | OD: 30 | AD: 25"]
            omnizine [label="Omnizine | Heals all damage | OD: 30 | No addiction"]
            doctordelight [label="Doctor's Delight | Heals all damage | OD: 55 | No addiction | {1: tricordrazine | 1: cream | 1: tomato juice | 1: lime juice | 1: orange juice}"]
            silver_sulf [label="Silver Sulfadiazine | Heals burn damage on touch| No overdose| No addiction| {1: ammonia|1: silver|1: sulfur|1: oxygen|1: chlorine}"]
            styptic [label="Styptic Powder | Heals brute damage on touch| No overdose | No addiction| {1: aluminium| 1: hydrogen| 1: oxygen |1: sacid}"]

            };

        subgraph cluster_drugs{
            label="Drugs"
            bgcolor=lavender
            node [fillcolor=white]
            "space drugs" [label="Space Drugs| A generic drug| No overdose |No addiction | {1: lithium| 1: sugar| 1: mercury}"]
            nicotine [label="Nicotine| Reduces stun times| No overdose| AD: 30"]
            crank [label="Crank| Reduce stun times| OD: 20| AD: 10|{1: dipenhydramate| 1: ammonia | 1: lithium| 1: sacid| 1: fuel | TEMP: 390K}"]
            krokodil [label="Krokodil| Makes user feel calm| OD: 20 | AD:10| {1: diphenhydramine| 1: morphine| 1: cleaner| 1: potassium | 1: phosphorus| 1: fuel| TEMP: 380K}"]
            meth [label="Methanphetamine| Reduce stuns and speed user up| OD: 20| AD:10 |{1: ephedrine| 1: iodine| 1: phosphorus | 1:hydrogen| TEMP: 374K }"]
            "bath salts" [label="Bath Salts| Reduce stuns and stamina damage| OD: 20| AD: 10 |{ 1: ???? (bad food)| 1: saltpetre 1: nutriment| 1: cleaner| 1: enzyme| 1: tea |1: mercury| TEMP = 374K}"]
            aranesp [label="Aranesp| Makes user feel amped and take oxygen damage | No overdose | No addiction | {1: inaprovaline| 1: atropine| 1: morphine}"]
            hotline [label="Hotline| Makes user feel alert | OD: 15 | AD: 10"];
            };

        subgraph cluster_other{
            label="Misc"
            bgcolor=white
            node [fillcolor=white]
            lube [label="Space Lube| Makes floors slippery| {1: water | 1: silicon | 1: oxygen}"]
            sterilizine [label="Sterilizine| Minor tox damage when ingested| {1: ethanol| 1: dylovene| 1: chlorine}"]
            cryptobiolin [label="Cryptobiolin| Confuses when ingested|{1: potassium| 1: oxygen| 1:sugar}"]
            glycerol [label="Glycerol| Used for nitroglycerine| {3: cornoil| 1: sacid}"]
            salt [label="Salt| Standard table salt| {1: sodium| 1: chlorine}"]
            "condensed capsacin" [label="Condensed Capsacin| Used for riot control| {1: capsacin | 5: ethanol}"]
            "virus food" [label="Virus Food| Used to get low level virus symptoms| {5: water|5: milk}"]
            surfactant [label="Foam Surfactant| Used to make foam| {2: carbon| 2: fluorine| 1: sacid}"]
            foam [label="Foam reaction| The actual foam releasing reaction| {1: foam surfactant| 1: water}"]
            foaming_agent [label="Foaming Agent| Used in metal foams|{1: lithium | 1:hydrogen}"]
            metalfoam [label="Metal Foam| Creates light metal walls| {1: foaming agent| 1: pacid | 3: aluminium}"]
            ironfoam [label="Iron Foam| Creates metal walls| {1: foaming agent| 1: pacid | 3: iron}"]
            ammonia [label="Ammonia| Fertilizer | {3: hydrogen | 1:nitrogen}"]
            diethylamine [label="Diethylamine| More powerful fertizer | {1: ammonia | 1: ethanol}"]
            spacecleaner [label="Space cleaner| A cleaner that doesn't slip| {1: ammonia | 1: water}"]
            plantbgone [label="Plant-b-Gone| A weedkiller|{1: toxin | 4: water}"]
            weedkiller [label="Weedkiller| A weedkiller|{1: toxin | 4: ammonia}"]
            pestkiller [label="Pestkiller| A pestkiller|{1: toxin | 4: ethanol}"]
            acetone [label="Acetone| Chemical component|{1: oil | 1:fuel| 1:oxygen}"]
            carpet [label="Carpet | Makes carpets | {1: space drugs | 1: blood}"]
            oil [label="Oil| Chemical component | {1: fuel| 1: carbon| 1: hydrogen}"]
            ash [label="Ash| Chemical waste | {1: Oil | TEMP: 480K}"]
            phenol [label="Phenol| Chemical component| {1: water| 1: chlorine| 1: oil}"]
            colorful_reagent [label="Colorful Reagent| Colors things| {1: stable plasma| 1: radium| 1: space drugs | 1: cryoxadone | 1: triple citrus}"]
            life [label="Life| Creates a lifeform when mixed | {1: strange reagent | 1: cryoxadone | 1: blood| TEMP: 374K}"]
            corgium [label="Corgium| Creates a corgi| {1: nutriment | 1: colorful_reagent| 1: strange_reagent| 1: blood| TEMP: 374K}"]
            hair_dye [label="Hair dye| Colors hair when used | {1: colorful reagent| 1:radium | 1:space drugs}"]
            barbers_aid [label="Barber's aid| Changes hairstyle when used| {1: carpet| 1: radium| 1: space drugs}"]
            concentrated_barbers_aid [label="Concentrated barber's aid| Grows hair when used| {1: barber's aid| 1: mutagen}"]
            saltpetre [label="Saltpetre| Chemical component| {1: nitrogen| 1: potassium| 3: oxygen}"];
            };

        subgraph cluster_pyro{
            label="Pyrotechnics"
            bgcolor=lightcoral
            node [fillcolor=white]
            nitroglycerin [label="Nitroglycerin| Explodes well (can be stabilized)|{3: glycerol| 1: pacid| 1: sacid}"]
            potassium_explosion [label="Potassium explosion| Explodes|{1: water | 1: potassium}"]
            blackpowder [label="Blackpowder| Explodes at 474K|{1: saltpetre| 1: dylovene | 1: sulfur}"]
            thermite [label="Thermite| Can melt walls| {1: aluminium| 1:oxygen | 1:iron}"]
            emp_pulse [label="EMP| Disables electronics | {1: uranium | 1: iron}"]
            stabilizing_agent [label="Stabilizing Agent| Stops certain reaction from happening| {1: iron| 1: oxygen| 1: hydrogen}"]
            clf3 [label="Chlorine Trifluoride| Flammable| {1:chlorine | 3:fluorine | TEMP: 374K}"]
            sorium [label="Sorium| Sends everything flying away from the reaction (can be stabilized)| {1: mercury| 1: oxygen | 1: nitrogen| 1: carbon}"]
            ldm [label="Liquid Dark Matter| Sends everything flying into the reaction (can be stabilized)| {1: stable plasma| 1: radium| 1: carbon}"]
            flash [label="Flash Powder| Emit a bright flash (can be stabilized)|{1: aluminium| 1: potassium| 1: sulfur}"]
            smoke [label="Smoke Powder| Creates smoke (can be stabilized)|{1: phosporous| 1: potassium| 1: sugar}"]
            sonic [label="Sonic Powder| Makes a loud noise (can be stabilized)|{1: oxygen| 1: cola | 1: phosporous}"]
            phlogiston [label="Phlogiston| Sets things on fire (can be stabilized)| {1: phosporous| 1: sacid| 1: stable plasma}"]
            napalm [label="Napalm| Sets things on fire|{1: sugar| 1: fuel| 1: ethanol}"]
            cryostylene [label="Cryostylene| Comes into existance at 20K and cools down when reacting with oxygen|{1: water| 1: stable plasma | 1:nitrogen}"]
            pyrosium [label="Pyrosium| Comes into existance at 20K and heats up when reacting with oxygen|{1: radium| 1: stable plasma | 1:phosporus}"]
        }
        subgraph cluster_toxins{
            label="Toxins"
            bgcolor=mediumspringgreen
            node [fillcolor=white]
            formaldehyde [label="Formaldehyde| Toxic chemical component, decays into histamine|{1: ethanol| 1: oxygen| 1: silver}"]
            neurotoxin [label="Neurotoxin| Does brain and tox damage, possibly knocking the user out|{1:space drugs| TEMP:674}"]
            cyanide [label="Cyanide| Does oxygen and toxic damage| {1: oil| 1: ammonia| 1:oxygen| TEMP:380}"]
            itching_powder [label="Itching Powder| Does minor brute damage and annoyance and decays into histamine|{1: fuel| 1:ammonia| 1: dylovene}"]
            sulfonal [label="Sulfonal| Does toxin damage and also a knockout after some time| {1: acetone|1: diethylamine| 1: sulfur}"]
            mutagen [label="Unstable Mutagen| Causes mutations| {1: chlorine | 1: radium| 1: phosporus}"]
            lexorin [label="Lexorin| Prevents breathing and causes tissue damage| {1: plasma| 1: hydrogen | 1: nitrogen}"]
            chloral [label="Chloral Hydrate| Knocks out user and causes toxin damage after some time| {3: chlorine | 1: ethanol | 1:water}"]
            mutetoxin [label="Mute Toxin| Makes user silent | {2:uranium | 1: water | 1: carbon}"]
            zombiepowder [label="Zombie Powder| User appears dead on examination| {5: carpotoxin | 5: morphine | 5: copper}"]
            mindbreaker [label="Mindbreaker| Causes hallucinations on user| {1: silicon| 1: hydrogen| 1: dylovene}"]
            stoxin [label="Sleep Toxin| Makes user sleep after some time| {1: chloral hydrate | 4: sugar}"]
            pacid [label="Polytrinic Acid| Melts things | {1: sacid | 1: chlorine | 1: potassium}"]
            impedrezene [label="Impedrezene| Causes brain damage when ingested| {1: mercury| 1:oxygen| 1: sugar}"]
            toxin [label="Toxin| A basic toxin"]
            amatoxin [label="Amatoxin| Toxin found in fly amanitas"]
            slimejelly [label="Slime Jelly| Toxin extracted from slimes"]
            minttoxin [label="Mint Toxin| Gibs fat people and is found on mint"]
            carpotoxin [label="Carpotoxin| Found in space carps"]
            spore [label="Spore Toxin| Causes vision impairment"]
            burningspore [label="Burning Spore Toxin| Ignites people"]
            staminatoxin [label="Stamina Toxin| Causes stamina damage"]
            polonium [label="Polonium| Cause significant irradiation over time"]
            histamine [label="Histamine | Created by toxin decay, the effects greatly depend on the dose| OD: 30"]
            venom [label="Venom| Does brute and toxin damage while decaying into histamine"]
            foodpoisoning [label="Food Poisoning (known as ????)| Found in burned messes"]
            initropidril [label="Initropidril| Causes some toxin damage and can cause heart attacks"]
            pancuronium [label="Pancuronium| Causes oxygen loss and knockouts"]
            sodiumthiopental [label="Sodium thiopental| Causes sleep and stamina loss"]
            amanitin [label="Amanitin| Deal toxin damage proportional to the time it has been in the user's body"]
            coniine [label="Coniine| Deals oxygen and toxin damage"]
            curare [label="Curare| Deals oxygen and toxin damage, can weaken"]
        }
#        #Arrows go here
#        inaprovaline -> bicaridine
#        {inaprovaline dylovene} -> tricordrazine
#        {venom itching_powder formaldehyde} -> histamine
#        {morphine carpotoxin} -> zombiepowder
#        chloral -> stoxin
#        dylovene -> mindbreaker
#        {ammonia dylovene} -> itching_powder
#        {saltpetre dylovene} -> blackpowder
#        kelotane -> dermaline
#        dexalin -> dexalinplus
#        "space drugs" -> {neurotoxin barbers_aid carpet hair_dye colorful_reagent}
#        pacid -> nitroglycerin
#        dylovene -> {alkysine ethylredoxrazine imidazoline inacusiate hyronalin sterilizine}
#        {cryptobiolin inaprovaline} -> spaceacillin
#        hyronalin -> arithrazine
#        arithrazine -> ryetalyn
#        morphine -> {aranesp krokodil}
#        ammonia -> {cyanide penacid diethylamine silver_sulf crank weedkiller spacecleaner}
#        diethylamine -> {sulfonal atropine dipenhydramine ephedrine}
#        acetone -> {cryoxadone atropine sulfonal}
#        cryoxadone -> {life clonexadone colorful_reagent}
#        mutagen -> {concentrated_barbers_aid cryoxadone "strange reagent"}
#        barbers_aid -> concentrated_barbers_aid
#        colorful_reagent -> {corgium hair_dye}
#        "strange reagent" -> {corgium life}
#

        }


code:
/obj/item/weapon/reagent_containers
	name = "Container"
	desc = "..."
	icon = 'icons/obj/chemical.dmi'
	icon_state = null
	w_class = 1
	var/amount_per_transfer_from_this = 5
	var/possible_transfer_amounts = list(5,10,15,25,30)
	var/volume = 30
	var/list/banned_reagents = list() //List of reagent IDs we reject.
	var/list/list_reagents = null
	var/spawned_disease = null
	var/disease_amount = 20

/obj/item/weapon/reagent_containers/verb/set_APTFT() //set amount_per_transfer_from_this
	set name = "Set transfer amount"
	set category = "Object"
	set src in range(0)
	if(usr.stat || !usr.canmove || usr.restrained())
		return
	var/N = input("Amount per transfer from this:","[src]") as null|anything in possible_transfer_amounts
	if (N)
		amount_per_transfer_from_this = N

/obj/item/weapon/reagent_containers/New(location, vol = 0)
	..()
	if (!possible_transfer_amounts)
		src.verbs -= /obj/item/weapon/reagent_containers/verb/set_APTFT
	if (vol > 0)
		volume = vol
	create_reagents(volume)
	if(spawned_disease)
		var/datum/disease/F = new spawned_disease(0)
		var/list/data = list("viruses"= list(F))
		reagents.add_reagent("blood", disease_amount, data)
	if(list_reagents)
		reagents.add_reagent_list(list_reagents)

/obj/item/weapon/reagent_containers/attack_self(mob/user as mob)
	return

/obj/item/weapon/reagent_containers/attack(mob/M as mob, mob/user as mob, def_zone)
	return

/obj/item/weapon/reagent_containers/afterattack(obj/target, mob/user , flag)
	return

/obj/item/weapon/reagent_containers/proc/reagentlist(var/obj/item/weapon/reagent_containers/snack) //Attack logs for regents in pills
	var/data
	if(snack.reagents.reagent_list && snack.reagents.reagent_list.len) //find a reagent list if there is and check if it has entries
		for (var/datum/reagent/R in snack.reagents.reagent_list) //no reagents will be left behind
			data += "[R.id]([R.volume] units); " //Using IDs because SOME chemicals(I'm looking at you, chlorhydrate-beer) have the same names as other chemicals.
		return data
	else return "No reagents"

/obj/item/weapon/reagent_containers/proc/canconsume(mob/eater, mob/user)
	if(!eater.SpeciesCanConsume())
		return 0
	//Check for covering mask
	var/obj/item/clothing/cover = eater.get_item_by_slot(slot_wear_mask)

	if(isnull(cover)) // No mask, do we have any helmet?
		cover = eater.get_item_by_slot(slot_head)
	else
		var/obj/item/clothing/mask/covermask = cover
		if(covermask.alloweat) // Specific cases, clownmask for example.
			return 1

	if(!isnull(cover))
		if((cover.flags & HEADCOVERSMOUTH) || (cover.flags & MASKCOVERSMOUTH))
			var/who = (isnull(user) || eater == user) ? "your" : "their"

			if(istype(cover, /obj/item/clothing/mask/))
				user << "You have to remove [who] mask first!"
			else
				user << "You have to remove [who] helmet first!"

			return 0
	return 1

/obj/item/weapon/reagent_containers/ex_act()
	if(reagents)
		for(var/datum/reagent/R in reagents.reagent_list)
			R.on_ex_act()
	..()

/obj/item/weapon/reagent_containers/fire_act()
	reagents.chem_temp += 30
	reagents.handle_reactions()
	..()


code:
/obj/item/weapon/reagent_containers/blood
	name = "blood pack"
	desc = "Contains blood used for transfusion. Must be attached to an IV drip."
	icon = 'icons/obj/bloodpack.dmi'
	icon_state = "empty"
	volume = 200

	var/blood_type = null

/obj/item/weapon/reagent_containers/blood/New()
	..()
	if(blood_type != null)
		name = "blood pack [blood_type]"
		reagents.add_reagent("blood", 200, list("donor"=null,"viruses"=null,"blood_DNA"=null,"blood_type"=blood_type,"resistances"=null,"trace_chem"=null))
		update_icon()

/obj/item/weapon/reagent_containers/blood/on_reagent_change()
	update_icon()

/obj/item/weapon/reagent_containers/blood/update_icon()
	var/percent = round((reagents.total_volume / volume) * 100)
	switch(percent)
		if(0 to 9)			icon_state = "empty"
		if(10 to 50) 		icon_state = "half"
		if(51 to INFINITY)	icon_state = "full"

/obj/item/weapon/reagent_containers/blood/random/New()
	blood_type = pick("A+", "A-", "B+", "B-", "O+", "O-")
	..()

/obj/item/weapon/reagent_containers/blood/APlus
	blood_type = "A+"

/obj/item/weapon/reagent_containers/blood/AMinus
	blood_type = "A-"

/obj/item/weapon/reagent_containers/blood/BPlus
	blood_type = "B+"

/obj/item/weapon/reagent_containers/blood/BMinus
	blood_type = "B-"

/obj/item/weapon/reagent_containers/blood/OPlus
	blood_type = "O+"

/obj/item/weapon/reagent_containers/blood/OMinus
	blood_type = "O-"

/obj/item/weapon/reagent_containers/blood/empty
	name = "empty blood pack"
	desc = "Seems pretty useless... Maybe if there were a way to fill it?"
	icon_state = "empty"


code:
/*
Contains:
Borg Hypospray
Borg Shaker
Nothing to do with hydroponics in here. Sorry to dissapoint you. //fucking tg spaghetti
*/

/*
Borg Hypospray
*/
/obj/item/weapon/reagent_containers/borghypo
	name = "cyborg hypospray"
	desc = "An advanced chemical synthesizer and injection system, designed for heavy-duty medical equipment."
	icon = 'icons/obj/syringe.dmi'
	item_state = "hypo"
	icon_state = "borghypo"
	amount_per_transfer_from_this = 5
	volume = 30
	possible_transfer_amounts = null
	var/mode = 1
	var/charge_cost = 50
	var/charge_tick = 0
	var/recharge_time = 5 //Time it takes for shots to recharge (in seconds)

	var/list/datum/reagents/reagent_list = list()
	var/list/reagent_ids = list("dexalin", "doctorsdelight", "anti_toxin", "inaprovaline", "spaceacillin")
	//var/list/reagent_ids = list("salbutamol", "salglu_solution", "salglu_solution", "charcoal", "ephedrine", "spaceacillin")
	var/list/modes = list() //Basically the inverse of reagent_ids. Instead of having numbers as "keys" and strings as values it has strings as keys and numbers as values.
								//Used as list for input() in shakers.

/obj/item/weapon/reagent_containers/borghypo/New()
	..()

	var/iteration = 1
	for(var/R in reagent_ids)
		add_reagent(R)
		modes[R] = iteration
		iteration++

	SSobj.processing |= src

/obj/item/weapon/reagent_containers/borghypo/Destroy()
	SSobj.processing.Remove(src)
	..()

/obj/item/weapon/reagent_containers/borghypo/process() //Every [recharge_time] seconds, recharge some reagents for the cyborg
	charge_tick++
	if(charge_tick >= recharge_time)
		regenerate_reagents()
		charge_tick = 0

	//update_icon()
	return 1

// Purely for testing purposes I swear~
/*
/obj/item/weapon/reagent_containers/borghypo/verb/add_cyanide()
	set src in world
	add_reagent("cyanide")
*/

// Use this to add more chemicals for the borghypo to produce.
/obj/item/weapon/reagent_containers/borghypo/proc/add_reagent(var/reagent)
	reagent_ids |= reagent
	var/datum/reagents/RG = new(30)
	RG.my_atom = src
	reagent_list += RG

	var/datum/reagents/R = reagent_list[reagent_list.len]
	R.add_reagent(reagent, 30)

/obj/item/weapon/reagent_containers/borghypo/proc/regenerate_reagents()
	if(isrobot(src.loc))
		var/mob/living/silicon/robot/R = src.loc
		if(R && R.cell)
			var/datum/reagents/RG = reagent_list[mode]
			if(RG.total_volume < RG.maximum_volume) 	//Don't recharge reagents and drain power if the storage is full.
				R.cell.use(charge_cost) 					//Take power from borg...
				RG.add_reagent(reagent_ids[mode], 5)		//And fill hypo with reagent.

/obj/item/weapon/reagent_containers/borghypo/attack(mob/living/M as mob, mob/user as mob)
	var/datum/reagents/R = reagent_list[mode]
	if(!R.total_volume)
		user << "The injector is empty."
		return
	if (!( istype(M) ))
		return
	if (R.total_volume && M.can_inject(user, 1))
		M << "You feel a tiny prick!"
		user << "You inject [M] with the injector."
		R.reaction(M, INGEST)
		if(M.reagents)
			var/trans = R.trans_to(M, amount_per_transfer_from_this)
			user << "[trans] unit\s injected.  [R.total_volume] unit\s remaining."
	return

/obj/item/weapon/reagent_containers/borghypo/attack_self(mob/user)
	mode++
	if(mode > reagent_list.len)
		mode = 1
	playsound(loc, 'sound/effects/pop.ogg', 50, 0)

	var/datum/reagent/R = chemical_reagents_list[reagent_ids[mode]]
	user << "[src] is now dispensing '[R.name]'."
	return

/obj/item/weapon/reagent_containers/borghypo/examine(mob/user)
	usr = user
	..()
	DescribeContents()	//Because using the standardized reagents datum was just too cool for whatever fuckwit wrote this

/obj/item/weapon/reagent_containers/borghypo/proc/DescribeContents()
	var/empty = 1

	for(var/datum/reagents/RS in reagent_list)
		var/datum/reagent/R = locate() in RS.reagent_list
		if(R)
			usr << "It currently has [R.volume] unit\s of [R.name] stored."
			empty = 0

	if(empty)
		usr << "It is currently empty. Allow some time for the internal syntheszier to produce more."

/*
Borg Patch Applier
*/
/obj/item/weapon/reagent_containers/borghypo/patcher
	name = "cyborg applicator"
	desc = "An advanced chemical synthesizer and application system, designed for heavy-duty medical equipment."
	icon = 'icons/obj/chemical.dmi'
	icon_state = "bandaid"
	item_state = "bandaid"
	reagent_ids = list("doctorsdelight", "ryetalyn")

/obj/item/weapon/reagent_containers/borghypo/patcher/attack(mob/living/M as mob, mob/user as mob)
	var/datum/reagents/R = reagent_list[mode]
	if(!R.total_volume)
		user << "The applicator is empty."
		return
	if (!( istype(M) ))
		return
	if (R.total_volume)
		M << "Something got squirted on you!"
		user << "You patch [M] with the applier."
		R.reaction(M, TOUCH)
		if(M.reagents)
			var/trans = R.trans_to(M, amount_per_transfer_from_this)
			user << "[trans] unit\s applied.  [R.total_volume] unit\s remaining."

/*
Borg Shaker
*/
/obj/item/weapon/reagent_containers/borghypo/borgshaker
	name = "cyborg shaker"
	desc = "An advanced drink synthesizer and mixer."
	icon = 'icons/obj/drinks.dmi'
	icon_state = "shaker"
	possible_transfer_amounts = list(5,10,20)
	charge_cost = 20 //Lots of reagents all regenerating at once, so the charge cost is lower. They also regenerate faster.
	recharge_time = 3

	reagent_ids = list("beer", "orangejuice", "limejuice", "tomatojuice", "cola", "tonic", "sodawater", "ice", "cream", "whiskey", "vodka", "rum", "gin", "tequila", "vermouth", "wine", "kahlua", "cognac", "ale")

/obj/item/weapon/reagent_containers/borghypo/borgshaker/attack(mob/M as mob, mob/user as mob)
	return //Can't inject stuff with a shaker, can we?

/obj/item/weapon/reagent_containers/borghypo/borgshaker/regenerate_reagents()
	if(isrobot(src.loc))
		var/mob/living/silicon/robot/R = src.loc
		if(R && R.cell)
			for(var/i in modes) //Lots of reagents in this one, so it's best to regenrate them all at once to keep it from being tedious.
				var/valueofi = modes[i]
				var/datum/reagents/RG = reagent_list[valueofi]
				if(RG.total_volume < RG.maximum_volume)
					R.cell.use(charge_cost)
					RG.add_reagent(reagent_ids[valueofi], 5)

/obj/item/weapon/reagent_containers/borghypo/borgshaker/attack_self(mob/user)
	mode = modes[input(user, "What reagent do you want to dispense?") as anything in reagent_ids]

	playsound(loc, 'sound/effects/pop.ogg', 50, 0)

	var/datum/reagent/R = chemical_reagents_list[reagent_ids[mode]]
	user << "[src] is now dispensing '[R.name]'."
	return

/obj/item/weapon/reagent_containers/borghypo/borgshaker/afterattack(obj/target, mob/user, proximity)
	if(!proximity) return

	else if(target.is_open_container() && target.reagents)
		var/datum/reagents/R = reagent_list[mode]
		if(!R.total_volume)
			user << "[src] is currently out of this ingredient. Please allow some time for the synthesizer to produce more."
			return

		if(target.reagents.total_volume >= target.reagents.maximum_volume)
			user << "[target] is full."
			return

		var/trans = R.trans_to(target, amount_per_transfer_from_this)
		user << "You transfer [trans] unit\s of the solution to [target]."

/obj/item/weapon/reagent_containers/borghypo/borgshaker/DescribeContents()
	var/empty = 1

	var/datum/reagents/RS = reagent_list[mode]
	var/datum/reagent/R = locate() in RS.reagent_list
	if(R)
		usr << "It currently has [R.volume] unit\s of [R.name] stored."
		empty = 0

	if(empty)
		usr << "It is currently empty. Please allow some time for the synthesizer to produce more."

/obj/item/weapon/reagent_containers/borghypo/borgshaker/hacked
	..()
	name = "cyborg shaker"
	desc = "Will mix drinks that knock them dead."
	icon = 'icons/obj/drinks.dmi'
	icon_state = "threemileislandglass"
	possible_transfer_amounts = list(5,10,20)
	charge_cost = 20 //Lots of reagents all regenerating at once, so the charge cost is lower. They also regenerate faster.
	recharge_time = 3

	reagent_ids = list("beer2")

/*
Human variants
*/

/obj/item/weapon/reagent_containers/borghypo/human  //honk
	name = "advanced hypospray"
	charge_cost = 0

/obj/item/weapon/reagent_containers/borghypo/human/regenerate_reagents()
	var/datum/reagents/RG = reagent_list[mode]
	if(RG.total_volume < RG.maximum_volume) 	//Don't recharge reagents if the storage is full.
		RG.add_reagent(reagent_ids[mode], 5)		//And fill hypo with reagent.

/obj/item/weapon/reagent_containers/borghypo/patcher/human
	name = "advanced applier"
	charge_cost = 0

/obj/item/weapon/reagent_containers/borghypo/patcher/human/regenerate_reagents()
	var/datum/reagents/RG = reagent_list[mode]
	if(RG.total_volume < RG.maximum_volume)
		RG.add_reagent(reagent_ids[mode], 5)

/obj/item/weapon/reagent_containers/borghypo/borgshaker/human
	name = "advanced shaker"
	charge_cost = 0

/obj/item/weapon/reagent_containers/borghypo/borgshaker/human/regenerate_reagents()
	var/datum/reagents/RG = reagent_list[mode]
	if(RG.total_volume < RG.maximum_volume)
		RG.add_reagent(reagent_ids[mode], 5)


code:
//Not to be confused with /obj/item/weapon/reagent_containers/food/drinks/bottle

/obj/item/weapon/reagent_containers/glass/bottle
	name = "bottle"
	desc = "A small bottle."
	icon_state = null
	item_state = "atoxinbottle"
	possible_transfer_amounts = list(1,2,5,10,15,25,30)
	volume = 30

/obj/item/weapon/reagent_containers/glass/bottle/New()
	..()
	if(!icon_state)
		icon_state = "bottle[rand(1,20)]"

/obj/item/weapon/reagent_containers/glass/bottle/inaprovaline
	name = "inaprovaline bottle"
	desc = "A small bottle. Contains inaprovaline - used to stabilize patients."
	icon_state = "bottle16"
	list_reagents = list("inaprovaline" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/toxin
	name = "toxin bottle"
	desc = "A small bottle of toxins. Do not drink, it is poisonous."
	icon_state = "bottle12"
	list_reagents = list("toxin" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/cyanide
	name = "cyanide bottle"
	desc = "A small bottle of cyanide. Bitter almonds?"
	icon_state = "bottle12"
	list_reagents = list("cyanide" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/morphine
	name = "morphine bottle"
	desc = "A small bottle of morphine."
	icon = 'icons/obj/chemical.dmi'
	icon_state = "bottle20"
	list_reagents = list("morphine" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/chloralhydrate
	name = "Chloral Hydrate Bottle"
	desc = "A small bottle of Choral Hydrate. Mickey's Favorite!"
	icon_state = "bottle20"
	list_reagents = list("chloralhydrate" = 15)

/obj/item/weapon/reagent_containers/glass/bottle/antitoxin
	name = "antitoxin bottle"
	desc = "A small bottle of dylovene."
	icon_state = "bottle17"
	list_reagents = list("anti_toxin" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/mutagen
	name = "unstable mutagen bottle"
	desc = "A small bottle of unstable mutagen. Randomly changes the DNA structure of whoever comes in contact."
	icon_state = "bottle20"
	list_reagents = list("mutagen" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/plasma
	name = "liquid plasma bottle"
	desc = "A small bottle of liquid plasma. Extremely toxic and reacts with micro-organisms inside blood."
	icon_state = "bottle8"
	list_reagents = list("plasma" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/synaptizine
	name = "synaptizine bottle"
	desc = "A small bottle of synaptizine."
	icon_state = "bottle20"
	list_reagents = list("synaptizine" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/ammonia
	name = "ammonia bottle"
	desc = "A small bottle of ammonia."
	icon_state = "bottle20"
	list_reagents = list("ammonia" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/diethylamine
	name = "diethylamine bottle"
	desc = "A small bottle of diethylamine."
	icon_state = "bottle17"
	list_reagents = list("diethylamine" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/pacid
	name = "Polytrinic Acid Bottle"
	desc = "A small bottle. Contains a small amount of Polytrinic Acid"
	icon_state = "bottle17"
	list_reagents = list("pacid" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/adminordrazine
	name = "Adminordrazine Bottle"
	desc = "A small bottle. Contains the liquid essence of the gods."
	icon = 'icons/obj/drinks.dmi'
	icon_state = "holyflask"
	list_reagents = list("adminordrazine" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/capsaicin
	name = "Capsaicin Bottle"
	desc = "A small bottle. Contains hot sauce."
	icon_state = "bottle3"
	list_reagents = list("capsaicin" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/frostoil
	name = "Frost Oil Bottle"
	desc = "A small bottle. Contains cold sauce."
	icon_state = "bottle17"
	list_reagents = list("frostoil" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/traitor
	name = "syndicate bottle"
	desc = "A small bottle. Contains a random nasty chemical."
	icon = 'icons/obj/chemical.dmi'
	icon_state = "bottle16"
	var/extra_reagent = null

/obj/item/weapon/reagent_containers/glass/bottle/traitor/New()
	..()
	extra_reagent = pick("polonium", "histamine", "formaldehyde", "venom", "neurotoxin2", "cyanide")
	reagents.add_reagent("[extra_reagent]", 3)

/obj/item/weapon/reagent_containers/glass/bottle/polonium
	name = "polonium bottle"
	desc = "A small bottle. Contains Polonium."
	icon_state = "bottle16"
	list_reagents = list("polonium" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/venom
	name = "venom bottle"
	desc = "A small bottle. Contains Venom."
	icon_state = "bottle16"
	list_reagents = list("venom" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/neurotoxin2
	name = "neurotoxin bottle"
	desc = "A small bottle. Contains Neurotoxin."
	icon_state = "bottle16"
	list_reagents = list("neurotoxin2" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/formaldehyde
	name = "formaldehyde bottle"
	desc = "A small bottle. Contains Formaldehyde."
	icon_state = "bottle16"
	list_reagents = list("formaldehyde" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/initropidril
	name = "initropidril bottle"
	desc = "A small bottle. Contains initropidril."
	icon_state = "bottle16"
	list_reagents = list("initropidril" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/pancuronium
	name = "pancuronium bottle"
	desc = "A small bottle. Contains pancuronium."
	icon_state = "bottle16"
	list_reagents = list("pancuronium" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/sodium_thiopental
	name = "sodium thiopental bottle"
	desc = "A small bottle. Contains sodium thiopental."
	icon_state = "bottle16"
	list_reagents = list("sodium_thiopental" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/coniine
	name = "coniine bottle"
	desc = "A small bottle. Contains coniine."
	icon_state = "bottle16"
	list_reagents = list("coniine" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/curare
	name = "curare bottle"
	desc = "A small bottle. Contains curare."
	icon_state = "bottle16"
	list_reagents = list("curare" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/amanitin
	name = "amanitin bottle"
	desc = "A small bottle. Contains amanitin."
	icon_state = "bottle16"
	list_reagents = list("amanitin" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/histamine
	name = "histamine bottle"
	desc = "A small bottle. Contains Histamine."
	icon_state = "bottle16"
	list_reagents = list("histamine" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/diphenhydramine
	name = "antihistamine bottle"
	desc = "A small bottle of diphenhydramine."
	icon_state = "bottle20"
	list_reagents = list("diphenhydramine" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/potass_iodide
	name = "anti-radiation bottle"
	desc = "A small bottle of potassium iodide."
	icon_state = "bottle11"
	list_reagents = list("potass_iodide" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/salglu_solution
	name = "saline-glucose solution bottle"
	desc = "A small bottle of saline-glucose solution."
	icon_state = "bottle1"
	list_reagents = list("salglu_solution" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/atropine
	name = "atropine bottle"
	desc = "A small bottle of atropine."
	icon_state = "bottle12"
	list_reagents = list("atropine" = 30)

/obj/item/weapon/reagent_containers/glass/bottle/flu_virion
	name = "Flu virion culture bottle"
	desc = "A small bottle. Contains H13N1 flu virion culture in synthblood medium."
	icon_state = "bottle3"
	spawned_disease = /datum/disease/advance/flu

/obj/item/weapon/reagent_containers/glass/bottle/epiglottis_virion
	name = "Epiglottis virion culture bottle"
	desc = "A small bottle. Contains Epiglottis virion culture in synthblood medium."
	icon_state = "bottle3"
	spawned_disease = /datum/disease/advance/voice_change

/obj/item/weapon/reagent_containers/glass/bottle/liver_enhance_virion
	name = "Liver enhancement virion culture bottle"
	desc = "A small bottle. Contains liver enhancement virion culture in synthblood medium."
	icon_state = "bottle3"
	spawned_disease = /datum/disease/advance/heal

/obj/item/weapon/reagent_containers/glass/bottle/hullucigen_virion
	name = "Hullucigen virion culture bottle"
	desc = "A small bottle. Contains hullucigen virion culture in synthblood medium."
	icon_state = "bottle3"
	spawned_disease = /datum/disease/advance/hullucigen

/obj/item/weapon/reagent_containers/glass/bottle/pierrot_throat
	name = "Pierrot's Throat culture bottle"
	desc = "A small bottle. Contains H0NI<42 virion culture in synthblood medium."
	icon_state = "bottle3"
	spawned_disease = /datum/disease/pierrot_throat

/obj/item/weapon/reagent_containers/glass/bottle/cold
	name = "Rhinovirus culture bottle"
	desc = "A small bottle. Contains XY-rhinovirus culture in synthblood medium."
	icon_state = "bottle3"
	spawned_disease = /datum/disease/advance/cold

/obj/item/weapon/reagent_containers/glass/bottle/retrovirus
	name = "Retrovirus culture bottle"
	desc = "A small bottle. Contains a retrovirus culture in a synthblood medium."
	icon_state = "bottle3"
	spawned_disease = /datum/disease/dna_retrovirus

/obj/item/weapon/reagent_containers/glass/bottle/gbs
	name = "GBS culture bottle"
	desc = "A small bottle. Contains Gravitokinetic Bipotential SADS+ culture in synthblood medium."//Or simply - General BullShit
	icon_state = "bottle3"
	amount_per_transfer_from_this = 5
	spawned_disease = /datum/disease/gbs

/obj/item/weapon/reagent_containers/glass/bottle/fake_gbs
	name = "GBS culture bottle"
	desc = "A small bottle. Contains Gravitokinetic Bipotential SADS- culture in synthblood medium."//Or simply - General BullShit
	icon_state = "bottle3"
	spawned_disease = /datum/disease/fake_gbs

/obj/item/weapon/reagent_containers/glass/bottle/brainrot
	name = "Brainrot culture bottle"
	desc = "A small bottle. Contains Cryptococcus Cosmosis culture in synthblood medium."
	icon_state = "bottle3"
	spawned_disease = /datum/disease/brainrot

/obj/item/weapon/reagent_containers/glass/bottle/magnitis
	name = "Magnitis culture bottle"
	desc = "A small bottle. Contains a small dosage of Fukkos Miracos."
	icon_state = "bottle3"
	spawned_disease = /datum/disease/magnitis

/obj/item/weapon/reagent_containers/glass/bottle/wizarditis
	name = "Wizarditis culture bottle"
	desc = "A small bottle. Contains a sample of Rincewindus Vulgaris."
	icon_state = "bottle3"
	spawned_disease = /datum/disease/wizarditis

/obj/item/weapon/reagent_containers/glass/bottle/anxiety
	name = "Severe Anxiety culture bottle"
	desc = "A small bottle. Contains a sample of Lepidopticides."
	icon_state = "bottle3"
	spawned_disease = /datum/disease/anxiety

/obj/item/weapon/reagent_containers/glass/bottle/beesease
	name = "Beesease culture bottle"
	desc = "A small bottle. Contains a sample of invasive Apidae."
	icon_state = "bottle3"
	spawned_disease = /datum/disease/beesease


code:
/obj/item/weapon/reagent_containers/dropper
	name = "dropper"
	desc = "A dropper. Holds up to 5 units."
	icon = 'icons/obj/chemical.dmi'
	icon_state = "dropper0"
	amount_per_transfer_from_this = 5
	possible_transfer_amounts = list(1, 2, 3, 4, 5)
	volume = 5

/obj/item/weapon/reagent_containers/dropper/afterattack(obj/target, mob/user , proximity)
	if(!proximity) return
	if(!target.reagents) return

	if(reagents.total_volume > 0)
		if(target.reagents.total_volume >= target.reagents.maximum_volume)
			user << "[target] is full."
			return

		if(!target.is_open_container() && !ismob(target) && !istype(target,/obj/item/weapon/reagent_containers/food) && !istype(target, /obj/item/clothing/mask/cigarette)) //You can inject humans and food but you cant remove the shit.
			user << "You cannot directly fill [target]."
			return

		var/trans = 0

		if(ismob(target))
			if(istype(target , /mob/living/carbon/human))
				var/mob/living/carbon/human/victim = target

				var/obj/item/safe_thing = null
				if(victim.wear_mask)
					if(victim.wear_mask.flags & MASKCOVERSEYES)
						safe_thing = victim.wear_mask
				if(victim.head)
					if(victim.head.flags & MASKCOVERSEYES)
						safe_thing = victim.head
				if(victim.glasses)
					if(!safe_thing)
						safe_thing = victim.glasses

				if(safe_thing)
					if(!safe_thing.reagents)
						safe_thing.create_reagents(100)
					trans = reagents.trans_to(safe_thing, amount_per_transfer_from_this)

					target.visible_message("[user] tries to squirt something into [target]'s eyes, but fails!", \
											"[user] tries to squirt something into [target]'s eyes, but fails!")
					spawn(5)
						reagents.reaction(safe_thing, TOUCH)

					user << "You transfer [trans] unit\s of the solution."
					update_icon()
					return

			target.visible_message("[user] squirts something into [target]'s eyes!", \
									"[user] squirts something into [target]'s eyes!")
			reagents.reaction(target, TOUCH)
			var/mob/M = target
			var/R
			if(reagents)
				for(var/datum/reagent/A in src.reagents.reagent_list)
					R += A.id + " ("
					R += num2text(A.volume) + "),"
			add_logs(user, M, "squirted", object="[R]")

		trans = src.reagents.trans_to(target, amount_per_transfer_from_this)
		user << "You transfer [trans] unit\s of the solution."
		update_icon()

	else

		if(!target.is_open_container() && !istype(target,/obj/structure/reagent_dispensers))
			user << "You cannot directly remove reagents from [target]."
			return

		if(!target.reagents.total_volume)
			user << "[target] is empty."
			return

		var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this)

		user << "You fill [src] with [trans] unit\s of the solution."

		update_icon()

/obj/item/weapon/reagent_containers/dropper/update_icon()
	if(reagents.total_volume<=0)
		icon_state = "dropper0"
	else
		icon_state = "dropper1"


code:
/obj/item/weapon/reagent_containers/glass
	name = "glass"
	amount_per_transfer_from_this = 10
	possible_transfer_amounts = list(5, 10, 15, 25, 30, 50)
	volume = 50
	flags = OPENCONTAINER

	can_be_placed_into = list(
		/obj/machinery/chem_master/,
		/obj/machinery/chem_dispenser/,
		/obj/machinery/chem_heater/,
		/obj/machinery/reagentgrinder,
		/obj/machinery/biogenerator,
		/obj/machinery/r_n_d/destructive_analyzer,
		/obj/machinery/r_n_d/experimentor,
		/obj/machinery/autolathe,
		/obj/structure/table,
		/obj/structure/rack,
		/obj/structure/closet,
		/obj/structure/sink,
		/obj/item/weapon/storage,
		/obj/machinery/atmospherics/unary/cryo_cell,
		/obj/item/weapon/grenade/chem_grenade,
		/obj/machinery/bot/medbot,
		/obj/machinery/computer/pandemic,
		/obj/structure/safe,
		/obj/machinery/disposal,
		/obj/machinery/hydroponics,
		/obj/machinery/biogenerator,
		/mob/living/simple_animal/cow,
		/mob/living/simple_animal/hostile/retaliate/goat
	)

/obj/item/weapon/reagent_containers/glass/afterattack(obj/target, mob/user, proximity)
	if((!proximity) || !check_allowed_items(target)) return

	if(ismob(target) && target.reagents && reagents.total_volume)
		var/mob/M = target
		var/R
		target.visible_message("[user] has splashed [target] with something!", \
						"[user] has splashed [target] with something!")
		if(reagents)
			for(var/datum/reagent/A in reagents.reagent_list)
				R += A.id + " ("
				R += num2text(A.volume) + "),"
		add_logs(user, M, "splashed", object="[R]")
		reagents.reaction(target, TOUCH)
		reagents.clear_reagents()
		return

	else if(istype(target, /obj/structure/reagent_dispensers)) //A dispenser. Transfer FROM it TO us.

		if(target.reagents && !target.reagents.total_volume)
			user << "[target] is empty and can't be refilled!"
			return

		if(reagents.total_volume >= reagents.maximum_volume)
			user << "[src] is full."
			return

		var/trans = target.reagents.trans_to(src, target:amount_per_transfer_from_this)
		user << "You fill [src] with [trans] unit\s of the contents of [target]."

	else if(target.is_open_container() && target.reagents) //Something like a glass. Player probably wants to transfer TO it.
		if(!reagents.total_volume)
			user << "[src] is empty!"
			return

		if(target.reagents.total_volume >= target.reagents.maximum_volume)
			user << "[target] is full."
			return

		if(istype(target, /obj/item/weapon/reagent_containers))
			var/obj/item/weapon/reagent_containers/RC = target
			for(var/bad_reg in RC.banned_reagents)
				if(reagents.has_reagent(bad_reg, 1)) //Message is a bit "Game-y" but I can't think up a better one.
					user << "A chemical in [src] is far too dangerous to transfer to [RC]!"
					return

		var/trans = reagents.trans_to(target, amount_per_transfer_from_this)
		user << "You transfer [trans] unit\s of the solution to [target]."

	//Safety for dumping stuff into a ninja suit. It handles everything through attackby() and this is unnecessary.	//gee thanks noize
	//NINJACODE
	else if(istype(target, /obj/item/clothing/suit/space/space_ninja))
		return

	else if(istype(target, /obj/effect/decal/cleanable)) //stops splashing while scooping up fluids
		return

	else if(reagents.total_volume)
		user << "You splash the solution onto [target]."
		reagents.reaction(target, TOUCH)
		reagents.clear_reagents()

/obj/item/weapon/reagent_containers/glass/attackby(var/obj/item/I, mob/user as mob, params)
	if(istype(I, /obj/item/clothing/mask/cigarette)) //ciggies are weird
		return
	var/hotness = is_hot(I)
	if(hotness)
		var/added_heat = (hotness / 100) //ishot returns a temperature
		if(reagents)
			if(reagents.chem_temp < hotness) //can't be heated to be hotter than the source
				reagents.chem_temp += added_heat
				user << "You heat [src] with [I]."
				reagents.handle_reactions()
			else
				user << "[src] is already hotter than [I]!"

	if(istype(I,/obj/item/weapon/reagent_containers/food/snacks/egg)) //breaking eggs
		var/obj/item/weapon/reagent_containers/food/snacks/egg/E = I
		if(reagents)
			if(reagents.total_volume >= reagents.maximum_volume)
				user << "[src] is full."
			else
				user << "You break [E] in [src]."
				reagents.add_reagent("eggyolk", 5)
				qdel(E)
			return
	..()

/obj/item/weapon/reagent_containers/glass/beaker
	name = "beaker"
	desc = "A beaker. It can hold up to 50 units."
	icon = 'icons/obj/chemical.dmi'
	icon_state = "beaker"
	item_state = "beaker"
	m_amt = 0
	g_amt = 500

/obj/item/weapon/reagent_containers/glass/beaker/New()
	..()
	update_icon()

/obj/item/weapon/reagent_containers/glass/beaker/on_reagent_change()
	update_icon()

/obj/item/weapon/reagent_containers/glass/beaker/pickup(mob/user)
	..()
	update_icon()

/obj/item/weapon/reagent_containers/glass/beaker/dropped(mob/user)
	..()
	update_icon()

/obj/item/weapon/reagent_containers/glass/beaker/attack_hand()
	..()
	update_icon()

/obj/item/weapon/reagent_containers/glass/beaker/update_icon()
	overlays.Cut()

	if(reagents.total_volume)
		var/image/filling = image('icons/obj/reagentfillings.dmi', src, "[icon_state]10")

		var/percent = round((reagents.total_volume / volume) * 100)
		switch(percent)
			if(0 to 9)		filling.icon_state = "[icon_state]-10"
			if(10 to 24) 	filling.icon_state = "[icon_state]10"
			if(25 to 49)	filling.icon_state = "[icon_state]25"
			if(50 to 74)	filling.icon_state = "[icon_state]50"
			if(75 to 79)	filling.icon_state = "[icon_state]75"
			if(80 to 90)	filling.icon_state = "[icon_state]80"
			if(91 to INFINITY)	filling.icon_state = "[icon_state]100"

		filling.color = mix_color_from_reagents(reagents.reagent_list)
		overlays += filling

/obj/item/weapon/reagent_containers/glass/beaker/large
	name = "large beaker"
	desc = "A large beaker. Can hold up to 100 units."
	icon_state = "beakerlarge"
	g_amt = 2500
	volume = 100
	amount_per_transfer_from_this = 10
	possible_transfer_amounts = list(5,10,15,25,30,50,100)
	flags = OPENCONTAINER

/obj/item/weapon/reagent_containers/glass/beaker/noreact
	name = "cryostasis beaker"
	desc = "A cryostasis beaker that allows for chemical storage without reactions. Can hold up to 50 units."
	icon_state = "beakernoreact"
	g_amt = 500
	volume = 50
	amount_per_transfer_from_this = 10
	flags = OPENCONTAINER | NOREACT

/obj/item/weapon/reagent_containers/glass/beaker/bluespace
	name = "bluespace beaker"
	desc = "A bluespace beaker, powered by experimental bluespace technology and Element Cuban combined with the Compound Pete. Can hold up to 300 units."
	icon_state = "beakerbluespace"
	g_amt = 5000
	volume = 300
	amount_per_transfer_from_this = 10
	possible_transfer_amounts = list(5,10,15,25,30,50,100,300)
	flags = OPENCONTAINER

/obj/item/weapon/reagent_containers/glass/beaker/cryoxadone
	list_reagents = list("cryoxadone" = 30)

/obj/item/weapon/reagent_containers/glass/beaker/sulphuric
	list_reagents = list("sacid" = 50)

/obj/item/weapon/reagent_containers/glass/beaker/slime
	list_reagents = list("slimejelly" = 50)

/obj/item/weapon/reagent_containers/glass/beaker/large/bicaridine
	name = "bicaridine reserve tank"
	list_reagents = list("bicaridine" = 50)

/obj/item/weapon/reagent_containers/glass/beaker/large/kelotane
	name = "kelotane reserve tank"
	list_reagents = list("kelotane" = 50)

/obj/item/weapon/reagent_containers/glass/beaker/large/antitoxin
	name = "antitoxin reserve tank"
	list_reagents = list("antitoxin" = 50)

/obj/item/weapon/reagent_containers/glass/beaker/large/inaprovaline
	name = "inaprovaline reserve tank"
	list_reagents = list("inaprovaline" = 50)

/obj/item/weapon/reagent_containers/glass/bucket
	name = "bucket"
	desc = "It's a bucket."
	icon = 'icons/obj/janitor.dmi'
	icon_state = "bucket"
	item_state = "bucket"
	m_amt = 200
	g_amt = 0
	w_class = 3.0
	amount_per_transfer_from_this = 20
	possible_transfer_amounts = list(10,20,30,50,70)
	volume = 70
	flags = OPENCONTAINER

/obj/item/weapon/reagent_containers/glass/bucket/attackby(var/obj/D, mob/user as mob, params)
	if(isprox(D))
		user << "You add [D] to [src]."
		qdel(D)
		user.put_in_hands(new /obj/item/weapon/bucket_sensor)
		user.unEquip(src)
		qdel(src)
	else
		..()


code:
/obj/item/weapon/reagent_containers/hypospray
	name = "hypospray"
	desc = "The DeForest Medical Corporation hypospray is a sterile, air-needle autoinjector for rapid administration of drugs to patients."
	icon = 'icons/obj/syringe.dmi'
	item_state = "hypo"
	icon_state = "hypo"
	amount_per_transfer_from_this = 5
	volume = 30
	possible_transfer_amounts = null
	flags = OPENCONTAINER
	slot_flags = SLOT_BELT
	var/ignore_flags = 0

/obj/item/weapon/reagent_containers/hypospray/attack_paw(mob/user)
	return attack_hand(user)

/obj/item/weapon/reagent_containers/hypospray/attack(mob/living/M, mob/user)
	if(!reagents.total_volume)
		user << "[src] is empty."
		return
	if(!istype(M))
		return

	if(reagents.total_volume && (ignore_flags || M.can_inject(user, 1))) // Ignore flag should be checked first or there will be an error message.
		M << "You feel a tiny prick!"
		user << "You inject [M] with [src]."

		reagents.reaction(M, INGEST)
		if(M.reagents)
			var/list/injected = list()
			for(var/datum/reagent/R in reagents.reagent_list)
				injected += R.name

			var/trans = reagents.trans_to(M, amount_per_transfer_from_this)
			user << "[trans] unit\s injected.  [reagents.total_volume] unit\s remaining in [src]."

			var/contained = english_list(injected)

			add_logs(user, M, "injected", object="[src.name]", addition="([contained])")

/obj/item/weapon/reagent_containers/hypospray/CMO
	list_reagents = list("doctorsdelight" = 30)

/obj/item/weapon/reagent_containers/hypospray/combat
	name = "combat stimulant injector"
	desc = "A modified air-needle autoinjector, used by support operatives to quickly heal injuries in combat."
	amount_per_transfer_from_this = 10
	icon_state = "combat_hypo"
	volume = 60
	ignore_flags = 1 // So they can heal their comrades.
	list_reagents = list("inaprovaline" = 15, "doctorsdelight" = 15)

/obj/item/weapon/reagent_containers/hypospray/combat/nanites
	desc = "A modified air-needle autoinjector for use in combat situations. Prefilled with expensive medical nanites for rapid healing."
	volume = 100
	list_reagents = list("nanites" = 80, "synaptizine" = 20)

//MediPens

/obj/item/weapon/reagent_containers/hypospray/medipen
	name = "inaprovaline medipen"
	desc = "A rapid and safe way to stabilize patients in critical condition for personnel without advanced medical knowledge."
	icon_state = "medipen"
	item_state = "medipen"
	amount_per_transfer_from_this = 10
	volume = 10
	ignore_flags = 1 //so you can medipen through hardsuits
	flags = null
	list_reagents = list("inaprovaline" = 10)

/obj/item/weapon/reagent_containers/hypospray/medipen/New()
	..()
	update_icon()
	return

/obj/item/weapon/reagent_containers/hypospray/medipen/attack(mob/M as mob, mob/user as mob)
	..()
	update_icon()
	return

/obj/item/weapon/reagent_containers/hypospray/medipen/update_icon()
	if(reagents.total_volume > 0)
		icon_state = "[initial(icon_state)]1"
	else
		icon_state = "[initial(icon_state)]0"

/obj/item/weapon/reagent_containers/hypospray/medipen/examine()
	..()
	if(reagents && reagents.reagent_list.len)
		usr << "It is currently loaded."
	else
		usr << "It is spent."

/obj/item/weapon/reagent_containers/hypospray/medipen/stimpack //goliath kiting
	name = "stimpack medipen"
	desc = "A rapid way to stimulate your body's adrenaline, allowing for freer movement in restrictive armor as well as a ."
	icon_state = "stimpen"
	volume = 20
	amount_per_transfer_from_this = 20
	list_reagents = list("ephedrine" = 10, "coffee" = 10)

/obj/item/weapon/reagent_containers/hypospray/medipen/morphine
	name = "morphine medipen"
	desc = "A rapid way to get you out of a tight situation and fast! You'll feel rather drowsy, though."
	list_reagents = list("morphine" = 10)


code:
/obj/item/weapon/reagent_containers/pill/patch
	name = "chemical patch"
	desc = "A chemical patch for touch based applications."
	icon = 'icons/obj/chemical.dmi'
	icon_state = "bandaid"
	item_state = "bandaid"
	possible_transfer_amounts = null
	volume = 25
	apply_type = TOUCH
	apply_method = "apply"

/obj/item/weapon/reagent_containers/pill/patch/New()
	..()
	icon_state = "bandaid" // thanks inheritance

/obj/item/weapon/reagent_containers/pill/patch/afterattack(obj/target, mob/user , proximity)
	return // thanks inheritance again

/obj/item/weapon/reagent_containers/pill/patch/canconsume(mob/eater, mob/user)
	if(!eater.SpeciesCanConsume())
		return 0
	return 1 // Masks were stopping people from "eating" patches. Thanks, inheritance.

/obj/item/weapon/reagent_containers/pill/patch/bicaridine
	name = "brute patch"
	desc = "Helps with brute injuries."
	volume = 50
	list_reagents = list("styptic_powder" = 50)

/obj/item/weapon/reagent_containers/pill/patch/kelotane
	name = "burn patch"
	desc = "Helps with burn injuries."
	volume = 50
	list_reagents = list("silver_sulfadiazine" = 50)


code:
/obj/item/weapon/reagent_containers/pill
	name = "pill"
	desc = "A tablet or capsule."
	icon = 'icons/obj/chemical.dmi'
	icon_state = "pill"
	item_state = "pill"
	possible_transfer_amounts = null
	volume = 50
	var/apply_type = INGEST
	var/apply_method = "swallow"
	var/roundstart = 0

/obj/item/weapon/reagent_containers/pill/New()
	..()
	if(!icon_state)
		icon_state = "pill[rand(1,20)]"
	if(reagents.total_volume && roundstart)
		name += " ([reagents.total_volume]u)"

/obj/item/weapon/reagent_containers/pill/attack_self(mob/user)
	return

/obj/item/weapon/reagent_containers/pill/attack(mob/M, mob/user, def_zone)
	if(!canconsume(M, user))
		return 0

	if(M == user)
		M << "You [apply_method] [src]."

	else
		M.visible_message("[user] attempts to force [M] to [apply_method] [src].", \
							"[user] attempts to force [M] to [apply_method] [src].")

		if(!do_mob(user, M)) return

		M.visible_message("[user] forces [M] to [apply_method] [src].", \
							"[user] forces [M] to [apply_method] [src].")

	user.unEquip(src) //icon update
	add_logs(user, M, "fed", object="[reagentlist(src)]")
	loc = M //Put the pill inside the mob. This fixes the issue where the pill appears to drop to the ground after someone eats it.

	if(reagents.total_volume)
		reagents.reaction(M, apply_type)
		spawn(5)
			reagents.trans_to(M, reagents.total_volume)
			qdel(src)
			return 1
	else
		qdel(src)
		return 1
	return 0

/obj/item/weapon/reagent_containers/pill/afterattack(obj/target, mob/user , proximity)
	if(!proximity) return
	if(target.is_open_container() != 0 && target.reagents)
		if(!target.reagents.total_volume)
			user << "[target] is empty. There's nothing to dissolve [src] in."
			return
		user << "You dissolve [src] in [target]."
		for(var/mob/O in viewers(2, user))	//viewers is necessary here because of the small radius
			O << "[user] slips something into [target]."
		reagents.trans_to(target, reagents.total_volume)
		spawn(5)
			qdel(src)

/obj/item/weapon/reagent_containers/pill/tox
	name = "toxins pill"
	desc = "Highly toxic."
	icon_state = "pill5"
	list_reagents = list("toxin" = 50)
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/cyanide
	name = "cyanide pill"
	desc = "Don't swallow this."
	icon_state = "pill5"
	list_reagents = list("cyanide" = 50)
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/adminordrazine
	name = "adminordrazine pill"
	desc = "It's magic. We don't have to explain it."
	icon_state = "pill16"
	list_reagents = list("adminordrazine" = 50)
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/morphine
	name = "morphine pill"
	desc = "Commonly used to treat insomnia."
	icon_state = "pill8"
	list_reagents = list("morphine" = 30)
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/stoxin
	name = "morphine pill"
	desc = "Commonly used to treat insomnia."
	icon_state = "pill8"
	list_reagents = list("stoxin" = 30)
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/stimulant
	name = "stimulant pill"
	desc = "Often taken by overworked employees, athletes, and the inebriated. You'll snap to attention immediately!"
	icon_state = "pill19"
	list_reagents = list("ephedrine" = 10, "ethylredoxrazine" = 10, "coffee" = 30) //>goofchem
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/dexalin
	name = "dexalin pill"
	desc = "Used to treat oxygen deprivation."
	icon_state = "pill18"
	list_reagents = list("dexalin" = 30)
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/antitoxin
	name = "antitoxin pill"
	desc = "Neutralizes many common toxins."
	icon_state = "pill17"
	list_reagents = list("anti_toxin" = 50)
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/inaprovaline
	name = "inaprovaline pill"
	desc = "Used to stabilize patients."
	icon_state = "pill5"
	list_reagents = list("inaprovaline" = 15)
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/alkysine
	name = "alkysine pill"
	desc = "Used to treat brain damage."
	icon_state = "pill17"
	list_reagents = list("alkysine" = 50)
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/ryetalyn
	name = "ryetalyn pill"
	desc = "Used to treat genetic damage."
	icon_state = "pill20"
	list_reagents = list("ryetalyn" = 50)
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/kelotane
	name = "kelotane pill"
	desc = "Used to treat burns."
	icon_state = "pill5"
	list_reagents = list("kelotane" = 30)
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/dermaline
	name = "dermaline pill"
	desc = "Used to treat severe burns."
	icon_state = "pill5"
	list_reagents = list("kelotane" = 25)
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/bicaridine
	name = "dermaline pill"
	desc = "Used to treat physical injuries."
	icon_state = "pill5"
	list_reagents = list("bicaridine" = 30)
	roundstart = 1
/obj/item/weapon/reagent_containers/pill/insulin
	name = "insulin pill"
	desc = "Handles hyperglycaemic coma."
	icon_state = "pill5"
	list_reagents = list("insulin" = 50)
	roundstart = 1


code:
/obj/item/weapon/reagent_containers/spray
	name = "spray bottle"
	desc = "A spray bottle, with an unscrewable top."
	icon = 'icons/obj/janitor.dmi'
	icon_state = "cleaner"
	item_state = "cleaner"
	flags = OPENCONTAINER | NOBLUDGEON
	slot_flags = SLOT_BELT
	throwforce = 0
	w_class = 2.0
	throw_speed = 3
	throw_range = 7
	var/spray_maxrange = 3 //what the sprayer will set spray_currentrange to in the attack_self.
	var/spray_currentrange = 3 //the range of tiles the sprayer will reach when in fixed mode.
	amount_per_transfer_from_this = 5
	volume = 250
	possible_transfer_amounts = null
	banned_reagents = list()

/obj/item/weapon/reagent_containers/spray/afterattack(atom/A as mob|obj, mob/user as mob)
	if(istype(A, /obj/item/weapon/storage) || istype(A, /obj/structure/table) || istype(A, /obj/structure/rack) || istype(A, /obj/structure/closet) \
	|| istype(A, /obj/item/weapon/reagent_containers) || istype(A, /obj/structure/sink) || istype(A, /obj/structure/janitorialcart) || istype(A, /obj/machinery/hydroponics))
		return

	if(istype(A, /obj/effect/proc_holder/spell))
		return

	if(istype(A, /obj/structure/reagent_dispensers) && get_dist(src,A) <= 1) //this block copypasted from reagent_containers/glass, for lack of a better solution
		if(!A.reagents.total_volume && A.reagents)
			user << "\The [A] is empty."
			return

		if(reagents.total_volume >= reagents.maximum_volume)
			user << "\The [src] is full."
			return

		var/trans = A.reagents.trans_to(src, A:amount_per_transfer_from_this)
		user << "You fill \the [src] with [trans] units of the contents of \the [A]."
		return

	if(reagents.total_volume < amount_per_transfer_from_this)
		user << "\The [src] is empty!"
		return

	spray(A)

	playsound(src.loc, 'sound/effects/spray2.ogg', 50, 1, -6)
	user.changeNext_move(CLICK_CD_RANGE*2)
	user.newtonian_move(get_dir(A, user))

	if(reagents.has_reagent("sacid"))
		message_admins("[key_name_admin(user)] fired sulphuric acid from \a [src].")
		log_game("[key_name(user)] fired sulphuric acid from \a [src].")
	if(reagents.has_reagent("pacid"))
		message_admins("[key_name_admin(user)] fired polytrinic acid from \a [src].")
		log_game("[key_name(user)] fired polytrinic acid from \a [src].")
	if(reagents.has_reagent("lube"))
		message_admins("[key_name_admin(user)] fired Space lube from \a [src].")
		log_game("[key_name(user)] fired Space lube from \a [src].")
	return

/obj/item/weapon/reagent_containers/spray/proc/spray(var/atom/A)
	var/range = max(min(spray_currentrange, get_dist(src, A)), 1)
	var/obj/effect/decal/chempuff/D = new /obj/effect/decal/chempuff(get_turf(src))
	D.create_reagents(amount_per_transfer_from_this)
	reagents.trans_to(D, amount_per_transfer_from_this, 1/range)
	D.color = mix_color_from_reagents(D.reagents.reagent_list)
	var/puff_reagent_left = range //how many turf, mob or dense objet we can react with before we consider the chem puff consumed
	var/wait_step = max(round(9/range),2)
	spawn(0)
		for(var/i=0, i<range, i++)
			step_towards(D,A)
			sleep(wait_step)

			for(var/atom/T in get_turf(D))
				if(T == D || T.invisibility) //we ignore the puff itself and stuff below the floor
					continue
				if(puff_reagent_left <= 0)
					break
				D.reagents.reaction(T)
				if(ismob(T)) //mobs are obstacles that consume part of the puff, shortening its range.
					puff_reagent_left -= 1

			if(puff_reagent_left > 0)
				D.reagents.reaction(get_turf(D))
				puff_reagent_left -= 1

			if(puff_reagent_left <= 0) // we used all the puff so we delete it.
				qdel(D)
				return
		qdel(D)

/obj/item/weapon/reagent_containers/spray/attack_self(var/mob/user)

	amount_per_transfer_from_this = (amount_per_transfer_from_this == 10 ? 5 : 10)
	spray_currentrange = (spray_currentrange == 1 ? spray_maxrange : 1)
	user << "You [amount_per_transfer_from_this == 10 ? "remove" : "fix"] the nozzle. You'll now use [amount_per_transfer_from_this] units per spray."

/obj/item/weapon/reagent_containers/spray/verb/empty()

	set name = "Empty Spray Bottle"
	set category = "Object"
	set src in usr
	if(usr.stat || !usr.canmove || usr.restrained())
		return
	if (alert(usr, "Are you sure you want to empty that?", "Empty Bottle:", "Yes", "No") != "Yes")
		return
	if(isturf(usr.loc) && src.loc == usr)
		usr << "You empty \the [src] onto the floor."
		reagents.reaction(usr.loc)
		src.reagents.clear_reagents()

//space cleaner
/obj/item/weapon/reagent_containers/spray/cleaner
	name = "space cleaner"
	desc = "BLAM!-brand non-foaming space cleaner!"
	list_reagents = list("cleaner" = 250)

//pepperspray
/obj/item/weapon/reagent_containers/spray/pepper
	name = "pepperspray"
	desc = "Manufactured by UhangInc, used to blind and down an opponent quickly."
	icon = 'icons/obj/weapons.dmi'
	icon_state = "pepperspray"
	item_state = "pepperspray"
	volume = 40
	spray_maxrange = 4
	amount_per_transfer_from_this = 5
	list_reagents = list("condensedcapsaicin" = 40)

//water flower
/obj/item/weapon/reagent_containers/spray/waterflower
	name = "water flower"
	desc = "A seemingly innocent sunflower...with a twist."
	icon = 'icons/obj/hydroponics/harvest.dmi'
	icon_state = "sunflower"
	item_state = "sunflower"
	amount_per_transfer_from_this = 1
	volume = 10
	list_reagents = list("water" = 10)

/obj/item/weapon/reagent_containers/spray/waterflower/attack_self(var/mob/user) //Don't allow changing how much the flower sprays
	return

//chemsprayer
/obj/item/weapon/reagent_containers/spray/chemsprayer
	name = "chem sprayer"
	desc = "A utility used to spray large amounts of reagents in a given area."
	icon = 'icons/obj/guns/projectile.dmi'
	icon_state = "chemsprayer"
	item_state = "chemsprayer"
	throwforce = 0
	w_class = 3.0
	spray_maxrange = 7
	spray_currentrange = 7
	amount_per_transfer_from_this = 10
	volume = 600
	origin_tech = "combat=3;materials=3;engineering=3"
	banned_reagents = list()//the safeties are off, spray and pay!

/obj/item/weapon/reagent_containers/spray/chemsprayer/spray(var/atom/A)
	var/direction = get_dir(src, A)
	var/turf/T = get_turf(A)
	var/turf/T1 = get_step(T,turn(direction, 90))
	var/turf/T2 = get_step(T,turn(direction, -90))
	var/list/the_targets = list(T,T1,T2)

	for(var/i=1, i<=3, i++) // intialize sprays
		if(reagents.total_volume < 1)
			return
		..(the_targets[i])

/obj/item/weapon/reagent_containers/spray/chemsprayer/attack_self(var/mob/user)

	amount_per_transfer_from_this = (amount_per_transfer_from_this == 10 ? 5 : 10)
	user << "You adjust the output switch. You'll now use [amount_per_transfer_from_this] units per spray."

/obj/item/weapon/reagent_containers/spray/chemsprayer/bioterror
	list_reagents = list("spore" = 150, "cryptobiolin" = 150, "mutagen" = 150, "chloralhydrate" = 150)

// Plant-B-Gone
/obj/item/weapon/reagent_containers/spray/plantbgone // -- Skie
	name = "Plant-B-Gone"
	desc = "Kills those pesky weeds!"
	icon = 'icons/obj/hydroponics/equipment.dmi'
	icon_state = "plantbgone"
	item_state = "plantbgone"
	volume = 100
	list_reagents = list("plantbgone" = 100)