mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-14 11:42:27 +00:00
* Changes reagentscanner circuit component to use Table (#69745) 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. * Changes reagentscanner circuit component to use Table Co-authored-by: Dmeto <75919495+Dmeto@users.noreply.github.com>
45 lines
1.3 KiB
Plaintext
45 lines
1.3 KiB
Plaintext
/**
|
|
* # Reagents Scanner
|
|
*
|
|
* Returns the reagentss of an atom
|
|
*/
|
|
/obj/item/circuit_component/reagentscanner
|
|
display_name = "Reagents Scanner"
|
|
desc = "Outputs the reagents found inside the inputted entity."
|
|
category = "Entity"
|
|
|
|
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
|
|
|
|
// The entity to scan
|
|
var/datum/port/input/input_port
|
|
/// The result from the output
|
|
var/datum/port/output/result
|
|
|
|
var/max_range = 5
|
|
|
|
/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_TABLE)
|
|
|
|
/obj/item/circuit_component/reagentscanner/input_received(datum/port/input/port)
|
|
var/atom/entity = input_port.value
|
|
var/turf/location = get_location()
|
|
if(!istype(entity) || !IN_GIVEN_RANGE(location, entity, max_range))
|
|
result.set_output(null)
|
|
return
|
|
var/list/new_table = list()
|
|
for(var/datum/reagent/reagent as anything in entity.reagents?.reagent_list)
|
|
var/list/entry = list()
|
|
entry["reagent"] = reagent.name
|
|
entry["volume"] = reagent.volume
|
|
new_table += list(entry)
|
|
result.set_output(new_table)
|