From 04234f70d0ed49cf3ba28e4cac9edb4a22fbb00a Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Sun, 12 Apr 2026 18:19:40 -0400 Subject: [PATCH] Revenge Of The Pants (#22205) I have actually tested this PR to verify it. Thanks to Sentry for finally giving me the data point needed to figure out where the hell the bug was coming from. It turns out the culprit for The Pants Hard Delete was people accidentally saving Abstract Pants in their loadout, which would immediately produce a runtime error when the game attempts to add them to the chargen dummy. image --- .../preference_setup/loadout/gear_tweaks.dm | 27 ++++++++++++++----- .../preference_setup/loadout/items/pants.dm | 2 +- .../loadout/items/xeno/tajara.dm | 2 +- .../hellfirejag-final-pants-fix.yml | 4 +++ 4 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 html/changelogs/hellfirejag-final-pants-fix.yml diff --git a/code/modules/client/preference_setup/loadout/gear_tweaks.dm b/code/modules/client/preference_setup/loadout/gear_tweaks.dm index 31d7b336dce..998ac37606b 100644 --- a/code/modules/client/preference_setup/loadout/gear_tweaks.dm +++ b/code/modules/client/preference_setup/loadout/gear_tweaks.dm @@ -145,7 +145,9 @@ Path adjustment return "Type: [metadata]" /datum/gear_tweak/path/get_default() - return valid_paths[1] + for(var/key in valid_paths) + return key + return null /datum/gear_tweak/path/get_random() return pick(valid_paths) @@ -154,9 +156,15 @@ Path adjustment return tgui_input_list(user, "Choose a type.", "Character Preference", valid_paths, metadata) /datum/gear_tweak/path/tweak_gear_data(var/metadata, var/datum/gear_data/gear_data) - if(!(metadata in valid_paths)) + if(metadata in valid_paths) + gear_data.path = valid_paths[metadata] return - gear_data.path = valid_paths[metadata] + + // Fallback for when metadata is actually the path (value) instead of the name (key) + for(var/key in valid_paths) + if(valid_paths[key] == metadata) + gear_data.path = metadata + return /* Faction-based Path adjustment @@ -164,10 +172,17 @@ Same as the adjustment above, but the associated value is a list with the first */ /datum/gear_tweak/path/faction/tweak_gear_data(var/metadata, var/datum/gear_data/gear_data) - if(!(metadata in valid_paths)) + if(metadata in valid_paths) + gear_data.path = valid_paths[metadata][1] + gear_data.faction_requirement = valid_paths[metadata][2] return - gear_data.path = valid_paths[metadata][1] - gear_data.faction_requirement = valid_paths[metadata][2] + + // Fallback for when metadata is actually the path (value) instead of the name (key) + for(var/key in valid_paths) + if(valid_paths[key][1] == metadata) + gear_data.path = metadata + gear_data.faction_requirement = valid_paths[key][2] + return /* Content adjustment diff --git a/code/modules/client/preference_setup/loadout/items/pants.dm b/code/modules/client/preference_setup/loadout/items/pants.dm index e5fa56ccf68..a37fe8eeec3 100644 --- a/code/modules/client/preference_setup/loadout/items/pants.dm +++ b/code/modules/client/preference_setup/loadout/items/pants.dm @@ -5,7 +5,7 @@ ABSTRACT_TYPE(/datum/gear/pants) /datum/gear/pants/trousers display_name = "pants and shorts selection" description = "A selection of pants and shorts." - path = /obj/item/clothing/pants + path = /obj/item/clothing/pants/black /datum/gear/pants/trousers/New() ..() diff --git a/code/modules/client/preference_setup/loadout/items/xeno/tajara.dm b/code/modules/client/preference_setup/loadout/items/xeno/tajara.dm index e997dcbe7ce..43fa6704cd9 100644 --- a/code/modules/client/preference_setup/loadout/items/xeno/tajara.dm +++ b/code/modules/client/preference_setup/loadout/items/xeno/tajara.dm @@ -5,7 +5,7 @@ ABSTRACT_TYPE(/datum/gear/shoes/tajara) /datum/gear/shoes/tajara/boots display_name = "tajaran boots selection" description = "A selection of shoes and boots fitted for Tajara." - path = /obj/item/clothing/shoes/tajara + path = /obj/item/clothing/shoes/jackboots/tajara whitelisted = list(SPECIES_TAJARA, SPECIES_TAJARA_ZHAN, SPECIES_TAJARA_MSAI) sort_category = "Xenowear - Tajara" diff --git a/html/changelogs/hellfirejag-final-pants-fix.yml b/html/changelogs/hellfirejag-final-pants-fix.yml new file mode 100644 index 00000000000..c2cb5f34b7f --- /dev/null +++ b/html/changelogs/hellfirejag-final-pants-fix.yml @@ -0,0 +1,4 @@ +author: Hellfirejag +delete-after: True +changes: + - bugfix: "Finally fixed the pants memory leak. It is no longer possible to accidentally put Abstract (not real) pants in your loadout."