Files
Alexis 21b4095dfd [MDB IGNORE] [IDB IGNORE] Upstream Sync - 04/17/2026 (#5453)
Upstream 04/17/2026

fixes https://github.com/Bubberstation/Bubberstation/issues/5549

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com>
Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com>
Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com>
Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com>
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com>
Co-authored-by: loganuk <fakeemail123@aol.com>
Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com>
Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com>
Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com>
Co-authored-by: Lucy <lucy@absolucy.moe>
Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com>
Co-authored-by: Isratosh <Isratosh@hotmail.com>
Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com>
Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com>
Co-authored-by: Alexander V. <volas@ya.ru>
Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com>
Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Tim <timothymtorres@gmail.com>
Co-authored-by: Iamgoofball <iamgoofball@gmail.com>
Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com>
Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com>
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com>
Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com>
Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com>
Co-authored-by: Josh <josh.adam.powell@gmail.com>
Co-authored-by: Josh Powell <josh.powell@softwire.com>
Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com>
Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com>
Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com>
Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
2026-05-16 00:56:00 +02:00

116 lines
4.1 KiB
Plaintext

/// Handle the migrations necessary from pre-tgui prefs to post-tgui prefs
/datum/preferences/proc/migrate_preferences_to_tgui_prefs_menu()
migrate_antagonists()
migrate_key_bindings()
/// Handle the migrations necessary from pre-tgui prefs to post-tgui prefs, for characters
/datum/preferences/proc/migrate_character_to_tgui_prefs_menu()
migrate_randomization()
// Key bindings used to be "key" -> list("action"),
// such as "X" -> list("swap_hands").
// This made it impossible to determine any order, meaning placing a new
// hotkey would produce non-deterministic order.
// tgui prefs menu moves this over to "swap_hands" -> list("X").
/datum/preferences/proc/migrate_key_bindings()
var/new_key_bindings = list()
for (var/unbound_hotkey in key_bindings[UNBOUND_KEY])
new_key_bindings[unbound_hotkey] = list()
for (var/hotkey in key_bindings)
if (hotkey == UNBOUND_KEY)
continue
for (var/keybind in key_bindings[hotkey])
if (keybind in new_key_bindings)
new_key_bindings[keybind] |= hotkey
else
new_key_bindings[keybind] = list(hotkey)
key_bindings = new_key_bindings
// Before tgui preferences menu, "traitor" would handle both roundstart, midround, and latejoin.
// These were split apart.
/datum/preferences/proc/migrate_antagonists()
migrate_antagonist(ROLE_MALF, list(ROLE_MALF_MIDROUND))
migrate_antagonist(ROLE_OPERATIVE, list(ROLE_OPERATIVE_MIDROUND, ROLE_LONE_OPERATIVE))
migrate_antagonist(ROLE_REV_HEAD, list(ROLE_PROVOCATEUR))
migrate_antagonist(ROLE_TRAITOR, list(ROLE_SYNDICATE_INFILTRATOR, ROLE_SLEEPER_AGENT))
migrate_antagonist(ROLE_WIZARD, list(ROLE_WIZARD_MIDROUND))
// If you have an antagonist enabled, it will add the alternative preferences for said antag in be_special.
// will_exist is the role we check if enabled, to_add list is the antagonists we add onto the be_special list.
/datum/preferences/proc/migrate_antagonist(will_exist, list/to_add)
if (will_exist in be_special)
for (var/add in to_add)
be_special += add
// Randomization used to be an assoc list of fields to TRUE.
// Antagonist randomization was not even available to all options.
// tgui prefs menu changes from list("random_socks" = TRUE, "random_name_antag" = TRUE)
// to list("socks" = "enabled", "name" = "antag")
// as well as removing anything that was set to FALSE, as this can be extrapolated.
/datum/preferences/proc/migrate_randomization()
var/static/list/random_settings = list(
"random_age" = "age",
"random_backpack" = "backpack",
"random_eye_color" = "eye_color",
"random_facial_hair_color" = "facial_hair_color",
"random_facial_hairstyle" = "facial_hairstyle",
"random_gender" = "gender",
"random_hair_color" = "hair_color",
"random_hairstyle" = "hairstyle",
"random_jumpsuit_style" = "jumpsuit_style",
"random_skin_tone" = "skin_tone",
"random_socks" = "socks",
"random_species" = "species",
"random_undershirt" = "undershirt",
"random_underwear" = "underwear",
"random_underwear_color" = "underwear_color",
)
var/static/list/random_antag_settings = list(
"random_age_antag" = "age",
"random_gender_antag" = "gender",
"random_name_antag" = "name",
)
var/list/new_randomise = list()
for (var/old_setting in random_settings)
if (randomise[old_setting])
new_randomise[random_settings[old_setting]] = RANDOM_ENABLED
for (var/old_antag_setting in random_antag_settings)
if (randomise[old_antag_setting])
new_randomise[random_settings[old_antag_setting]] = RANDOM_ANTAG_ONLY
migrate_randomization_to_new_pref(
/datum/preference/choiced/random_body,
"random_body",
"random_body_antag",
)
migrate_randomization_to_new_pref(
/datum/preference/choiced/random_name,
"random_name",
"random_name_antag",
)
if (randomise["random_hardcore"])
write_preference(GLOB.preference_entries[/datum/preference/toggle/random_hardcore], TRUE)
randomise = new_randomise
/datum/preferences/proc/migrate_randomization_to_new_pref(
preference_type,
key,
key_antag,
)
if (randomise[key_antag])
write_preference(GLOB.preference_entries[preference_type], RANDOM_ANTAG_ONLY)
else if (randomise[key])
write_preference(GLOB.preference_entries[preference_type], RANDOM_ENABLED)