Skip to content

Commit

Permalink
Merge branch 'master' into im_a_fruit_a_starfruit
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMelbert authored Jan 12, 2025
2 parents 9291cbb + 4c3683a commit c88ce0e
Show file tree
Hide file tree
Showing 34 changed files with 834 additions and 372 deletions.
9 changes: 9 additions & 0 deletions code/_globalvars/lists/flavor_misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,12 @@ GLOBAL_LIST_INIT(status_display_state_pictures, list(
"blank",
"shuttle",
))

GLOBAL_LIST_INIT(most_common_words, init_common_words())

/proc/init_common_words()
. = list()
var/i = 1
for(var/word in world.file2list("strings/1000_most_common.txt"))
.[word] = i
i += 1
2 changes: 1 addition & 1 deletion code/_globalvars/lists/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ GLOBAL_LIST_INIT_TYPED(language_datum_instances, /datum/language, init_language_
/// List if all language typepaths learnable, IE, those with keys
GLOBAL_LIST_INIT(all_languages, init_all_languages())
// /List of language prototypes to reference, assoc "name" = typepath
GLOBAL_LIST_INIT(language_types_by_name, init_language_types_by_name())
GLOBAL_LIST_INIT_TYPED(language_types_by_name, /datum/language, init_language_types_by_name())

/proc/init_language_prototypes()
var/list/lang_list = list()
Expand Down
7 changes: 1 addition & 6 deletions code/controllers/subsystem/discord.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,13 @@ SUBSYSTEM_DEF(discord)
/// People who have tried to verify this round already
var/list/reverify_cache

/// Common words list, used to generate one time tokens
var/list/common_words

/// The file where notification status is saved
var/notify_file = file("data/notify.json")

/// Is TGS enabled (If not we won't fire because otherwise this is useless)
var/enabled = FALSE

/datum/controller/subsystem/discord/Initialize()
common_words = world.file2list("strings/1000_most_common.txt")
reverify_cache = list()
// Check for if we are using TGS, otherwise return and disables firing
if(world.TgsAvailable())
Expand Down Expand Up @@ -156,7 +152,7 @@ SUBSYSTEM_DEF(discord)
// While there's a collision in the token, generate a new one (should rarely happen)
while(not_unique)
//Column is varchar 100, so we trim just in case someone does us the dirty later
one_time_token = trim("[pick(common_words)]-[pick(common_words)]-[pick(common_words)]-[pick(common_words)]-[pick(common_words)]-[pick(common_words)]", 100)
one_time_token = trim("[pick(GLOB.most_common_words)]-[pick(GLOB.most_common_words)]-[pick(GLOB.most_common_words)]-[pick(GLOB.most_common_words)]-[pick(GLOB.most_common_words)]-[pick(GLOB.most_common_words)]", 100)

not_unique = find_discord_link_by_token(one_time_token, timebound = TRUE)

Expand Down Expand Up @@ -298,4 +294,3 @@ SUBSYSTEM_DEF(discord)
if (length(discord_mention_extraction_regex.group) == 1)
return discord_mention_extraction_regex.group[1]
return null

2 changes: 1 addition & 1 deletion code/controllers/subsystem/processing/quirks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GLOBAL_LIST_INIT_TYPED(quirk_blacklist, /list/datum/quirk, list(
list(/datum/quirk/social_anxiety, /datum/quirk/mute),
list(/datum/quirk/mute, /datum/quirk/softspoken),
list(/datum/quirk/poor_aim, /datum/quirk/bighands),
list(/datum/quirk/bilingual, /datum/quirk/foreigner),
// list(/datum/quirk/bilingual, /datum/quirk/foreigner),
list(/datum/quirk/spacer_born, /datum/quirk/item_quirk/settler),
list(/datum/quirk/photophobia, /datum/quirk/nyctophobia),
list(/datum/quirk/item_quirk/settler, /datum/quirk/freerunning),
Expand Down
4 changes: 1 addition & 3 deletions code/datums/brain_damage/mild.dm
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@
gain_text = span_warning("You lose your grasp on complex words.")
lose_text = span_notice("You feel your vocabulary returning to normal again.")

var/static/list/common_words = world.file2list("strings/1000_most_common.txt")

/datum/brain_trauma/mild/expressive_aphasia/handle_speech(datum/source, list/speech_args)
var/message = speech_args[SPEECH_MESSAGE]
if(message)
Expand All @@ -212,7 +210,7 @@
word = copytext(word, 1, suffix_foundon)
word = html_decode(word)

if(lowertext(word) in common_words)
if(GLOB.most_common_words[lowertext(word)])
new_message += word + suffix
else
if(prob(30) && message_split.len > 2)
Expand Down
2 changes: 2 additions & 0 deletions code/datums/quirks/neutral_quirks/foreigner.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
/datum/quirk/foreigner
name = "Foreigner"
desc = "You're not from around here. You don't know Galactic Common!"
Expand All @@ -19,3 +20,4 @@
human_holder.remove_blocked_language(/datum/language/common)
if(ishumanbasic(human_holder))
human_holder.remove_language(/datum/language/uncommon)
*/
2 changes: 2 additions & 0 deletions code/datums/quirks/positive_quirks/bilingual.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
/datum/quirk/bilingual
name = "Bilingual"
desc = "Over the years you've picked up an extra language!"
Expand Down Expand Up @@ -26,3 +27,4 @@
return
to_chat(quirk_holder, span_boldnotice("You are already familiar with the quirk in your preferences, so you learned Galactic Uncommon instead."))
quirk_holder.grant_language(language_type, source = LANGUAGE_QUIRK)
*/
2 changes: 1 addition & 1 deletion code/datums/world_topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
var/require_comms_key = FALSE

/datum/world_topic/proc/TryRun(list/input)
key_valid = config && (CONFIG_GET(string/comms_key) == input["key"])
key_valid = (CONFIG_GET(string/comms_key) == input["key"]) && CONFIG_GET(string/comms_key) && input["key"]
input -= "key"
if(require_comms_key && !key_valid)
. = "Bad Key"
Expand Down
6 changes: 5 additions & 1 deletion code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@
*/

/// Gets or creates the relevant language holder. For mindless atoms, gets the local one. For atom with mind, gets the mind one.
/atom/movable/proc/get_language_holder()
/atom/movable/proc/get_language_holder() as /datum/language_holder
RETURN_TYPE(/datum/language_holder)
if(QDELING(src))
CRASH("get_language_holder() called on a QDELing atom, \
Expand Down Expand Up @@ -1521,6 +1521,10 @@
/atom/movable/proc/get_random_understood_language()
return get_language_holder().get_random_understood_language()

/// Gets a list of all mutually understood languages.
/atom/movable/proc/get_mutually_understood_languages()
return get_language_holder().get_mutually_understood_languages()

/// Gets a random spoken language, useful for forced speech and such.
/atom/movable/proc/get_random_spoken_language()
return get_language_holder().get_random_spoken_language()
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/telecomms/computers/logbrowser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
message_out = "\"[message_in]\""
else if(!user.has_language(language))
// Language unknown: scramble
message_out = "\"[language_instance.scramble(message_in)]\""
message_out = "\"[language_instance.scramble_sentence(message_in, user.get_mutually_understood_languages())]\""
else
message_out = "(Unintelligible)"
packet_out["message"] = message_out
Expand Down
2 changes: 1 addition & 1 deletion code/game/say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ GLOBAL_LIST_INIT(freqtospan, list(

if(!has_language(language))
var/datum/language/dialect = GLOB.language_datum_instances[language]
raw_message = dialect.scramble(raw_message)
raw_message = dialect.scramble_sentence(raw_message, get_mutually_understood_languages())

return raw_message

Expand Down
2 changes: 2 additions & 0 deletions code/modules/client/preferences/language.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
/datum/preference/choiced/language
category = PREFERENCE_CATEGORY_MANUALLY_RENDERED
savefile_key = "language"
Expand Down Expand Up @@ -33,3 +34,4 @@
/datum/preference/choiced/language/apply_to_human(mob/living/carbon/human/target, value)
return
*/
5 changes: 4 additions & 1 deletion code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// You do not need to raise this if you are adding new values that have sane defaults.
// Only raise this value when changing the meaning/format/name/layout of an existing value
// where you would want the updater procs below to run
#define SAVEFILE_VERSION_MAX 45
#define SAVEFILE_VERSION_MAX 45.1

/*
SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn
Expand Down Expand Up @@ -111,6 +111,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
data_to_migrate = list(INFO_RESKIN = save_data?["pride_pin"]),
)

if (current_version < 45.1)
migrate_quirks_to_language_menu(save_data)

/// checks through keybindings for outdated unbound keys and updates them
/datum/preferences/proc/check_keybindings()
if(!parent)
Expand Down
Loading

0 comments on commit c88ce0e

Please sign in to comment.