From 0ea35e01c7e529ea5c69dc562e2593bb1e771d74 Mon Sep 17 00:00:00 2001 From: Dmeto <75919495+Dmeto@users.noreply.github.com> Date: Fri, 9 Sep 2022 12:02:32 +0100 Subject: [PATCH] Changes reagentscanner circuit component to use Table (#69745) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes components\atom\reagentscanner to use table list from Assoc list. Added purity output to components\atom\reagentscanner. At time of making this its impossible to iterate through the output of reagentscanner via loops or numerical index and to determine the amount or the reagent scanned you needed to know its associated value which is less than idea. Queried this issue on coderbus meeting 3 then asked Watermelon and he agreed that a change would be good. Added a "purity" to the table outputs to make shells of this component "desirable" to chemistry who need to use Ph_meter to check exact purity. If this not allowed I’m willing to make an \atom\reagentscanner\adv variant that will comparable to Ph_meter. I intend to give the same treatment to materialscanner. --- .../wiremod/components/atom/reagentscanner.dm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/code/modules/wiremod/components/atom/reagentscanner.dm b/code/modules/wiremod/components/atom/reagentscanner.dm index 4c79cd4eafc..f73f8b70839 100644 --- a/code/modules/wiremod/components/atom/reagentscanner.dm +++ b/code/modules/wiremod/components/atom/reagentscanner.dm @@ -20,10 +20,14 @@ /obj/item/circuit_component/reagentscanner/get_ui_notices() . = ..() . += create_ui_notice("Maximum Range: [max_range] tiles", "orange", "info") + . += create_table_notices(list( + "reagent", + "volume", + )) /obj/item/circuit_component/reagentscanner/populate_ports() input_port = add_input_port("Entity", PORT_TYPE_ATOM) - result = add_output_port("Reagents", PORT_TYPE_ASSOC_LIST(PORT_TYPE_STRING, PORT_TYPE_NUMBER)) + result = add_output_port("Reagents", PORT_TYPE_TABLE) /obj/item/circuit_component/reagentscanner/input_received(datum/port/input/port) var/atom/entity = input_port.value @@ -31,7 +35,10 @@ if(!istype(entity) || !IN_GIVEN_RANGE(location, entity, max_range)) result.set_output(null) return - var/list/output_list = list() + var/list/new_table = list() for(var/datum/reagent/reagent as anything in entity.reagents?.reagent_list) - output_list[reagent.name] += reagent.volume - result.set_output(output_list) + var/list/entry = list() + entry["reagent"] = reagent.name + entry["volume"] = reagent.volume + new_table += list(entry) + result.set_output(new_table)