diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
index 6a01fd76ffc..b7301e23487 100644
--- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
+++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
@@ -19,7 +19,7 @@
var/working_state = "dispenser_working"
var/nopower_state = "dispenser_nopower"
var/has_panel_overlay = TRUE
- var/macrotier = 1
+ var/macroresolution = 1
var/obj/item/reagent_containers/beaker = null
var/list/dispensable_reagents = list(
"hydrogen",
@@ -84,16 +84,8 @@
if(panel_open)
to_chat(user, "[src]'s maintenance hatch is open!")
if(in_range(user, src) || isobserver(user))
- to_chat(user, "The status display reads:
Recharging [recharge_amount] power units per interval.
Power efficiency increased by [(powerefficiency*1000)-100]%.")
- switch(macrotier)
- if(1)
- to_chat(user, "Macro granularity at 5u.")
- if(2)
- to_chat(user, "Macro granularity at 3u.")
- if(3)
- to_chat(user, "Macro granularity at 2u.")
- if(4)
- to_chat(user, "Macro granularity at 1u.")
+ to_chat(user, "The status display reads:
Recharging [recharge_amount] power units per interval.
Power efficiency increased by [round((powerefficiency*1000)-100, 1)]%.
Macro granularity at [macroresolution]u.")
+
/obj/machinery/chem_dispenser/process()
if (recharge_counter >= 4)
if(!is_operational())
@@ -254,14 +246,14 @@
return
var/recipe_to_use = params["recipe"]
var/list/chemicals_to_dispense = process_recipe_list(recipe_to_use)
- var/res = get_macro_resolution()
+ var/res = macroresolution
for(var/key in chemicals_to_dispense) // i suppose you could edit the list locally before passing it
var/list/keysplit = splittext(key," ")
var/r_id = keysplit[1]
if(beaker && dispensable_reagents.Find(r_id)) // but since we verify we have the reagent, it'll be fine
var/datum/reagents/R = beaker.reagents
var/free = R.maximum_volume - R.total_volume
- var/actual = min(round(chemicals_to_dispense[key], res), (cell.charge * powerefficiency)*10, free)
+ var/actual = min(max(chemicals_to_dispense[key], res), (cell.charge * powerefficiency)*10, free)
if(actual)
if(!cell.use(actual / powerefficiency))
say("Not enough energy to complete operation!")
@@ -285,7 +277,7 @@
var/list/first_process = splittext(recipe, ";")
if(!LAZYLEN(first_process))
return
- var/res = get_macro_resolution()
+ var/res = macroresolution
var/resmismatch = FALSE
for(var/reagents in first_process)
var/list/reagent = splittext(reagents, "=")
@@ -352,10 +344,10 @@
work_animation()
visible_message("[src] malfunctions, spraying chemicals everywhere!")
-
/obj/machinery/chem_dispenser/RefreshParts()
recharge_amount = initial(recharge_amount)
var/newpowereff = 0.0666666
+ macroresolution = 5
for(var/obj/item/stock_parts/cell/P in component_parts)
cell = P
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
@@ -363,14 +355,12 @@
for(var/obj/item/stock_parts/capacitor/C in component_parts)
recharge_amount *= C.rating
for(var/obj/item/stock_parts/manipulator/M in component_parts)
- if (M.rating > macrotier)
- macrotier = M.rating
+ if (M.rating > 1)
+ macroresolution -= M.rating //5 for t1, 3 for t2, 2 for t3, 1 for t4
if (M.rating > 3)
dispensable_reagents |= upgrade_reagents
powerefficiency = round(newpowereff, 0.01)
-
-
/obj/machinery/chem_dispenser/on_deconstruction()
cell = null
if(beaker)
@@ -378,31 +368,26 @@
beaker = null
return ..()
-/obj/machinery/chem_dispenser/proc/get_macro_resolution()
- . = 5
- if (macrotier > 1)
- . -= macrotier // 5 for tier1, 3 for 2, 2 for 3, 1 for 4.
-
/obj/machinery/chem_dispenser/proc/check_macro(macro)
- var/res = get_macro_resolution()
+ var/res = macroresolution
for (var/reagent in splittext(trim(macro), ";"))
if (!check_macro_part(reagent, res))
return FALSE
return TRUE
-/obj/machinery/chem_dispenser/proc/check_macro_part(var/part, var/res = get_macro_resolution())
+/obj/machinery/chem_dispenser/proc/check_macro_part(var/part, var/res = macroresolution)
var/detail = splittext(part, "=")
- if (round(text2num(detail[2]), res) != text2num(detail[2]))
+ if (text2num(detail[2]) < res)
return FALSE
return TRUE
-/obj/machinery/chem_dispenser/proc/process_recipe_list(var/fucking_hell)
+/obj/machinery/chem_dispenser/proc/process_recipe_list(var/recipe)
var/list/key_list = list()
var/list/final_list = list()
- var/list/first_process = splittext(fucking_hell, ";")
+ var/list/first_process = splittext(recipe, ";")
for(var/reagents in first_process)
- var/list/fuck = splittext(reagents, "=")
- final_list += list(avoid_assoc_duplicate_keys(fuck[1],key_list) = text2num(fuck[2]))
+ var/list/splitreagent = splittext(reagents, "=")
+ final_list += list(avoid_assoc_duplicate_keys(splitreagent[1],key_list) = text2num(splitreagent[2]))
return final_list
/obj/machinery/chem_dispenser/drinks/Initialize()