Skip to content

Commit

Permalink
Reagents ru-name support (#785)
Browse files Browse the repository at this point in the history
## About The Pull Request
Добавляет поддержку declent_ru() для реагентов. Чтобы не было рантаймов
:aga:
  • Loading branch information
larentoun authored Nov 21, 2024
1 parent 985a69c commit 5e556d9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions modular_bandastation/translations/_translations.dme
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
#include "code/ru_names/ru_name_base.dm"
#include "code/ru_names/ru_name_materials.dm"
#include "code/ru_names/ru_name_orderables.dm"
#include "code/ru_names/ru_name_reagents.dm"

#include "code/~undefs.dm"
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/datum/reagent
/// List consists of ("name", "именительный", "родительный", "дательный", "винительный", "творительный", "предложный", "gender")
var/list/ru_names

/// Необходимо использовать ПЕРЕД изменением var/name, и использовать только этот прок для изменения в рантайме склонений
/datum/reagent/ru_names_rename(list/new_list)
if(!length(new_list))
return
ru_names = new_list

/datum/reagent/New()
. = ..()
ru_names_rename(ru_names_toml(LOWER_TEXT(name)))

/datum/reagent/declent_ru(case_id, list/ru_names_override)
var/list/list_to_use = ru_names_override || ru_names
if(length(list_to_use) && list_to_use["base"] == name && list_to_use[case_id])
return list_to_use[case_id]
if(case_id == "gender")
return
return name

0 comments on commit 5e556d9

Please sign in to comment.