I am an idiot (#16421)

This commit is contained in:
SabreML
2021-07-25 11:37:15 +01:00
committed by GitHub
parent daf2453d15
commit 865b19263c
+14 -10
View File
@@ -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, "<span class='notice'>You insert [O.amount] [O.singular_name]\s into [src].</span>")
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