From 865b19263c95dc5e63ba596a6cce853a8bf24e03 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Sun, 25 Jul 2021 11:37:15 +0100 Subject: [PATCH] I am an idiot (#16421) --- code/modules/mining/machine_redemption.dm | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index b3fbae50e50..47c110bb998 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -60,7 +60,7 @@ ..() ore_buffer = list() // Components - AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_BLUESPACE), INFINITY, FALSE, /obj/item/stack, null, CALLBACK(src, .proc/on_material_insert), TRUE) + AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_BLUESPACE), INFINITY, FALSE, /obj/item/stack, null, CALLBACK(src, .proc/on_material_insert)) files = new /datum/research/smelter(src) // Stock parts component_parts = list() @@ -202,13 +202,6 @@ try_insert_id(user) return - else if(istype(I, /obj/item/stack/ore)) - var/obj/item/stack/ore/O = I - to_chat(user, "You insert [O.amount] [O.singular_name]\s into [src].") - smelt_ore(O) - SStgui.update_uis(src) // This is needed - return - else if(istype(I, /obj/item/disk/design_disk)) if(!user.drop_item()) return @@ -395,8 +388,7 @@ */ /obj/machinery/mineral/ore_redemption/proc/smelt_ore(obj/item/stack/ore/O) // Award points if the ore actually smelts to something - if(O.refined_type) - points += O.points * point_upgrade * O.amount + give_points(O.type, O.amount) // Insert materials var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) var/amount_compatible = materials.get_item_material_amount(O) @@ -406,6 +398,17 @@ ore_buffer -= O qdel(O) +/** + * Adds a set number of mining points, based on the ore points, the ore amount, and the ORM upgrade state. + * + * Arguments: + * * ore_path - The typepath of the inserted ore. + * * ore_amount - The amount of ore which has been inserted. + */ +/obj/machinery/mineral/ore_redemption/proc/give_points(obj/item/stack/ore/ore_path, ore_amount) + if(initial(ore_path.refined_type)) + points += initial(ore_path.points) * point_upgrade * ore_amount + /** * Returns the amount of alloy sheets that can be produced from the given design. * @@ -503,6 +506,7 @@ * * inserted - The amount of material inserted. */ /obj/machinery/mineral/ore_redemption/proc/on_material_insert(inserted_type, last_inserted_id, inserted) + give_points(inserted_type, inserted) SStgui.update_uis(src) #undef BASE_POINT_MULT