From 473cf50271aee31bcbe7b99d28b6a1f1bf3e7af4 Mon Sep 17 00:00:00 2001 From: Roxy <75404941+TealSeer@users.noreply.github.com> Date: Sat, 10 May 2025 18:37:12 -0400 Subject: [PATCH] Fix donator loadout items being removed (#3779) ## About The Pull Request Is this user a donator validation was being done in the `deserialize` proc for the pref which is bad because if someone was auto reconnected to the server after restart and joins right as it restarts it'll be run before the ranks system has loaded meaning this check will always fail and remove the item from their loadout. Moved the validation to when the player spawns in, so ranks is guaranteed to be loaded. Also changed something that was checking the donator list directly to use the proc for it. Also removed two unused variables that got deprecated in #3747 ## Why It's Good For The Game Fixes #3773 ## Proof Of Testing Tested it on a local before and after ## Changelog :cl: fix: fixed donator-only loadout items disappearing from donator's loadouts /:cl: --- code/modules/loadout/loadout_helpers.dm | 5 +++++ code/modules/loadout/loadout_menu.dm | 7 +------ code/modules/loadout/loadout_preference.dm | 2 -- tgui/packages/tgui/interfaces/PreferencesMenu/types.ts | 2 -- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/code/modules/loadout/loadout_helpers.dm b/code/modules/loadout/loadout_helpers.dm index 2a1a709e06f..fc1bd099684 100644 --- a/code/modules/loadout/loadout_helpers.dm +++ b/code/modules/loadout/loadout_helpers.dm @@ -51,6 +51,11 @@ to_chat(preference_source.parent, span_warning("You were unable to get a loadout item ([initial(item.item_path.name)]) due to species restrictions!")) continue + if(item.donator_only && !SSplayer_ranks.is_donator(preference_source?.parent)) + if(preference_source.parent) + to_chat(preference_source.parent, span_warning("You were unable to get a loadout item ([initial(item.item_path.name)]) due to donator restrictions!")) + continue + if(item.ckeywhitelist && !(preference_source?.parent?.ckey in item.ckeywhitelist)) // Sanity checking if(preference_source.parent) to_chat(preference_source.parent, span_warning("You were unable to get a loadout item ([initial(item.item_path.name)]) due to CKEY restrictions!")) diff --git a/code/modules/loadout/loadout_menu.dm b/code/modules/loadout/loadout_menu.dm index c1b9414eb6d..6abf35c2aec 100644 --- a/code/modules/loadout/loadout_menu.dm +++ b/code/modules/loadout/loadout_menu.dm @@ -80,7 +80,7 @@ to_chat(preferences.parent, span_warning("You cannot select this item!")) return - if(selected_item.donator_only && !GLOB.donator_list[preferences?.parent?.ckey]) + if(selected_item.donator_only && !SSplayer_ranks.is_donator(preferences.parent)) to_chat(preferences.parent, span_warning("This item is for donators only.")) return // SKYRAT EDIT END @@ -113,11 +113,6 @@ /datum/preference_middleware/loadout/get_ui_static_data(mob/user) var/list/data = list() data["loadout_preview_view"] = preferences.character_preview_view.assigned_map - // SKYRAT EDIT START - EXPANDED LOADOUT - data["ckey"] = user.ckey - if(SSplayer_ranks.is_donator(user.client)) - data["is_donator"] = TRUE - // SKYRAT EDIT END return data /datum/preference_middleware/loadout/get_constant_data() diff --git a/code/modules/loadout/loadout_preference.dm b/code/modules/loadout/loadout_preference.dm index 4ba2a3ccdd7..06e71ea96b5 100644 --- a/code/modules/loadout/loadout_preference.dm +++ b/code/modules/loadout/loadout_preference.dm @@ -58,8 +58,6 @@ var/datum/loadout_item/loadout_item = GLOB.all_loadout_datums[real_path] if(loadout_item?.ckeywhitelist && !(owner_client?.ckey in loadout_item.ckeywhitelist)) continue - if(loadout_item?.donator_only && !GLOB.donator_list[owner_client?.ckey]) - continue // SKYRAT EDIT END // Set into sanitize list using converted path key diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/types.ts b/tgui/packages/tgui/interfaces/PreferencesMenu/types.ts index 47cbb1e84d6..490b3f80adf 100644 --- a/tgui/packages/tgui/interfaces/PreferencesMenu/types.ts +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/types.ts @@ -236,8 +236,6 @@ export type PreferencesMenuData = { quirks_balance: number; positive_quirk_count: number; species_restricted_jobs?: string[]; - ckey: string; - is_donator: BooleanLike; // SKYRAT EDIT END keybindings: Record;