From e3b3323441e3361100ca88ccbce9e6ff325017bc Mon Sep 17 00:00:00 2001 From: NovaBot <154629622+NovaBot13@users.noreply.github.com> Date: Sun, 21 Apr 2024 17:12:35 -0400 Subject: [PATCH] [MIRROR] Lathes compute their local storage size correctly (#2115) * Lathes compute their local storage size correctly (#82770) ## About The Pull Request Basically we have to add the material container before we call parent Initialize(which calls `RefreshParts()`), else the container doesn't get initialized early and we skip over computing storage sizes ## Changelog :cl: fix: off station & round start lathes with local storage don't have infinite storage size. /:cl: * Lathes compute their local storage size correctly --------- Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> --- code/modules/research/machinery/_production.dm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/code/modules/research/machinery/_production.dm b/code/modules/research/machinery/_production.dm index c43b167f23b..e12c7c2a57d 100644 --- a/code/modules/research/machinery/_production.dm +++ b/code/modules/research/machinery/_production.dm @@ -22,10 +22,6 @@ var/drop_direction = 0 /obj/machinery/rnd/production/Initialize(mapload) - . = ..() - - cached_designs = list() - materials = AddComponent( /datum/component/remote_materials, \ mapload, \ @@ -34,6 +30,10 @@ ) \ ) + . = ..() + + cached_designs = list() + RegisterSignal(src, COMSIG_SILO_ITEM_CONSUMED, TYPE_PROC_REF(/obj/machinery/rnd/production, silo_material_insert)) AddComponent( @@ -182,11 +182,10 @@ /obj/machinery/rnd/production/RefreshParts() . = ..() - if(materials) - var/total_storage = 0 - for(var/datum/stock_part/matter_bin/bin in component_parts) - total_storage += bin.tier * 37.5 * SHEET_MATERIAL_AMOUNT - materials.set_local_size(total_storage) + var/total_storage = 0 + for(var/datum/stock_part/matter_bin/bin in component_parts) + total_storage += bin.tier * 37.5 * SHEET_MATERIAL_AMOUNT + materials.set_local_size(total_storage) efficiency_coeff = compute_efficiency()