forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## About The Pull Request Добавляет поддержку declent_ru() для реагентов. Чтобы не было рантаймов :aga:
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
modular_bandastation/translations/code/ru_names/ru_name_reagents.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |