From 6d9d4a2900b0fb3f84496057591e08080ef285ad Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Tue, 21 Feb 2023 21:13:19 -0600 Subject: [PATCH 1/2] Add stopgap fix for #406 The actual, proper, long-term solution would be separating this out into different procs upstream so that we can override only the relevant logic and keep the ordering sane. --- .../modules/fabrication/_fabricator.dm | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/mods/persistence/modules/fabrication/_fabricator.dm b/mods/persistence/modules/fabrication/_fabricator.dm index 902ef9f97db..bc4eff7b0f8 100644 --- a/mods/persistence/modules/fabrication/_fabricator.dm +++ b/mods/persistence/modules/fabrication/_fabricator.dm @@ -10,10 +10,40 @@ if(!length(design_files)) // Return here to avoid sorting again. return - add_designs(design_files) + var/list/add_mat_to_storage_cap = list() + var/list/new_designs = add_designs(design_files) + for(var/datum/fabricator_recipe/new_recipe in new_designs) + for(var/mat in new_recipe.resources) + add_mat_to_storage_cap |= mat + + LAZYDISTINCTADD(unique_categories, new_recipe.category) + if(!length(new_recipe.species_locked)) + continue + + if(isnull(species_variation)) + design_cache.Remove(new_recipe) + continue + + for(var/species_type in new_recipe.species_locked) + if(!(ispath(species_variation, species_type))) + design_cache.Remove(new_recipe) + continue design_cache = sortTim(design_cache, /proc/cmp_name_asc) + if(length(add_mat_to_storage_cap)) + var/need_storage_recalc = FALSE + for(var/mat in add_mat_to_storage_cap) + if(mat in base_storage_capacity) + continue + need_storage_recalc = TRUE + base_storage_capacity[mat] = (SHEET_MATERIAL_AMOUNT * base_storage_capacity_mult) + if(!(mat in stored_material)) + stored_material[mat] = 0 + + if(need_storage_recalc) + RefreshParts() + /obj/machinery/fabricator/proc/add_designs(list/files) . = list() for(var/datum/computer_file/data/design/D in files) From 33cd3f4e85cf70fab5653f54241deb746d37ca89 Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Tue, 21 Feb 2023 21:44:55 -0600 Subject: [PATCH 2/2] Fix indentation --- .../modules/fabrication/_fabricator.dm | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/mods/persistence/modules/fabrication/_fabricator.dm b/mods/persistence/modules/fabrication/_fabricator.dm index bc4eff7b0f8..c2cdaaee2dd 100644 --- a/mods/persistence/modules/fabrication/_fabricator.dm +++ b/mods/persistence/modules/fabrication/_fabricator.dm @@ -16,7 +16,6 @@ for(var/mat in new_recipe.resources) add_mat_to_storage_cap |= mat - LAZYDISTINCTADD(unique_categories, new_recipe.category) if(!length(new_recipe.species_locked)) continue @@ -32,17 +31,17 @@ design_cache = sortTim(design_cache, /proc/cmp_name_asc) if(length(add_mat_to_storage_cap)) - var/need_storage_recalc = FALSE - for(var/mat in add_mat_to_storage_cap) - if(mat in base_storage_capacity) - continue - need_storage_recalc = TRUE - base_storage_capacity[mat] = (SHEET_MATERIAL_AMOUNT * base_storage_capacity_mult) - if(!(mat in stored_material)) - stored_material[mat] = 0 + var/need_storage_recalc = FALSE + for(var/mat in add_mat_to_storage_cap) + if(mat in base_storage_capacity) + continue + need_storage_recalc = TRUE + base_storage_capacity[mat] = (SHEET_MATERIAL_AMOUNT * base_storage_capacity_mult) + if(!(mat in stored_material)) + stored_material[mat] = 0 - if(need_storage_recalc) - RefreshParts() + if(need_storage_recalc) + RefreshParts() /obj/machinery/fabricator/proc/add_designs(list/files) . = list()