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.
Adds declent support for materials (#586)
## About The Pull Request Берут имена от их стаков
- Loading branch information
Showing
8 changed files
with
59 additions
and
41 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
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
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
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 @@ | ||
#define RU_NAMES_LENGTH 7 // 6 падежей, 1 base |
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
36 changes: 36 additions & 0 deletions
36
modular_bandastation/translations/code/ru_names/ru_name_base.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,36 @@ | ||
/atom | ||
// code\__DEFINES\bandastation\pronouns.dm for more info | ||
/// RU_NAMES_LIST_INIT("name", "именительный", "родительный", "дательный", "винительный", "творительный", "предложный") | ||
var/list/ru_names | ||
var/ru_name_base | ||
var/ru_name_nominative | ||
var/ru_name_genitive | ||
var/ru_name_dative | ||
var/ru_name_accusative | ||
var/ru_name_instrumental | ||
var/ru_name_prepositional | ||
|
||
/datum/proc/ru_names_rename(list/new_list) | ||
SHOULD_CALL_PARENT(FALSE) | ||
CRASH("Unimplemented proc/ru_names_rename() was used") | ||
|
||
/// Необходимо использовать ПЕРЕД изменением var/name, и использовать только этот прок для изменения в рантайме склонений | ||
/atom/ru_names_rename(list/new_list) | ||
if(length(new_list) != RU_NAMES_LENGTH) | ||
CRASH("proc/ru_names_rename() received incorrect list!") | ||
RU_NAMES_LIST_INIT(new_list["base"], new_list[NOMINATIVE], new_list[GENITIVE], new_list[DATIVE], new_list[ACCUSATIVE], new_list[INSTRUMENTAL], new_list[PREPOSITIONAL]) | ||
|
||
/** | ||
* Процедура выбора правильного падежа для любого предмета, если у него указан словарь «ru_names», примерно такой: | ||
* RU_NAMES_LIST_INIT("jaws of life", "челюсти жизни", "челюстей жизни", "челюстям жизни", "челюсти жизни", "челюстями жизни", "челюстях жизни") | ||
*/ | ||
/datum/proc/declent_ru(case_id, list/ru_names_override) | ||
SHOULD_CALL_PARENT(FALSE) | ||
CRASH("Unimplemented proc/declent_ru() was used") | ||
|
||
/atom/declent_ru(case_id, list/ru_names_override) | ||
var/list/list_to_use = ru_names_override || ru_names | ||
if(length(list_to_use)) | ||
if(list_to_use[case_id] && list_to_use["base"] == name) | ||
return list_to_use[case_id] || name | ||
return name |
9 changes: 9 additions & 0 deletions
9
modular_bandastation/translations/code/ru_names/ru_name_materials.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,9 @@ | ||
/datum/material/declent_ru(case_id, list/ru_names_override) | ||
if(!ispath(sheet_type)) | ||
CRASH("Sheet type couldn't be declented because it's not a path!") | ||
var/atom/sheet = sheet_type | ||
var/list/list_to_use = ru_names_override || RU_NAMES_LIST(sheet::ru_name_base, sheet::ru_name_nominative, sheet::ru_name_genitive, sheet::ru_name_dative, sheet::ru_name_accusative, sheet::ru_name_instrumental, sheet::ru_name_prepositional) | ||
if(length(list_to_use)) | ||
if(list_to_use[case_id] && list_to_use["base"] == name) | ||
return list_to_use[case_id] || name | ||
return name |
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 @@ | ||
#undef RU_NAMES_LENGTH |