From 8b66328e4d2f9ce91c0c6e991dedd99643c351ca Mon Sep 17 00:00:00 2001 From: Bloop <13398309+vinylspiders@users.noreply.github.com> Date: Tue, 18 Nov 2025 22:52:07 -0500 Subject: [PATCH] [NO GBP] Fixes sswardrobe not deleting modsuit parts after failing to stash them (#93901) ## About The Pull Request Should fix https://github.com/tgstation/tgstation/issues/93897 This implements a restock blacklist for SSwardrobe. If an item type is in the blacklist, then SSwardrobe will never try to restock that item, instead just deleting them. ## Why It's Good For The Game Fixes ever-expanding pile of modsuits in nullspace, and lets modsuits actually be wardrobed properly ## Changelog :cl: fix: fixes an where modsuits would accumulate in nullspace over the course of a round /:cl: --- code/__DEFINES/obj_flags.dm | 1 - code/controllers/subsystem/wardrobe.dm | 14 ++++++++++++-- code/modules/mob/living/carbon/human/dummy.dm | 8 +++----- code/modules/mod/mod_theme.dm | 1 - 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/code/__DEFINES/obj_flags.dm b/code/__DEFINES/obj_flags.dm index 7ec65fea6f0..605220d2cda 100644 --- a/code/__DEFINES/obj_flags.dm +++ b/code/__DEFINES/obj_flags.dm @@ -44,7 +44,6 @@ #define NO_MAT_REDEMPTION (1<<5) // Stops you from putting things like an RCD or other items into an ORM or protolathe for materials. #define DROPDEL (1<<6) // When dropped, it calls qdel on itself #define NOBLUDGEON (1<<7) // when an item has this it produces no "X has been hit by Y with Z" message in the default attackby() -#define DO_NOT_WARDROBE (1<<8) // Used to denote anything that should not be stashed by SSwardrobe /** * for all things that are technically items but don't want to be treated as such, given on a case-by-case basis * examples of use are hand items, omni-toolsets, non-limb limbs (hand eater, mounted chainsaw, many null rods), borg modules, bodyparts, organs, etc. diff --git a/code/controllers/subsystem/wardrobe.dm b/code/controllers/subsystem/wardrobe.dm index 3fb2d87fa86..4f25ff47d1c 100644 --- a/code/controllers/subsystem/wardrobe.dm +++ b/code/controllers/subsystem/wardrobe.dm @@ -41,6 +41,10 @@ SUBSYSTEM_DEF(wardrobe) var/stock_hit = 0 /// How many items would we make just by loading the master list once? var/one_go_master = 0 + /// Item types that should not ever be recycled, only generated (like modsuits) + var/static/list/recycle_blacklist = typecacheof(list( + /obj/item/mod/control/pre_equipped, + )) /datum/controller/subsystem/wardrobe/Initialize() setup_callbacks() @@ -207,11 +211,17 @@ SUBSYSTEM_DEF(wardrobe) order_list[queued_type] = amount +/// Take an existing object, and recycle it if we are allowed to by stashing it back into our storage +/datum/controller/subsystem/wardrobe/proc/recycle_object(obj/item/object) + // Don't restock blacklisted items, instead just delete them + if(is_type_in_typecache(object, recycle_blacklist)) + qdel(object) + return + stash_object(object) + /// Take an existing object, and insert it into our storage /// If we can't or won't take it, it's deleted. You do not own this object after passing it in /datum/controller/subsystem/wardrobe/proc/stash_object(obj/item/object) - if(object.item_flags & DO_NOT_WARDROBE) - return var/object_type = object.type var/list/master_info = canon_minimum[object_type] // I will not permit objects you didn't reserve ahead of time diff --git a/code/modules/mob/living/carbon/human/dummy.dm b/code/modules/mob/living/carbon/human/dummy.dm index 430d9bc3da1..1d4301c688f 100644 --- a/code/modules/mob/living/carbon/human/dummy.dm +++ b/code/modules/mob/living/carbon/human/dummy.dm @@ -33,14 +33,14 @@ INITIALIZE_IMMEDIATE(/mob/living/carbon/human/dummy) var/obj/item/organ/current_organ = get_organ_slot(slot) //Time to cache it lads if(current_organ) current_organ.Remove(src, special = TRUE) //Please don't somehow kill our dummy - SSwardrobe.stash_object(current_organ) + SSwardrobe.recycle_object(current_organ) var/datum/species/current_species = dna.species for(var/organ_path in current_species.mutant_organs) var/obj/item/organ/current_organ = get_organ_by_type(organ_path) if(current_organ) current_organ.Remove(src, special = TRUE) //Please don't somehow kill our dummy - SSwardrobe.stash_object(current_organ) + SSwardrobe.recycle_object(current_organ) //Instead of just deleting our equipment, we save what we can and reinsert it into SSwardrobe's store //Hopefully this makes preference reloading not the worst thing ever @@ -55,8 +55,6 @@ INITIALIZE_IMMEDIATE(/mob/living/carbon/human/dummy) if(!isitem(checking)) //What the fuck are you on to_nuke += checking continue - if(checking.item_flags & DO_NOT_WARDROBE) // Skip any items like MOD parts, which are created in the contents of a stashed item and should not be destroyed - continue var/list/contents = checking.contents if(length(contents)) @@ -68,7 +66,7 @@ INITIALIZE_IMMEDIATE(/mob/living/carbon/human/dummy) if(ismob(checking.loc)) var/mob/checkings_owner = checking.loc checkings_owner.temporarilyRemoveItemFromInventory(checking, TRUE) //Clear out of there yeah? - SSwardrobe.stash_object(checking) + SSwardrobe.recycle_object(checking) for(var/obj/item/delete as anything in to_nuke) qdel(delete) diff --git a/code/modules/mod/mod_theme.dm b/code/modules/mod/mod_theme.dm index 54a6eb7fbf7..851a6e93530 100644 --- a/code/modules/mod/mod_theme.dm +++ b/code/modules/mod/mod_theme.dm @@ -126,7 +126,6 @@ part.set_armor(armor_type) part.resistance_flags = resistance_flags part.flags_1 |= atom_flags //flags like initialization or admin spawning are here, so we cant set, have to add - part.item_flags |= DO_NOT_WARDROBE part.heat_protection = NONE part.cold_protection = NONE part.max_heat_protection_temperature = max_heat_protection_temperature