From adf38be3e93eaef768e66f3526c43d0a2102c9a9 Mon Sep 17 00:00:00 2001 From: larentoun <31931237+larentoun@users.noreply.github.com> Date: Fri, 29 Nov 2024 22:11:05 +0300 Subject: [PATCH] Add support for english search in fabricators (#827) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## About The Pull Request Не модульно никак --- code/game/machinery/autolathe.dm | 1 + code/modules/research/machinery/_production.dm | 1 + code/modules/vehicles/mecha/mech_fabricator.dm | 1 + .../translations/code/ru_names/ru_name_design.dm | 2 ++ .../tgui/interfaces/Fabrication/DesignBrowser.tsx | 14 ++++++++++---- tgui/packages/tgui/interfaces/Fabrication/Types.ts | 7 +++++++ 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 06c88f4749e1f..cfe2ba137cbb1 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -166,6 +166,7 @@ var/icon_size = spritesheet.icon_size_id(design.id) var/list/design_data = list( "name" = design.name, + "original_name" = design.original_name, // BANDASTATION EDIT - Design Translate "desc" = design.get_description(), "cost" = cost, "id" = design.id, diff --git a/code/modules/research/machinery/_production.dm b/code/modules/research/machinery/_production.dm index c9988977fe4a4..39c03542fc3a7 100644 --- a/code/modules/research/machinery/_production.dm +++ b/code/modules/research/machinery/_production.dm @@ -253,6 +253,7 @@ var/icon_size = spritesheet.icon_size_id(design.id) designs[design.id] = list( "name" = design.name, + "original_name" = design.original_name, // BANDASTATION EDIT - Design Translate "desc" = design.get_description(), "cost" = cost, "id" = design.id, diff --git a/code/modules/vehicles/mecha/mech_fabricator.dm b/code/modules/vehicles/mecha/mech_fabricator.dm index ad28886d99f22..5320929f73db3 100644 --- a/code/modules/vehicles/mecha/mech_fabricator.dm +++ b/code/modules/vehicles/mecha/mech_fabricator.dm @@ -394,6 +394,7 @@ var/icon_size = spritesheet.icon_size_id(design.id) designs[design.id] = list( "name" = design.name, + "original_name" = design.original_name, // BANDASTATION EDIT - Design Translate "desc" = design.get_description(), "cost" = cost, "id" = design.id, diff --git a/modular_bandastation/translations/code/ru_names/ru_name_design.dm b/modular_bandastation/translations/code/ru_names/ru_name_design.dm index ff31791066fc4..1bb0bcbfa58c0 100644 --- a/modular_bandastation/translations/code/ru_names/ru_name_design.dm +++ b/modular_bandastation/translations/code/ru_names/ru_name_design.dm @@ -1,7 +1,9 @@ /datum/design + var/original_name /datum/design/New() . = ..() + original_name = name name = update_to_ru() || name /datum/design/proc/update_to_ru() diff --git a/tgui/packages/tgui/interfaces/Fabrication/DesignBrowser.tsx b/tgui/packages/tgui/interfaces/Fabrication/DesignBrowser.tsx index e4951bd0041d2..d7032b48ea125 100644 --- a/tgui/packages/tgui/interfaces/Fabrication/DesignBrowser.tsx +++ b/tgui/packages/tgui/interfaces/Fabrication/DesignBrowser.tsx @@ -277,10 +277,16 @@ export const DesignBrowser = ( Object.values(root.descendants), (design: T) => design.name, ) - .filter((design) => - design.name - .toLowerCase() - .includes(searchText.toLowerCase()), + // BANDASTATION EDIT START - Design Translate + .filter( + (design) => + design.name + .toLowerCase() + .includes(searchText.toLowerCase()) || + (design.original_name || design.name) + .toLowerCase() + .includes(searchText.toLowerCase()), + // BANDASTATION EDIT END ) .map((design) => buildRecipeElement( diff --git a/tgui/packages/tgui/interfaces/Fabrication/Types.ts b/tgui/packages/tgui/interfaces/Fabrication/Types.ts index f214252ef70aa..db7403017755d 100644 --- a/tgui/packages/tgui/interfaces/Fabrication/Types.ts +++ b/tgui/packages/tgui/interfaces/Fabrication/Types.ts @@ -40,6 +40,13 @@ export type Design = { */ name: string; + // BANDASTATION EDIT START - Design Translate + /** + * The original name of the design. + */ + original_name: string; + // BANDASTATION EDIT END + /** * A human-readable description of the design. */