diff --git a/modular_chomp/code/modules/reagents/machinery/dispenser/chem_synthesizer_ch.dm b/modular_chomp/code/modules/reagents/machinery/dispenser/chem_synthesizer_ch.dm index bfbf4647c6..1c49303711 100644 --- a/modular_chomp/code/modules/reagents/machinery/dispenser/chem_synthesizer_ch.dm +++ b/modular_chomp/code/modules/reagents/machinery/dispenser/chem_synthesizer_ch.dm @@ -222,7 +222,12 @@ // Queue and recipe lists might not be formatted correctly here. Delete this once you've confirmed. data["queue"] = queue - data["recipes"] = recipes + + // Convert the recipes list into an array of strings. The UI does not need the associative list attached to each string. + var/list/tmp_recipes = list() + data["recipes"] = tmp_recipes + for(var/i = 1, i <= recipes.len, i++) + tmp_recipes[i] = recipes[i] @@ -259,16 +264,21 @@ if(!busy) start_queue() if("rem_queue") - // Remove a single entry from the queue. + // Remove a single entry from the queue. Sanity checks also prevent removing the first entry if the machine is busy though UI should already prevent that. var/index = text2num(params["q_index"]) - if(!isnum(index) || !ISINTEGER(index) || !istype(queue) || (index<1 || index>length(queue))) + if(!isnum(index) || !ISINTEGER(index) || !istype(queue) || (index<1 || index>length(queue) || (busy && index == 1))) return queue -= queue[index] if("clear_queue") // Remove all entries from the queue except the currently processing recipe. var/confirm = alert(usr, "Are you sure you want to clear the running queue?", "Confirm", "No", "Yes") if(confirm == "Yes") - queue = list() + if(busy) + // Oh no, I've broken code convention to remove all entries but the first. + for(var/i = queue.len, i >= 2, i--) + queue -= queue[i] + else + queue = list() if("eject_catalyst") // Removes the catalyst bottle from the machine. if(!busy && catalyst) @@ -281,7 +291,9 @@ if("emergency_stop") // Stops everything if that's desirable for some reason. if(busy) - stall() + var/confirm = alert(usr, "Are you sure you want to stall the machine?", "Confirm", "Yes", "No") + if(confirm == "Yes") + stall() if("bottle_product") // Bottles the reaction mixture if stalled. if(!busy) @@ -307,6 +319,8 @@ var/index = params["rm_index"] if(index in recipes) recipes -= recipes[index] + else + to_chat(usr, "You cannot remove recipes while the machine is running!") if("exp_recipe") // Allows the user to export recipes to chat formatted for easy importing. var/index = params["exp_index"] diff --git a/tgui/packages/tgui/interfaces/ChemSynthesizer.js b/tgui/packages/tgui/interfaces/ChemSynthesizer.js index 2d025df425..5e2a2f68e8 100644 --- a/tgui/packages/tgui/interfaces/ChemSynthesizer.js +++ b/tgui/packages/tgui/interfaces/ChemSynthesizer.js @@ -27,6 +27,7 @@ const ChemSynthesizerQueueRecipes = (props, context) => { busy, use_catalyst, queue = [], + production_mode, } = data; return ( @@ -45,7 +46,8 @@ const ChemSynthesizerQueueRecipes = (props, context) => { - - - - - + {queue.length && queue.map(item => { + if ((item.index === 1) && !!busy) { + return ( + + { + + + + } + + ); + } + return ( + + + + ); + }) || ( + + Queue Empty. + + )} + ); }; -const ChemMasterProductionCondiment = (props, context) => { - const { act } = useBackend(context); - return ( - - + + }) || ( + + No Recipes. + + )} + ); -}; - -// const ChemMasterCustomization = (props, context) => { -// const { act, data } = useBackend(context); -// if (!data.loaded_pill_bottle) { -// return ( -//
-// -// None loaded. -// -//
-// ); -// } - -// return ( -//
-//
-// ); -// }; - -modalRegisterBodyOverride('analyze', analyzeModalBodyOverride); +}; \ No newline at end of file