mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-14 11:42:27 +00:00
* Allows languages to weight the likelihood of certain syllables, refactors certain code related to pick_weight() (#71275) ## About The Pull Request This PR does the following: - Defines a new proc in __HELPERS/_lists.dm called `pick_weight_recursive()`. This is the code from `/obj/effect/spawner/random/` that allows for nested weighted lists, moved to its own proc. - Replaces explicit code in spawners/random.dm with calls to `pick_weight_recursive()` where appropriate - Deletes the redundant (and barely used) proc `/obj/item/loot_table_maker/proc/pick_loot`, as this was equivalent to `pick_weight_recursive()` - Moves the global proc `fill_with_ones()` from spawners/random.dm to __HELPERS/_lists.dm - Replaces `pick()` in language syllable selection with `pick_weight_recursive()`, allowing languages to define syllable weights or use nested lists of syllables. - Reformats Galactic Common to use nested lists of syllables, allowing English and Chinese syllables to occur at equal frequency despite having different numbers of each. ## Why It's Good For The Game Allowing languages to define syllable weights and nested groups of syllables is a relatively small change that greatly expands what you can do with them. In addition to making Galactic Common look nicer in code, this change also allows for the easy creation of languages with highly uneven syllable distributions (including ultra-rare secret syllables, perhaps) or the quick creation of pidgin languages that combine multiple syllable sets. Using a new proc simplifies spawner code by reducing repetition. Making it global allows for other code to easily implement the same flexible and elegant system of nested lists that spawners already use. ## Changelog 🆑 refactor: defines a new global proc, pick_weight_recursive() code: languages can weight syllables, and galactic common's definition is easier to look at /🆑 Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com> * Allows languages to weight the likelihood of certain syllables, refactors certain code related to pick_weight() Co-authored-by: skylord-a52 <skylord-a52@users.noreply.github.com> Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>
57 lines
4.1 KiB
Plaintext
57 lines
4.1 KiB
Plaintext
// 'basic' language; spoken by default.
|
|
/datum/language/common
|
|
name = "Galactic Common"
|
|
desc = "The common galactic tongue."
|
|
key = "0"
|
|
flags = TONGUELESS_SPEECH | LANGUAGE_HIDE_ICON_IF_UNDERSTOOD
|
|
default_priority = 100
|
|
|
|
icon_state = "galcom"
|
|
|
|
//Syllable Lists
|
|
/*
|
|
This list really long, mainly because I can't make up my mind about which mandarin syllables should be removed,
|
|
and the english syllables had to be duplicated so that there is roughly a 50-50 weighting.
|
|
|
|
Sources:
|
|
http://www.sttmedia.com/syllablefrequency-english
|
|
http://www.chinahighlights.com/travelguide/learning-chinese/pinyin-syllables.htm
|
|
*/
|
|
/datum/language/common/syllables = list(
|
|
// each sublist has an equal chance of being picked, so each syllable has an equal chance of being english or chinese
|
|
list(
|
|
"a", "ai", "an", "ang", "ao", "ba", "bai", "ban", "bang", "bao", "bei", "ben", "beng", "bi", "bian", "biao",
|
|
"bie", "bin", "bing", "bo", "bu", "ca", "cai", "can", "cang", "cao", "ce", "cei", "cen", "ceng", "cha", "chai",
|
|
"chan", "chang", "chao", "che", "chen", "cheng", "chi", "chong", "chou", "chu", "chua", "chuai", "chuan", "chuang", "chui", "chun",
|
|
"chuo", "ci", "cong", "cou", "cu", "cuan", "cui", "cun", "cuo", "da", "dai", "dan", "dang", "dao", "de", "dei",
|
|
"den", "deng", "di", "dian", "diao", "die", "ding", "diu", "dong", "dou", "du", "duan", "dui", "dun", "duo", "e",
|
|
"ei", "en", "er", "fa", "fan", "fang", "fei", "fen", "feng", "fo", "fou", "fu", "ga", "gai", "gan", "gang",
|
|
"gao", "ge", "gei", "gen", "geng", "gong", "gou", "gu", "gua", "guai", "guan", "guang", "gui", "gun", "guo", "ha",
|
|
"hai", "han", "hang", "hao", "he", "hei", "hen", "heng", "hm", "hng", "hong", "hou", "hu", "hua", "huai", "huan",
|
|
"huang", "hui", "hun", "huo", "ji", "jia", "jian", "jiang", "jiao", "jie", "jin", "jing", "jiong", "jiu", "ju", "juan",
|
|
"jue", "jun", "ka", "kai", "kan", "kang", "kao", "ke", "kei", "ken", "keng", "kong", "kou", "ku", "kua", "kuai",
|
|
"kuan", "kuang", "kui", "kun", "kuo", "la", "lai", "lan", "lang", "lao", "le", "lei", "leng", "li", "lia", "lian",
|
|
"liang", "liao", "lie", "lin", "ling", "liu", "long", "lou", "lu", "luan", "lun", "luo", "ma", "mai", "man", "mang",
|
|
"mao", "me", "mei", "men", "meng", "mi", "mian", "miao", "mie", "min", "ming", "miu", "mo", "mou", "mu", "na",
|
|
"nai", "nan", "nang", "nao", "ne", "nei", "nen", "neng", "ng", "ni", "nian", "niang", "niao", "nie", "nin", "ning",
|
|
"niu", "nong", "nou", "nu", "nuan", "nuo", "o", "ou", "pa", "pai", "pan", "pang", "pao", "pei", "pen", "peng",
|
|
"pi", "pian", "piao", "pie", "pin", "ping", "po", "pou", "pu", "qi", "qia", "qian", "qiang", "qiao", "qie", "qin",
|
|
"qing", "qiong", "qiu", "qu", "quan", "que", "qun", "ran", "rang", "rao", "re", "ren", "reng", "ri", "rong", "rou",
|
|
"ru", "rua", "ruan", "rui", "run", "ruo", "sa", "sai", "san", "sang", "sao", "se", "sei", "sen", "seng", "sha",
|
|
"shai", "shan", "shang", "shao", "she", "shei", "shen", "sheng", "shi", "shou", "shu", "shua", "shuai", "shuan", "shuang", "shui",
|
|
"shun", "shuo", "si", "song", "sou", "su", "suan", "sui", "sun", "suo", "ta", "tai", "tan", "tang", "tao", "te",
|
|
"teng", "ti", "tian", "tiao", "tie", "ting", "tong", "tou", "tu", "tuan", "tui", "tun", "tuo", "wa", "wai", "wan",
|
|
"wang", "wei", "wen", "weng", "wo", "wu", "xi", "xia", "xian", "xiang", "xiao", "xie", "xin", "xing", "xiong", "xiu",
|
|
"xu", "xuan", "xue", "xun", "ya", "yan", "yang", "yao", "ye", "yi", "yin", "ying", "yong", "you", "yu", "yuan",
|
|
"yue", "yun", "za", "zai", "zan", "zang", "zao", "ze", "zei", "zen", "zeng", "zha", "zhai", "zhan", "zhang", "zhao",
|
|
"zhe", "zhei", "zhen", "zheng", "zhi", "zhong", "zhou", "zhu", "zhua", "zhuai", "zhuan", "zhuang", "zhui", "zhun", "zhuo", "zi",
|
|
"zong", "zou", "zuan", "zui", "zun", "zuo", "zu",
|
|
),
|
|
list(
|
|
"al", "an", "ar", "as", "at", "ea", "ed", "en", "er", "es", "ha", "he", "hi", "in", "is", "it",
|
|
"le", "me", "nd", "ne", "ng", "nt", "on", "or", "ou", "re", "se", "st", "te", "th", "ti", "to",
|
|
"ve", "wa", "all", "and", "are", "but", "ent", "era", "ere", "eve", "for", "had", "hat", "hen", "her", "hin",
|
|
"his", "ing", "ion", "ith", "not", "ome", "oul", "our", "sho", "ted", "ter", "tha", "the", "thi",
|
|
),
|
|
)
|