anchor.diff:  			if(beaker && dispensable_reagents.Find(reagent))
   				var/datum/reagents/R = beaker.reagents
   				var/free = R.maximum_volume - R.total_volume
  -				var/actual = min(amount, energy * 10, free)
  +				var/actual = min(amount, (cell.charge * powerefficiency)*10, free)
   
   				R.add_reagent(reagent, actual)
  -				energy = max(energy - actual / 10, 0)
  +				cell.use((actual / 10) / powerefficiency)
   				. = TRUE
   		if("remove")
   			var/amount = text2num(params["amount"])
  
positive.code: /obj/machinery/chem_dispenser/ui_data()
  	var/data = list()
  	data["amount"] = amount
  	data["energy"] = energy
  	data["maxEnergy"] = max_energy
  	data["isBeakerLoaded"] = beaker ? 1 : 0
  
  	var beakerContents[0]
  
negative.code: 		beaker.loc = src
  		to_chat(user, "<span class='notice'>You add \the [B] to the machine.</span>")
  
  		beaker_overlay = beaker_overlay ||  mutable_appearance(icon, "disp_beaker")
  		beaker_overlay.pixel_x = rand(-10, 5)//randomize beaker overlay position.
  		add_overlay(beaker_overlay)
  	else if(user.a_intent != INTENT_HARM && !istype(I, /obj/item/weapon/card/emag))
  		to_chat(user, "<span class='warning'>You can't load \the [I] into the machine!</span>")
  		return ..()
  	else
  		return ..()
  
  /obj/machinery/chem_dispenser/get_cell()
  	return cell
  
  /obj/machinery/chem_dispenser/emp_act(severity)
  	var/list/datum/reagents/R = list()
  	var/total = min(rand(7,15), Floor(cell.charge*powerefficiency))
  	var/datum/reagents/Q = new(total*10)
  	if(beaker && beaker.reagents)
  		R += beaker.reagents
  	for(var/i in 1 to total)
  		Q.add_reagent(pick(dispensable_reagents), 10)
  	R += Q
  	chem_splash(get_turf(src), 3, R)
  	if(beaker && beaker.reagents)
  		beaker.reagents.remove_all()
  	cell.use(total/powerefficiency)
  	cell.emp_act()
  	visible_message("<span class='danger'> The [src] malfunctions, spraying chemicals everywhere!</span>")
  	..()
  
  /obj/machinery/chem_dispenser/constructable
  	name = "portable chem dispenser"
  	icon = 'icons/obj/chemical.dmi'
  	icon_state = "minidispenser"
  	powerefficiency = 0.001
  	amount = 5
  	recharge_delay = 30
  	dispensable_reagents = list()
  