Skip to content

Commit

Permalink
[MIRROR] Lathes compute their local storage size correctly (#2115)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
2 people authored and StealsThePRs committed Apr 21, 2024
1 parent ae5d496 commit e3b3323
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions code/modules/research/machinery/_production.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
var/drop_direction = 0

/obj/machinery/rnd/production/Initialize(mapload)
. = ..()

cached_designs = list()

materials = AddComponent(
/datum/component/remote_materials, \
mapload, \
Expand All @@ -34,6 +30,10 @@
) \
)

. = ..()

cached_designs = list()

RegisterSignal(src, COMSIG_SILO_ITEM_CONSUMED, TYPE_PROC_REF(/obj/machinery/rnd/production, silo_material_insert))

AddComponent(
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit e3b3323

Please sign in to comment.