From d36a5af64f2cc486c1aa98a9c4c05d522fbfa74f Mon Sep 17 00:00:00 2001 From: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Date: Mon, 25 Dec 2023 06:59:26 +0530 Subject: [PATCH] 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 comment https://github.com/tgstation/tgstation/blob/302247c0d1e980478f59d9c497169290ee259887/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 nothing https://github.com/tgstation/tgstation/blob/302247c0d1e980478f59d9c497169290ee259887/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 :cl: 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. /:cl: --- code/__DEFINES/construction/material.dm | 20 -------- code/__DEFINES/traits/declarations.dm | 3 -- code/_globalvars/bitfields.dm | 3 +- code/_globalvars/traits/_traits.dm | 1 - .../components/material/material_container.dm | 51 +++++++++---------- .../components/material/remote_materials.dm | 29 +++++++++-- code/datums/materials/_material.dm | 6 +-- code/datums/materials/alloys.dm | 10 ++-- code/game/atom/atom_materials.dm | 6 +-- code/game/machinery/droneDispenser.dm | 4 +- code/game/machinery/recycler.dm | 18 ++++--- code/game/machinery/sheetifier.dm | 2 +- code/modules/cargo/exports/materials.dm | 2 +- code/modules/clothing/shoes/bananashoes.dm | 8 ++- code/modules/mining/machine_processing.dm | 6 +-- code/modules/mining/machine_redemption.dm | 8 +-- code/modules/mod/modules/modules_general.dm | 2 +- .../chemistry/reagents/other_reagents.dm | 3 +- .../modules/research/machinery/_production.dm | 7 +-- .../modules/vehicles/mecha/mech_fabricator.dm | 6 +-- .../wiremod/components/atom/matscanner.dm | 5 +- .../modules/wiremod/core/component_printer.dm | 12 +---- 22 files changed, 92 insertions(+), 120 deletions(-) diff --git a/code/__DEFINES/construction/material.dm b/code/__DEFINES/construction/material.dm index dad575c58c3..294fe6364cd 100644 --- a/code/__DEFINES/construction/material.dm +++ b/code/__DEFINES/construction/material.dm @@ -40,26 +40,6 @@ ///If the user won't receive a warning when attacking the container with an unallowed item. #define MATCONTAINER_SILENT (1<<3) -// The following flags are for decomposing alloys. Should be expanded upon and diversified once someone gets around to reworking recycling. -/// Can reduce an alloy into its component materials. -#define BREAKDOWN_ALLOYS (1<<4) -/// Makes the material composition include transmuted materials objects -#define BREAKDOWN_INCLUDE_ALCHEMY (1<<5) -/// Breakdown flags used by techfabs and circuit printers. -#define BREAKDOWN_FLAGS_LATHE (BREAKDOWN_ALLOYS) -/// Breakdown flags used by the ORM. -#define BREAKDOWN_FLAGS_ORM (BREAKDOWN_ALLOYS) -/// Breakdown flags used by the recycler. -#define BREAKDOWN_FLAGS_RECYCLER (BREAKDOWN_ALLOYS) -/// Breakdown flags used by the sheetifier. -#define BREAKDOWN_FLAGS_SHEETIFIER (BREAKDOWN_ALLOYS) -/// Breakdown flags used by the ore processor. -#define BREAKDOWN_FLAGS_ORE_PROCESSOR (BREAKDOWN_ALLOYS) -/// Breakdown flags used by the drone dispenser. -#define BREAKDOWN_FLAGS_DRONE_DISPENSER (BREAKDOWN_ALLOYS) -/// Breakdown flags used when exporting materials. -#define BREAKDOWN_FLAGS_EXPORT (NONE) - /// Whether a material's mechanical effects should apply to the atom. This is necessary for other flags to work. #define MATERIAL_EFFECTS (1<<0) /// Applies the material color to the atom's color. Deprecated, use MATERIAL_GREYSCALE instead diff --git a/code/__DEFINES/traits/declarations.dm b/code/__DEFINES/traits/declarations.dm index a848ea64684..59519b1a77b 100644 --- a/code/__DEFINES/traits/declarations.dm +++ b/code/__DEFINES/traits/declarations.dm @@ -623,9 +623,6 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai ///Used for managing KEEP_TOGETHER in [/atom/var/appearance_flags] #define TRAIT_KEEP_TOGETHER "keep-together" -///Marks the item as having been transmuted. Functionally blacklists the item from being recycled or sold for materials. -#define TRAIT_MAT_TRANSMUTED "transmuted" - // cargo traits ///If the item will block the cargo shuttle from flying to centcom #define TRAIT_BANNED_FROM_CARGO_SHUTTLE "banned_from_cargo_shuttle" diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 8cfa5eb09e6..2c35baed1ec 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -218,8 +218,7 @@ DEFINE_BITFIELD(mat_container_flags, list( "MATCONTAINER_EXAMINE" = MATCONTAINER_EXAMINE, "MATCONTAINER_NO_INSERT" = MATCONTAINER_NO_INSERT, "MATCONTAINER_ANY_INTENT" = MATCONTAINER_ANY_INTENT, - "MATCONTAINER_SILENT" = MATCONTAINER_SILENT, - "BREAKDOWN_ALLOYS" = BREAKDOWN_ALLOYS, + "MATCONTAINER_SILENT" = MATCONTAINER_SILENT )) DEFINE_BITFIELD(internal_damage, list( diff --git a/code/_globalvars/traits/_traits.dm b/code/_globalvars/traits/_traits.dm index a4f2042515d..c979733aa16 100644 --- a/code/_globalvars/traits/_traits.dm +++ b/code/_globalvars/traits/_traits.dm @@ -22,7 +22,6 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_FOOD_SILVER" = TRAIT_FOOD_SILVER, "TRAIT_KEEP_TOGETHER" = TRAIT_KEEP_TOGETHER, "TRAIT_LIGHTING_DEBUGGED" = TRAIT_LIGHTING_DEBUGGED, - "TRAIT_MAT_TRANSMUTED" = TRAIT_MAT_TRANSMUTED, "TRAIT_RECENTLY_COINED" = TRAIT_RECENTLY_COINED, "TRAIT_RUSTY" = TRAIT_RUSTY, "TRAIT_SPINNING" = TRAIT_SPINNING, diff --git a/code/datums/components/material/material_container.dm b/code/datums/components/material/material_container.dm index 8acf3e274f1..ad852a00471 100644 --- a/code/datums/components/material/material_container.dm +++ b/code/datums/components/material/material_container.dm @@ -30,13 +30,13 @@ /// Sets up the proper signals and fills the list of materials with the appropriate references. /datum/component/material_container/Initialize( - list/init_mats, - max_amt = 0, - _mat_container_flags = NONE, - list/allowed_mats = init_mats, - list/allowed_items, - list/container_signals - ) + list/init_mats, + max_amt = 0, + _mat_container_flags = NONE, + list/allowed_mats = init_mats, + list/allowed_items, + list/container_signals +) if(!isatom(parent)) return COMPONENT_INCOMPATIBLE @@ -133,17 +133,16 @@ * Arguments: * - [source][/obj/item]: The source of the materials we are inserting. * - multiplier: The multiplier for the materials extract from this item being inserted. - * - breakdown_flags: The breakdown bitflags that will be used to retrieve the materials from the source * - context: the atom performing the operation, this is the last argument sent in COMSIG_MATCONTAINER_ITEM_CONSUMED * and is used mostly for silo logging, the silo resends this signal on the context to give it a * chance to process the item */ -/datum/component/material_container/proc/insert_item_materials(obj/item/source, multiplier = 1, breakdown_flags = mat_container_flags, atom/context = parent) +/datum/component/material_container/proc/insert_item_materials(obj/item/source, multiplier = 1, atom/context = parent) var/primary_mat var/max_mat_value = 0 var/material_amount = 0 - var/list/item_materials = source.get_material_composition(breakdown_flags) + var/list/item_materials = source.get_material_composition() var/list/mats_consumed = list() for(var/MAT in item_materials) if(!can_hold_material(MAT)) @@ -200,17 +199,16 @@ * Arguments: * - [weapon][obj/item]: the item you are trying to insert * - multiplier: The multiplier for the materials being inserted - * - breakdown_flags: The breakdown bitflags that will be used to retrieve the materials from the source * - context: the atom performing the operation, this is the last argument sent in COMSIG_MATCONTAINER_ITEM_CONSUMED and is used mostly for silo logging */ -/datum/component/material_container/proc/insert_item(obj/item/weapon, multiplier = 1, breakdown_flags = mat_container_flags, atom/context = parent) +/datum/component/material_container/proc/insert_item(obj/item/weapon, multiplier = 1, atom/context = parent) if(QDELETED(weapon)) return MATERIAL_INSERT_ITEM_NO_MATS multiplier = CEILING(multiplier, 0.01) var/obj/item/target = weapon - var/material_amount = OPTIMAL_COST(get_item_material_amount(target, breakdown_flags) * multiplier) + var/material_amount = OPTIMAL_COST(get_item_material_amount(target) * multiplier) if(!material_amount) return MATERIAL_INSERT_ITEM_NO_MATS var/obj/item/stack/item_stack @@ -224,7 +222,7 @@ if(!sheets_to_insert) return MATERIAL_INSERT_ITEM_NO_SPACE target = fast_split_stack(item_stack, sheets_to_insert) - material_amount = get_item_material_amount(target, breakdown_flags) * multiplier + material_amount = get_item_material_amount(target) * multiplier material_amount = OPTIMAL_COST(material_amount) //not enough space, time to bail @@ -232,7 +230,7 @@ return MATERIAL_INSERT_ITEM_NO_SPACE //do the insert - var/last_inserted_id = insert_item_materials(target, multiplier, breakdown_flags, context) + var/last_inserted_id = insert_item_materials(target, multiplier, context) if(!isnull(last_inserted_id)) qdel(target) //item gone return material_amount @@ -254,10 +252,9 @@ * Arguments: * * held_item - the item to insert * * user - the mob inserting this item - * * breakdown_flags - how this item and all it's contents inside are broken down during insertion. This is unique to the machine doing the insertion * * context - the atom performing the operation, this is the last argument sent in COMSIG_MATCONTAINER_ITEM_CONSUMED and is used mostly for silo logging */ -/datum/component/material_container/proc/user_insert(obj/item/held_item, mob/living/user, breakdown_flags = mat_container_flags, atom/context = parent) +/datum/component/material_container/proc/user_insert(obj/item/held_item, mob/living/user, atom/context = parent) set waitfor = FALSE . = 0 @@ -342,7 +339,7 @@ if(!isstack(target_item) && !is_type_in_list(target_item, storage_items)) var/total_amount = 0 for(var/obj/item/weapon as anything in target_item.get_all_contents_type(/obj/item)) - total_amount += get_item_material_amount(weapon, breakdown_flags) + total_amount += get_item_material_amount(weapon) if(!has_space(total_amount)) if(!(mat_container_flags & MATCONTAINER_SILENT)) to_chat(user, span_warning("[parent] does not have enough space for [target_item]!")) @@ -397,7 +394,7 @@ item_name = the_stack.singular_name item_count = the_stack.amount is_stack = TRUE - inserted = insert_item(target_item, 1, mat_container_flags, context) + inserted = insert_item(target_item, 1, context) if(inserted > 0) . += inserted inserted /= SHEET_MATERIAL_AMOUNT // display units inserted as sheets for improved readability @@ -418,11 +415,9 @@ //collect all messages to print later var/list/status_data = chat_msgs["[MATERIAL_INSERT_ITEM_SUCCESS]"] || list() var/list/item_data = status_data[item_name] || list() + item_data["count"] += item_count item_data["amount"] += inserted - if(!is_stack) //count will match with amount so its not required - item_data["count"] += item_count - else - item_data["stack"] = TRUE + item_data["stack"] = is_stack status_data[item_name] = item_data chat_msgs["[MATERIAL_INSERT_ITEM_SUCCESS]"] = status_data @@ -463,7 +458,8 @@ switch(text2num(status)) if(MATERIAL_INSERT_ITEM_SUCCESS) //no problems full item was consumed if(chat_data["stack"]) - to_chat(user, span_notice("[amount > 1 ? amount : ""] [item_name][amount > 1 ? "'s" : ""] was consumed by [parent]")) + var/sheets = min(count, amount) //minimum between sheets inserted vs sheets consumed(values differ for alloys) + to_chat(user, span_notice("[sheets > 1 ? sheets : ""] [item_name][sheets > 1 ? "'s" : ""] was consumed by [parent]")) else to_chat(user, span_notice("[count > 1 ? count : ""] [item_name][count > 1 ? "'s" : ""] worth [amount] sheets of material was consumed by [parent]")) if(MATERIAL_INSERT_ITEM_NO_SPACE) //no space @@ -539,13 +535,12 @@ * * Arguments: * - [I][obj/item]: the item whos materials must be retrieved - * - breakdown_flags: how this item must be broken down to retrieve its materials */ -/datum/component/material_container/proc/get_item_material_amount(obj/item/I, breakdown_flags = mat_container_flags) +/datum/component/material_container/proc/get_item_material_amount(obj/item/I) if(!istype(I) || !I.custom_materials) return 0 var/material_amount = 0 - var/list/item_materials = I.get_material_composition(breakdown_flags) + var/list/item_materials = I.get_material_composition() for(var/MAT in item_materials) if(!can_hold_material(MAT)) continue @@ -750,7 +745,7 @@ return NONE if((held_item.flags_1 & HOLOGRAM_1) || (held_item.item_flags & NO_MAT_REDEMPTION) || (allowed_item_typecache && !is_type_in_typecache(held_item, allowed_item_typecache))) return NONE - var/list/item_materials = held_item.get_material_composition(mat_container_flags) + var/list/item_materials = held_item.get_material_composition() if(!length(item_materials)) return NONE for(var/material in item_materials) diff --git a/code/datums/components/material/remote_materials.dm b/code/datums/components/material/remote_materials.dm index e57a212cbde..376157903a6 100644 --- a/code/datums/components/material/remote_materials.dm +++ b/code/datums/components/material/remote_materials.dm @@ -35,7 +35,8 @@ handles linking back and forth. var/connect_to_silo = FALSE if(force_connect || (mapload && is_station_level(T.z))) connect_to_silo = TRUE - RegisterSignal(parent, COMSIG_ATOM_ATTACKBY, TYPE_PROC_REF(/datum/component/remote_materials, SiloAttackBy)) + if(!(mat_container_flags & MATCONTAINER_NO_INSERT)) + RegisterSignal(parent, COMSIG_ATOM_ATTACKBY, TYPE_PROC_REF(/datum/component/remote_materials, SiloAttackBy)) if(mapload) // wait for silo to initialize during mapload addtimer(CALLBACK(src, PROC_REF(_PrepareStorage), connect_to_silo)) @@ -132,7 +133,7 @@ handles linking back and forth. return if(silo) - mat_container.user_insert(target, user, mat_container_flags, parent) + mat_container.user_insert(target, user, parent) return COMPONENT_NO_AFTERATTACK @@ -170,7 +171,8 @@ handles linking back and forth. silo.ore_connected_machines += src silo.updateUsrDialog() mat_container = new_container - RegisterSignal(parent, COMSIG_ATOM_ATTACKBY, TYPE_PROC_REF(/datum/component/remote_materials, SiloAttackBy)) + if(!(mat_container_flags & MATCONTAINER_NO_INSERT)) + RegisterSignal(parent, COMSIG_ATOM_ATTACKBY, TYPE_PROC_REF(/datum/component/remote_materials, SiloAttackBy)) to_chat(user, span_notice("You connect [parent] to [silo] from the multitool's buffer.")) return ITEM_INTERACT_BLOCKING @@ -199,15 +201,19 @@ handles linking back and forth. * - The parent is of type movable atom * - A mat container is actually present * - The silo in not on hold + * Arguments + * * check_hold - should we check if the silo is on hold */ -/datum/component/remote_materials/proc/_can_use_resource() +/datum/component/remote_materials/proc/_can_use_resource(check_hold = TRUE) + PRIVATE_PROC(TRUE) + var/atom/movable/movable_parent = parent if (!istype(movable_parent)) return FALSE if (!mat_container) //no silolink & local storage not supported movable_parent.say("No access to material storage, please contact the quartermaster.") return FALSE - if(on_hold()) //silo on hold + if(check_hold && on_hold()) //silo on hold movable_parent.say("Mineral access is on hold, please contact the quartermaster.") return FALSE return TRUE @@ -254,3 +260,16 @@ handles linking back and forth. drop_target = movable_parent.drop_location() return mat_container.retrieve_sheets(eject_amount, material_ref, target = drop_target, context = parent) + +/** + * Insert an item into the mat container, helper proc to insert items with the correct context + * + * Arguments + * * obj/item/weapon - the item you are trying to insert + * * multiplier - the multiplier applied on the materials consumed + */ +/datum/component/remote_materials/proc/insert_item(obj/item/weapon, multiplier) + if(!_can_use_resource(FALSE)) + return MATERIAL_INSERT_ITEM_FAILURE + + return mat_container.insert_item(weapon, multiplier, parent) diff --git a/code/datums/materials/_material.dm b/code/datums/materials/_material.dm index 53e661d39d8..396b902b73f 100644 --- a/code/datums/materials/_material.dm +++ b/code/datums/materials/_material.dm @@ -245,7 +245,7 @@ Simple datum which is instanced once per type and is used for every object of sa * * Arguments: * - amount: The amount of the material to break down. - * - breakdown_flags: Some flags dictating how exactly this material is being broken down. */ -/datum/material/proc/return_composition(amount=1, breakdown_flags=NONE) - return list((src) = amount) // Yes we need the parenthesis, without them BYOND stringifies src into "src" and things break. +/datum/material/proc/return_composition(amount = 1) + // Yes we need the parenthesis, without them BYOND stringifies src into "src" and things break. + return list((src) = amount) diff --git a/code/datums/materials/alloys.dm b/code/datums/materials/alloys.dm index af208fdc5a4..e878a7f495d 100644 --- a/code/datums/materials/alloys.dm +++ b/code/datums/materials/alloys.dm @@ -6,18 +6,14 @@ init_flags = NONE /// The materials this alloy is made from weighted by their ratios. var/list/composition = null - /// Breakdown flags required to reduce this alloy to its component materials. - var/req_breakdown_flags = BREAKDOWN_ALLOYS - -/datum/material/alloy/return_composition(amount=1, breakdown_flags) - if(req_breakdown_flags & !(breakdown_flags & req_breakdown_flags)) - return ..() +/datum/material/alloy/return_composition(amount = 1) . = list() + var/list/cached_comp = composition for(var/comp_mat in cached_comp) var/datum/material/component_material = GET_MATERIAL_REF(comp_mat) - var/list/component_composition = component_material.return_composition(cached_comp[comp_mat], breakdown_flags) + var/list/component_composition = component_material.return_composition(cached_comp[comp_mat]) for(var/comp_comp_mat in component_composition) .[comp_comp_mat] += component_composition[comp_comp_mat] * amount diff --git a/code/game/atom/atom_materials.dm b/code/game/atom/atom_materials.dm index ae9a5b3a18e..803a79110a1 100644 --- a/code/game/atom/atom_materials.dm +++ b/code/game/atom/atom_materials.dm @@ -36,15 +36,13 @@ * Arguments: * - flags: A set of flags determining how exactly the materials are broken down. */ -/atom/proc/get_material_composition(breakdown_flags=NONE) +/atom/proc/get_material_composition() . = list() - if(!(breakdown_flags & BREAKDOWN_INCLUDE_ALCHEMY) && HAS_TRAIT(src, TRAIT_MAT_TRANSMUTED)) - return var/list/cached_materials = custom_materials for(var/mat in cached_materials) var/datum/material/material = GET_MATERIAL_REF(mat) - var/list/material_comp = material.return_composition(cached_materials[mat], breakdown_flags) + var/list/material_comp = material.return_composition(cached_materials[mat]) for(var/comp_mat in material_comp) .[comp_mat] += material_comp[comp_mat] diff --git a/code/game/machinery/droneDispenser.dm b/code/game/machinery/droneDispenser.dm index 3b78d6bb0b1..802608e47a5 100644 --- a/code/game/machinery/droneDispenser.dm +++ b/code/game/machinery/droneDispenser.dm @@ -56,8 +56,8 @@ /datum/component/material_container, \ list(/datum/material/iron, /datum/material/glass), \ SHEET_MATERIAL_AMOUNT * MAX_STACK_SIZE * 2, \ - MATCONTAINER_EXAMINE|BREAKDOWN_FLAGS_DRONE_DISPENSER, \ - allowed_items=/obj/item/stack \ + MATCONTAINER_EXAMINE, \ + allowed_items = /obj/item/stack \ ) materials.insert_amount_mat(starting_amount) materials.precise_insertion = TRUE diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index 50751d95b5f..a4deb63ae21 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -32,12 +32,18 @@ /datum/material/titanium, /datum/material/bluespace ) - materials = AddComponent(/datum/component/material_container, allowed_materials, INFINITY, MATCONTAINER_NO_INSERT|BREAKDOWN_FLAGS_RECYCLER) + materials = AddComponent( + /datum/component/material_container, \ + allowed_materials, \ + INFINITY, \ + MATCONTAINER_NO_INSERT \ + ) AddComponent(/datum/component/simple_rotation) - AddComponent(/datum/component/butchering/recycler, \ - speed = 0.1 SECONDS, \ - effectiveness = amount_produced, \ - bonus_modifier = amount_produced/5, \ + AddComponent( + /datum/component/butchering/recycler, \ + speed = 0.1 SECONDS, \ + effectiveness = amount_produced, \ + bonus_modifier = amount_produced / 5, \ ) . = ..() return INITIALIZE_HINT_LATELOAD @@ -197,7 +203,7 @@ new wood.plank_type(loc, 1 + seed_modifier) . = TRUE else - var/retrieved = materials.insert_item(weapon, multiplier = (amount_produced / 100), breakdown_flags = BREAKDOWN_FLAGS_RECYCLER) + var/retrieved = materials.insert_item(weapon, multiplier = (amount_produced / 100)) if(retrieved > 0) //item was salvaged i.e. deleted materials.retrieve_all() return TRUE diff --git a/code/game/machinery/sheetifier.dm b/code/game/machinery/sheetifier.dm index 249eff1cfbe..69bebfca69e 100644 --- a/code/game/machinery/sheetifier.dm +++ b/code/game/machinery/sheetifier.dm @@ -15,7 +15,7 @@ /datum/component/material_container, \ list(/datum/material/meat, /datum/material/hauntium), \ SHEET_MATERIAL_AMOUNT * MAX_STACK_SIZE * 2, \ - MATCONTAINER_EXAMINE|BREAKDOWN_FLAGS_SHEETIFIER, \ + MATCONTAINER_EXAMINE, \ typesof(/datum/material/meat) + /datum/material/hauntium, list(/obj/item/food/meat, /obj/item/photo), \ container_signals = list( COMSIG_MATCONTAINER_PRE_USER_INSERT = TYPE_PROC_REF(/obj/machinery/sheetifier, CanInsertMaterials), diff --git a/code/modules/cargo/exports/materials.dm b/code/modules/cargo/exports/materials.dm index 3a5c7f975ed..ecb0d0d0460 100644 --- a/code/modules/cargo/exports/materials.dm +++ b/code/modules/cargo/exports/materials.dm @@ -19,7 +19,7 @@ return 0 var/obj/item/I = O - var/list/mat_comp = I.get_material_composition(BREAKDOWN_FLAGS_EXPORT) + var/list/mat_comp = I.get_material_composition() var/datum/material/mat_ref = ispath(material_id) ? locate(material_id) in mat_comp : GET_MATERIAL_REF(material_id) if(isnull(mat_comp[mat_ref])) return 0 diff --git a/code/modules/clothing/shoes/bananashoes.dm b/code/modules/clothing/shoes/bananashoes.dm index 75299ad828a..909f835b1c9 100644 --- a/code/modules/clothing/shoes/bananashoes.dm +++ b/code/modules/clothing/shoes/bananashoes.dm @@ -19,7 +19,13 @@ /obj/item/clothing/shoes/clown_shoes/banana_shoes/Initialize(mapload) . = ..() AddElement(/datum/element/update_icon_updates_onmob) - bananium = AddComponent(/datum/component/material_container, list(/datum/material/bananium), 100 * SHEET_MATERIAL_AMOUNT, MATCONTAINER_EXAMINE|MATCONTAINER_ANY_INTENT|MATCONTAINER_SILENT, allowed_items=/obj/item/stack) + bananium = AddComponent( + /datum/component/material_container, \ + list(/datum/material/bananium), \ + 100 * SHEET_MATERIAL_AMOUNT, \ + MATCONTAINER_EXAMINE | MATCONTAINER_ANY_INTENT | MATCONTAINER_SILENT, \ + allowed_items = /obj/item/stack, \ + ) AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg'=1), 75, falloff_exponent = 20) RegisterSignal(src, COMSIG_SHOES_STEP_ACTION, PROC_REF(on_step)) if(always_noslip) diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index 848ecac0fa3..f4510741968 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -159,7 +159,7 @@ /datum/component/material_container, \ allowed_materials, \ INFINITY, \ - MATCONTAINER_EXAMINE | BREAKDOWN_FLAGS_ORE_PROCESSOR, \ + MATCONTAINER_EXAMINE, \ allowed_items = /obj/item/stack \ ) if(!GLOB.autounlock_techwebs[/datum/techweb/autounlocking/smelter]) @@ -176,11 +176,11 @@ /obj/machinery/mineral/processing_unit/proc/process_ore(obj/item/stack/ore/O) if(QDELETED(O)) return - var/material_amount = materials.get_item_material_amount(O, BREAKDOWN_FLAGS_ORE_PROCESSOR) + var/material_amount = materials.get_item_material_amount(O) if(!materials.has_space(material_amount)) unload_mineral(O) else - materials.insert_item(O, breakdown_flags = BREAKDOWN_FLAGS_ORE_PROCESSOR) + materials.insert_item(O) if(mineral_machine) mineral_machine.updateUsrDialog() diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 8ecbcb80074..2d542445f8a 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -52,11 +52,7 @@ if(!GLOB.autounlock_techwebs[/datum/techweb/autounlocking/smelter]) GLOB.autounlock_techwebs[/datum/techweb/autounlocking/smelter] = new /datum/techweb/autounlocking/smelter stored_research = GLOB.autounlock_techwebs[/datum/techweb/autounlocking/smelter] - materials = AddComponent( - /datum/component/remote_materials, \ - mapload, \ - mat_container_flags = BREAKDOWN_FLAGS_ORM \ - ) + materials = AddComponent(/datum/component/remote_materials, mapload) RegisterSignal(src, COMSIG_MATCONTAINER_ITEM_CONSUMED, TYPE_PROC_REF(/obj/machinery/mineral/ore_redemption, redeem_points)) @@ -160,7 +156,7 @@ if(isnull(gathered_ore.refined_type)) continue - if(materials.mat_container.insert_item(gathered_ore, ore_multiplier, breakdown_flags = BREAKDOWN_FLAGS_ORM, context = src) <= 0) + if(materials.mat_container.insert_item(gathered_ore, ore_multiplier, context = src) <= 0) unload_mineral(gathered_ore) //if rejected unload SEND_SIGNAL(src, COMSIG_ORM_COLLECTED_ORE) diff --git a/code/modules/mod/modules/modules_general.dm b/code/modules/mod/modules/modules_general.dm index e87391b1758..4acff57f6dc 100644 --- a/code/modules/mod/modules/modules_general.dm +++ b/code/modules/mod/modules/modules_general.dm @@ -866,7 +866,7 @@ insert_trash(new_atom) /obj/item/mod/module/recycler/proc/insert_trash(obj/item/item) - var/retrieved = container.insert_item(item, multiplier = efficiency, breakdown_flags = BREAKDOWN_FLAGS_RECYCLER) + var/retrieved = container.insert_item(item, multiplier = efficiency) if(retrieved == MATERIAL_INSERT_ITEM_NO_MATS) //even if it doesn't have any material to give, trash is trash. qdel(item) playsound(src, SFX_RUSTLE, 50, TRUE, -5) diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index c1ce781d6f9..8f27f4637fb 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -2730,7 +2730,7 @@ return var/metal_amount = 0 - var/list/materials_to_transmute = target.get_material_composition(BREAKDOWN_INCLUDE_ALCHEMY) + var/list/materials_to_transmute = target.get_material_composition() for(var/metal_key in materials_to_transmute) //list with what they're made of metal_amount += materials_to_transmute[metal_key] @@ -2740,7 +2740,6 @@ var/list/metal_dat = list((metal_ref) = metal_amount) target.material_flags = applied_material_flags target.set_custom_materials(metal_dat) - ADD_TRAIT(target, TRAIT_MAT_TRANSMUTED, type) /datum/reagent/gravitum name = "Gravitum" diff --git a/code/modules/research/machinery/_production.dm b/code/modules/research/machinery/_production.dm index b71bc1d025f..0b3924827fd 100644 --- a/code/modules/research/machinery/_production.dm +++ b/code/modules/research/machinery/_production.dm @@ -32,11 +32,8 @@ . = ..() cached_designs = list() - materials = AddComponent( - /datum/component/remote_materials, \ - mapload, \ - mat_container_flags = BREAKDOWN_FLAGS_LATHE, \ - ) + materials = AddComponent(/datum/component/remote_materials, mapload) + AddComponent( /datum/component/payment, \ 0, \ diff --git a/code/modules/vehicles/mecha/mech_fabricator.dm b/code/modules/vehicles/mecha/mech_fabricator.dm index c3e5abc39f0..c4acded7994 100644 --- a/code/modules/vehicles/mecha/mech_fabricator.dm +++ b/code/modules/vehicles/mecha/mech_fabricator.dm @@ -50,11 +50,7 @@ var/list/datum/design/cached_designs /obj/machinery/mecha_part_fabricator/Initialize(mapload) - rmat = AddComponent( \ - /datum/component/remote_materials, \ - mapload && link_on_init, \ - mat_container_flags = BREAKDOWN_FLAGS_LATHE \ - ) + rmat = AddComponent(/datum/component/remote_materials, mapload && link_on_init) cached_designs = list() RefreshParts() //Recalculating local material sizes if the fab isn't linked return ..() diff --git a/code/modules/wiremod/components/atom/matscanner.dm b/code/modules/wiremod/components/atom/matscanner.dm index bbc36bb9789..eb23efddb3a 100644 --- a/code/modules/wiremod/components/atom/matscanner.dm +++ b/code/modules/wiremod/components/atom/matscanner.dm @@ -34,10 +34,7 @@ if(!istype(entity) || !IN_GIVEN_RANGE(location, entity, max_range)) result.set_output(null) return - var/breakdown_flags = BREAKDOWN_INCLUDE_ALCHEMY - if(break_down_alloys.value) - breakdown_flags |= BREAKDOWN_ALLOYS - var/list/composition = entity.get_material_composition(breakdown_flags) + 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] diff --git a/code/modules/wiremod/core/component_printer.dm b/code/modules/wiremod/core/component_printer.dm index 25c684c5a28..3fb736540ec 100644 --- a/code/modules/wiremod/core/component_printer.dm +++ b/code/modules/wiremod/core/component_printer.dm @@ -22,11 +22,7 @@ /obj/machinery/component_printer/Initialize(mapload) . = ..() - materials = AddComponent( \ - /datum/component/remote_materials, \ - mapload, \ - mat_container_flags = BREAKDOWN_FLAGS_LATHE, \ - ) + materials = AddComponent(/datum/component/remote_materials, mapload) /obj/machinery/component_printer/LateInitialize() . = ..() @@ -323,11 +319,7 @@ /obj/machinery/module_duplicator/Initialize(mapload) . = ..() - materials = AddComponent( \ - /datum/component/remote_materials, \ - mapload, \ - mat_container_flags = BREAKDOWN_FLAGS_LATHE, \ - ) + materials = AddComponent(/datum/component/remote_materials, mapload) /obj/machinery/module_duplicator/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui)