diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
index d05f7f4d8ea..a8649eb5145 100644
--- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
+++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
@@ -436,24 +436,26 @@
switch(mode)
if("dispense")
var/free = target.reagents.maximum_volume - target.reagents.total_volume
- var/actual = min(amount, cell.charge / efficiency, free)
- target.reagents.add_reagent(current_reagent, actual)
- cell.charge -= actual / efficiency
+ var/actual = min(amount, round(cell.charge * efficiency), free)
if(actual)
- to_chat(user, "You dispense [amount] units of [current_reagent] into the [target].")
- update_icon()
+ target.reagents.add_reagent(current_reagent, actual)
+ cell.charge -= actual / efficiency
+ to_chat(user, "You dispense [actual] unit\s of [current_reagent] into [target].")
+ update_icon()
+ else if(free) // If actual is nil and there's still free space, it means we're out of juice
+ to_chat(user, "Insufficient energy to complete operation.")
if("remove")
if(!target.reagents.remove_reagent(current_reagent, amount))
- to_chat(user, "You remove [amount] units of [current_reagent] from the [target].")
+ to_chat(user, "You remove [amount] unit\s of [current_reagent] from [target].")
if("isolate")
if(!target.reagents.isolate_reagent(current_reagent))
- to_chat(user, "You remove all but the [current_reagent] from the [target].")
+ to_chat(user, "You remove all but [current_reagent] from [target].")
/obj/item/handheld_chem_dispenser/attack_self(mob/user)
if(cell)
ui_interact(user)
else
- to_chat(user, "The [src] lacks a power cell!")
+ to_chat(user, "[src] lacks a power cell!")
/obj/item/handheld_chem_dispenser/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.inventory_state)
@@ -493,7 +495,7 @@
. = TRUE
switch(action)
if("amount")
- amount = clamp(round(text2num(params["amount"])), 0, 50) // round to nearest 1 and clamp to 0 - 50
+ amount = clamp(round(text2num(params["amount"])), 1, 50) // round to nearest 1 and clamp to 1 - 50
if("dispense")
if(params["reagent"] in dispensable_reagents)
current_reagent = params["reagent"]