mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-14 11:42:27 +00:00
* Removes material breakdown flags, traits & miscellaneous fixes. (#80389) ## About The Pull Request 1. Removes material breakdown flags i.e. all flags with the format `BREAKDOWN_XXX`. These flags do nothing, there are no special checks to transform materials based on these flags, they are passed around just because certain procs require them for syntax purposes only. Apparently there were plans to make these flags do something special from the comment302247c0d1/code/__DEFINES/construction/material.dm (L43)But nobody got any ideas for years now. The only special thing we can do with them now is remove them and reduce code clutter, so let's do that The only flag that ever did something was the `BREAKDOWN_INCLUDE_ALCHEMY` flag. This only worked when coupled together with `TRAIT_MAT_TRANSMUTED` trait(which is only used by the reagent metalgen) and when both this trait & flag are combined together... they still do nothing302247c0d1/code/game/atom/atom_materials.dm (L41-L42)Yup they cancel out each other to prevent returning an empty list, the traits only job was to prevent materials from being recycled (like why? what's the benefit of that? nothing) and the flag was meant to bypass this restriction so both the trait & the flag cancel out each other therefore doing nothing meaningful. Best remove them both and call it a day. 2. Fixes an error in displaying number of sheets inserted into a mat container when that sheet is made up of alloy materials. it would count as 2 or more because it would take the sum of total material amount inserted and not the actual sheets. That's fixed now. 3. Remote materials now properly respect the `MATCONTAINER_NO_INSERT` flag 4. Adds helper proc to insert materials via the remote material component with proper context ## Changelog 🆑 fix: mat container displays correct number of sheets inserted for alloy materials. fix: remote materials now properly respect the `MATCONTAINER_NO_INSERT` flag. code: removes material breakdown flags and related traits. code: adds helper proc to insert materials via the remote material component with proper context. /🆑 * Removes material breakdown flags, traits & miscellaneous fixes. --------- Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
42 lines
1.5 KiB
Plaintext
42 lines
1.5 KiB
Plaintext
/**
|
|
* # Material Scanner
|
|
*
|
|
* Returns the materials of an atom
|
|
*/
|
|
/obj/item/circuit_component/matscanner
|
|
display_name = "Material Scanner"
|
|
desc = "Outputs the material composition of 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
|
|
/// Whether we consider the materials alloys are made when scanning.
|
|
var/datum/port/input/break_down_alloys
|
|
/// The result from the output
|
|
var/datum/port/output/result
|
|
|
|
var/max_range = 5
|
|
|
|
/obj/item/circuit_component/matscanner/get_ui_notices()
|
|
. = ..()
|
|
. += create_ui_notice("Maximum Range: [max_range] tiles", "orange", "info")
|
|
|
|
/obj/item/circuit_component/matscanner/populate_ports()
|
|
input_port = add_input_port("Entity", PORT_TYPE_ATOM)
|
|
break_down_alloys = add_input_port("Break Down Alloys", PORT_TYPE_NUMBER)
|
|
result = add_output_port("Materials", PORT_TYPE_ASSOC_LIST(PORT_TYPE_STRING, PORT_TYPE_NUMBER))
|
|
|
|
/obj/item/circuit_component/matscanner/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/composition = entity.get_material_composition()
|
|
var/list/composition_but_with_string_keys = list()
|
|
for(var/datum/material/material as anything in composition)
|
|
composition_but_with_string_keys[material.name] = composition[material]
|
|
result.set_output(composition_but_with_string_keys)
|