diff --git a/code/__DEFINES/materials.dm b/code/__DEFINES/materials.dm index ef6a35a9abc..9a7bf2e468e 100644 --- a/code/__DEFINES/materials.dm +++ b/code/__DEFINES/materials.dm @@ -19,9 +19,12 @@ #define MATCONTAINER_ANY_INTENT (1<<2) ///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. @@ -34,6 +37,8 @@ #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) /// Flag for atoms, this flag ensures it isn't re-colored by materials. Useful for snowflake icons such as default toolboxes. #define MATERIAL_COLOR (1<<0) diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 3a89453eee9..164686d7050 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -228,6 +228,9 @@ 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" + // item traits #define TRAIT_NODROP "nodrop" #define TRAIT_NO_STORAGE_INSERT "no_storage_insert" //cannot be inserted in a storage. diff --git a/code/datums/elements/turf_transparency.dm b/code/datums/elements/turf_transparency.dm index 5106be84745..fa0919d61ab 100644 --- a/code/datums/elements/turf_transparency.dm +++ b/code/datums/elements/turf_transparency.dm @@ -48,13 +48,13 @@ return TRUE /datum/element/turf_z_transparency/proc/on_multiz_turf_del(turf/our_turf, turf/T, dir) - SIGNAL_HANDLER + SIGNAL_HANDLER if(dir != DOWN) return update_multiz(our_turf) /datum/element/turf_z_transparency/proc/on_multiz_turf_new(turf/our_turf, turf/T, dir) - SIGNAL_HANDLER + SIGNAL_HANDLER if(dir != DOWN) return update_multiz(our_turf) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index f32d47fa362..7bd484eba39 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -1559,6 +1559,9 @@ */ /atom/proc/get_material_composition(breakdown_flags=NONE) . = 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 = SSmaterials.GetMaterialRef(mat) diff --git a/code/modules/cargo/exports/materials.dm b/code/modules/cargo/exports/materials.dm index 34cb5b8674e..0c932a605e9 100644 --- a/code/modules/cargo/exports/materials.dm +++ b/code/modules/cargo/exports/materials.dm @@ -13,16 +13,17 @@ return 0 if(!isitem(O)) return 0 + var/obj/item/I = O - if(!(SSmaterials.GetMaterialRef(material_id) in I.custom_materials)) + var/list/mat_comp = I.get_material_composition(BREAKDOWN_FLAGS_EXPORT) + if(isnull(mat_comp[SSmaterials.GetMaterialRef(material_id)])) return 0 - var/amount = I.custom_materials[SSmaterials.GetMaterialRef(material_id)] - + var/amount = mat_comp[SSmaterials.GetMaterialRef(material_id)] if(istype(I, /obj/item/stack/ore)) amount *= 0.8 // Station's ore redemption equipment is really goddamn good. - return round(amount/MINERAL_MATERIAL_AMOUNT) + return round(amount / MINERAL_MATERIAL_AMOUNT) // Materials. Nothing but plasma is really worth selling. Better leave it all to RnD and sell some plasma instead. diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index 1fe11d64dda..97282b24f8a 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -2268,8 +2268,11 @@ description = "A purple metal morphic liquid, said to impose it's metallic properties on whatever it touches." color = "#b000aa" taste_mult = 0 // oderless and tasteless + + /// The material flags used to apply the transmuted materials var/applied_material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR - var/minumum_material_amount = 100 + /// The amount of materials to apply to the transmuted objects if they don't contain materials + var/default_material_amount = 100 /datum/reagent/metalgen/expose_obj(obj/exposed_obj, volume) . = ..() @@ -2284,19 +2287,19 @@ var/metal_ref = data["material"] if(!metal_ref) return - var/metal_amount = 0 - for(var/B in A.custom_materials) //list with what they're made of - metal_amount += A.custom_materials[B] + var/metal_amount = 0 + var/list/materials_to_transmute = A.get_material_composition(BREAKDOWN_INCLUDE_ALCHEMY) + for(var/metal_key in materials_to_transmute) //list with what they're made of + metal_amount += materials_to_transmute[metal_key] if(!metal_amount) - metal_amount = minumum_material_amount //some stuff doesn't have materials at all. To still give them properties, we give them a material. Basically doesnt exist - - var/list/metal_dat = list() - metal_dat[metal_ref] = metal_amount //if we pass the list directly, byond turns metal_ref into "metal_ref" kjewrg8fwcyvf + metal_amount = default_material_amount //some stuff doesn't have materials at all. To still give them properties, we give them a material. Basically doesn't exist + var/list/metal_dat = list((metal_ref) = metal_amount) A.material_flags = applied_material_flags A.set_custom_materials(metal_dat) + ADD_TRAIT(A, TRAIT_MAT_TRANSMUTED, type) /datum/reagent/gravitum name = "Gravitum"