mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-12 02:32:10 +00:00
* Skyrat Prefs Menu: Fixing everything to work correctly * whoops haha * Examine menu! * haha whoops * Mutant Parts in tgui prefs * fug * LIMBS, MARKINGS, LANGUAGES * EEEE FUCK * Update tgui_prefs_migration.dm * Update tgui_prefs_migration.dm * FUCK * Proper migration * Update preferences.dm * Final fixes for this shit * Update LoadoutManager.js * adds cursed shit * e * Update preferences.dm * fixes examine panel * adds // SKYRAT EDIT to bullshit * sabshesgawgzxghsv * wargesthgeargfea * stegresgdytfrw * EEE * Update species_features.tsx * EEE * Update cursed_shit.tsx * fixed taurs * body size is now a 0.01 step * Fixes some bugs * Some required changes. * Update examine.dm * actually nekked * Update code/modules/client/preferences/middleware/jobs.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * Update code/modules/client/preferences/middleware/limbs_and_markings.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * Update code/modules/client/preferences/middleware/limbs_and_markings.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * Update code/modules/client/preferences/middleware/limbs_and_markings.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * Update modular_skyrat/master_files/code/modules/client/preferences/erp_preferences.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * Update modular_skyrat/modules/loadouts/loadout_ui/loadout_manager.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * Update tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/skyrat/species_features.tsx Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * More fixes * Donator items no show * EEE * fixes rapier sheaths * gender =/= body type * Loadout fixes * Skintone * Update skin_tone.dm * Slick it up * Update loadout_manager.dm * Fixes typing indicator * SSD indicator fixes * fixes * oops * Fix this. * Fixing the Occupations Menu * Fixing NT Rep's alt-titles * Update tgui/packages/tgui/interfaces/PreferencesMenu/jobs/jobs/janitor.ts Co-authored-by: death and coding <58394696+thestubborn@users.noreply.github.com> * Update code/controllers/subsystem/language.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * Update tgui/packages/tgui/interfaces/PreferencesMenu/jobs/jobs/research_director.ts Co-authored-by: death and coding <58394696+thestubborn@users.noreply.github.com> Co-authored-by: Gandalf <jzo123@hotmail.com> Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com> Co-authored-by: death and coding <58394696+thestubborn@users.noreply.github.com>
112 lines
3.7 KiB
Plaintext
112 lines
3.7 KiB
Plaintext
#define SCRAMBLE_CACHE_LEN 50 //maximum of 50 specific scrambled lines per language
|
|
|
|
/*
|
|
Datum based languages. Easily editable and modular.
|
|
*/
|
|
|
|
/datum/language
|
|
var/name = "an unknown language" // Fluff name of language if any.
|
|
var/desc = "A language." // Short description for 'Check Languages'.
|
|
var/key // Character used to speak in language
|
|
// If key is null, then the language isn't real or learnable.
|
|
var/flags // Various language flags.
|
|
var/list/syllables // Used when scrambling text for a non-speaker.
|
|
var/sentence_chance = 5 // Likelihood of making a new sentence after each syllable.
|
|
var/space_chance = 55 // Likelihood of getting a space in the random scramble string
|
|
var/list/spans = list()
|
|
var/list/scramble_cache = list()
|
|
var/default_priority = 0 // the language that an atom knows with the highest "default_priority" is selected by default.
|
|
|
|
// if you are seeing someone speak popcorn language, then something is wrong.
|
|
var/icon = 'icons/misc/language.dmi'
|
|
var/icon_state = "popcorn"
|
|
//SKYRAT EDIT
|
|
/// Should this be hidden on the language buy menu?
|
|
var/secret = FALSE
|
|
//SKYRAT EDIT END
|
|
|
|
/datum/language/proc/display_icon(atom/movable/hearer)
|
|
var/understands = hearer.has_language(src.type)
|
|
if(flags & LANGUAGE_HIDE_ICON_IF_UNDERSTOOD && understands)
|
|
return FALSE
|
|
if(flags & LANGUAGE_HIDE_ICON_IF_NOT_UNDERSTOOD && !understands)
|
|
return FALSE
|
|
return TRUE
|
|
|
|
/datum/language/proc/get_icon()
|
|
var/datum/asset/spritesheet/sheet = get_asset_datum(/datum/asset/spritesheet/chat)
|
|
return sheet.icon_tag("language-[icon_state]")
|
|
|
|
/datum/language/proc/get_random_name(gender, name_count=2, syllable_count=4, syllable_divisor=2)
|
|
if(!syllables || !syllables.len)
|
|
if(gender==FEMALE)
|
|
return capitalize(pick(GLOB.first_names_female)) + " " + capitalize(pick(GLOB.last_names))
|
|
else
|
|
return capitalize(pick(GLOB.first_names_male)) + " " + capitalize(pick(GLOB.last_names))
|
|
|
|
var/full_name = ""
|
|
var/new_name = ""
|
|
|
|
for(var/i in 0 to name_count)
|
|
new_name = ""
|
|
var/Y = rand(FLOOR(syllable_count/syllable_divisor, 1), syllable_count)
|
|
for(var/x in Y to 0)
|
|
new_name += pick(syllables)
|
|
full_name += " [capitalize(lowertext(new_name))]"
|
|
|
|
return "[trim(full_name)]"
|
|
|
|
/datum/language/proc/check_cache(input)
|
|
var/lookup = scramble_cache[input]
|
|
if(lookup)
|
|
scramble_cache -= input
|
|
scramble_cache[input] = lookup
|
|
. = lookup
|
|
|
|
/datum/language/proc/add_to_cache(input, scrambled_text)
|
|
// Add it to cache, cutting old entries if the list is too long
|
|
scramble_cache[input] = scrambled_text
|
|
if(scramble_cache.len > SCRAMBLE_CACHE_LEN)
|
|
scramble_cache.Cut(1, scramble_cache.len-SCRAMBLE_CACHE_LEN-1)
|
|
|
|
/datum/language/proc/scramble(input)
|
|
|
|
if(!syllables || !syllables.len)
|
|
return stars(input)
|
|
|
|
// If the input is cached already, move it to the end of the cache and return it
|
|
var/lookup = check_cache(input)
|
|
if(lookup)
|
|
return lookup
|
|
|
|
var/input_size = length_char(input)
|
|
var/scrambled_text = ""
|
|
var/capitalize = TRUE
|
|
|
|
while(length_char(scrambled_text) < input_size)
|
|
var/next = pick(syllables)
|
|
if(capitalize)
|
|
next = capitalize(next)
|
|
capitalize = FALSE
|
|
scrambled_text += next
|
|
var/chance = rand(100)
|
|
if(chance <= sentence_chance)
|
|
scrambled_text += ". "
|
|
capitalize = TRUE
|
|
else if(chance > sentence_chance && chance <= space_chance)
|
|
scrambled_text += " "
|
|
|
|
scrambled_text = trim(scrambled_text)
|
|
var/ending = copytext_char(scrambled_text, -1)
|
|
if(ending == ".")
|
|
scrambled_text = copytext_char(scrambled_text, 1, -2)
|
|
var/input_ending = copytext_char(input, -1)
|
|
if(input_ending in list("!","?","."))
|
|
scrambled_text += input_ending
|
|
|
|
add_to_cache(input, scrambled_text)
|
|
|
|
return scrambled_text
|
|
|
|
#undef SCRAMBLE_CACHE_LEN
|