diff --git a/code/modules/loadout/loadout_categories.dm b/code/modules/loadout/loadout_categories.dm index ae9aca7e9146f..c64a564b2ecb6 100644 --- a/code/modules/loadout/loadout_categories.dm +++ b/code/modules/loadout/loadout_categories.dm @@ -53,17 +53,13 @@ return all_items /// Returns a list of all /datum/loadout_items in this category, formatted for UI use. Only ran once. -/datum/loadout_category/proc/items_to_ui_data(client/user) as /list // SKYRAT EDIT CHANGE - Added user poaram +/datum/loadout_category/proc/items_to_ui_data() as /list if(!length(associated_items)) return list() var/list/formatted_list = list() for(var/datum/loadout_item/item as anything in associated_items) - // SKYRAT EDIT ADDITION - if(item.ckeywhitelist && !(user?.ckey in item.ckeywhitelist)) - continue - // SKYRAT EDIT END var/list/item_data = item.to_ui_data() UNTYPED_LIST_ADD(formatted_list, item_data) diff --git a/code/modules/loadout/loadout_items.dm b/code/modules/loadout/loadout_items.dm index e02d15e7a44f3..5ad95840d8278 100644 --- a/code/modules/loadout/loadout_items.dm +++ b/code/modules/loadout/loadout_items.dm @@ -42,7 +42,7 @@ GLOBAL_LIST_INIT(all_loadout_categories, init_loadout_categories()) var/can_be_greyscale = FALSE /// Whether this item can be renamed. /// I recommend you apply this sparingly becuase it certainly can go wrong (or get reset / overridden easily) - var/can_be_named = FALSE + var/can_be_named = TRUE // SKYRAT EDIT /// Whether this item can be reskinned. /// Only works if the item has a "unique reskin" list set. var/can_be_reskinned = FALSE @@ -315,6 +315,14 @@ GLOBAL_LIST_INIT(all_loadout_categories, init_loadout_categories()) formatted_item["reskins"] = get_reskin_options() formatted_item["icon"] = ui_icon formatted_item["icon_state"] = ui_icon_state + + // SKYRAT EDIT BEGIN - Extra loadout stuff + formatted_item["ckey_whitelist"] = ckeywhitelist + formatted_item["donator_only"] = donator_only + formatted_item["restricted_roles"] = restricted_roles + formatted_item["blacklisted_roles"] = restricted_roles + // SKYRAT EDIT END + return formatted_item /** @@ -342,6 +350,9 @@ GLOBAL_LIST_INIT(all_loadout_categories, init_loadout_categories()) if(donator_only) displayed_text += "Donator only" + if(ckeywhitelist) + displayed_text += "Unique" + if(restricted_roles || blacklisted_roles) displayed_text += "Role restricted" diff --git a/code/modules/loadout/loadout_menu.dm b/code/modules/loadout/loadout_menu.dm index f01d4215c69fe..0fdbe81ee81f2 100644 --- a/code/modules/loadout/loadout_menu.dm +++ b/code/modules/loadout/loadout_menu.dm @@ -73,15 +73,15 @@ continue if(!item.category.handle_duplicate_entires(src, item, selected_item, loadout_datums)) return - // SKYRAT EDIT ADDITION - if(item.ckeywhitelist && !(preferences?.parent?.ckey in item.ckeywhitelist)) - to_chat(preferences.parent, span_warning("You cannot select this item!")) - return + // SKYRAT EDIT ADDITION + if(!isnull(selected_item.ckeywhitelist) && !(preferences?.parent?.ckey in selected_item.ckeywhitelist)) + to_chat(preferences.parent, span_warning("You cannot select this item!")) + return - if(item.donator_only && !GLOB.donator_list[preferences?.parent?.ckey]) - to_chat(preferences.parent, span_warning("That item is for donators only.")) - return - // SKYRAT EDIT END + if(!isnull(selected_item.donator_only) && !GLOB.donator_list[preferences?.parent?.ckey]) + to_chat(preferences.parent, span_warning("This item is for donators only.")) + return + // SKYRAT EDIT END LAZYSET(loadout, selected_item.item_path, list()) preferences.update_preference(GLOB.preference_entries[/datum/preference/loadout], loadout) @@ -111,6 +111,11 @@ /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() @@ -121,8 +126,8 @@ "name" = category.category_name, "category_icon" = category.category_ui_icon, "category_info" = category.category_info, - "contents" = category.items_to_ui_data(preferences?.parent), - ) // SKYRAT EDIT CHANGE - items_to_ui_data(preferences?.parent) + "contents" = category.items_to_ui_data(), + ) UNTYPED_LIST_ADD(loadout_tabs, cat_data) data["loadout_tabs"] = loadout_tabs diff --git a/modular_skyrat/master_files/code/modules/loadout/categories/gloves.dm b/modular_skyrat/master_files/code/modules/loadout/categories/gloves.dm index 190c7a1db44e3..2de958137c9e4 100644 --- a/modular_skyrat/master_files/code/modules/loadout/categories/gloves.dm +++ b/modular_skyrat/master_files/code/modules/loadout/categories/gloves.dm @@ -60,7 +60,7 @@ /datum/loadout_item/gloves/yellow name = "Yellow Gloves" item_path = /obj/item/clothing/gloves/color/ffyellow - additional_displayed_text = list("NON-INSULATING - This item is purely cosmetic and provide no shock insulation.") + additional_displayed_text = list("NON-INSULATING") /datum/loadout_item/gloves/white name = "White Gloves" diff --git a/modular_skyrat/master_files/code/modules/loadout/categories/toys.dm b/modular_skyrat/master_files/code/modules/loadout/categories/toys.dm index e6315cda2dcc0..2177efa0faca0 100644 --- a/modular_skyrat/master_files/code/modules/loadout/categories/toys.dm +++ b/modular_skyrat/master_files/code/modules/loadout/categories/toys.dm @@ -6,6 +6,7 @@ /datum/loadout_item/toys abstract_type = /datum/loadout_item/toys + can_be_named = TRUE /datum/loadout_item/toys/bee name = "Bee Plushie" diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/data.ts b/tgui/packages/tgui/interfaces/PreferencesMenu/data.ts index 5e54245eaf40c..a9471b22d4446 100644 --- a/tgui/packages/tgui/interfaces/PreferencesMenu/data.ts +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/data.ts @@ -234,6 +234,8 @@ export type PreferencesMenuData = { quirks_balance: number; positive_quirk_count: number; species_restricted_jobs?: string[]; + ckey: string; + is_donator: BooleanLike; // SKYRAT EDIT END keybindings: Record; overflow_role: string; diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/loadout/ItemDisplay.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/loadout/ItemDisplay.tsx index 11b20b0097963..a7a3f9b5e0146 100644 --- a/tgui/packages/tgui/interfaces/PreferencesMenu/loadout/ItemDisplay.tsx +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/loadout/ItemDisplay.tsx @@ -84,6 +84,20 @@ export const ItemDisplay = (props: { {info} ))} + { + // SKYRAT EDIT START - EXPANDED LOADOUT + + {ShouldDisplayJobRestriction(item) && ItemJobRestriction(item)} + {ShouldDisplayPlayerRestriction(item) && + ItemPlayerRestriction(item)} + + + /* SKYRAT EDIT END */ + } )} @@ -94,9 +108,10 @@ export const ItemDisplay = (props: { const ItemListDisplay = (props: { items: LoadoutItem[] }) => { const { data } = useBackend(); const { loadout_list } = data.character_preferences.misc; + const itemList = FilterItemList(props.items); // SKYRAT EDIT - EXPANDED LOADOUT return ( - {props.items.map((item) => ( + {itemList.map((item /* SKYRAT EDIT : {props.items.map((item) => (*/) => ( { ); }; +// SKYRAT EDIT START - EXPANDED LOADOUT +const FilterItemList = (items: LoadoutItem[]) => { + const { data } = useBackend(); + const { is_donator } = data; + const ckey = data.ckey; + + return items.filter((item: LoadoutItem) => { + if (item.ckey_whitelist && item.ckey_whitelist.indexOf(ckey) === -1) { + return false; + } + if (item.donator_only && !is_donator) { + return false; + } + return true; + }); +}; +const ShouldDisplayPlayerRestriction = (item: LoadoutItem) => { + if (item.ckey_whitelist || item.restricted_species) { + return true; + } + + return false; +}; + +const ShouldDisplayJobRestriction = (item: LoadoutItem) => { + if (item.restricted_roles || item.blacklisted_roles) { + return true; + } + + return false; +}; + +const ItemPlayerRestriction = (item: LoadoutItem) => { + let restrictions: string[] = []; + + if (item.ckey_whitelist) { + restrictions.push('CKEY Whitelist: ' + item.ckey_whitelist.join(', ')); + } + + if (item.restricted_species) { + restrictions.push( + 'Species Whitelist: ' + item.restricted_species.join(', '), + ); + } + + const tooltip = restrictions.join(', '); + + return ( +