Skip to content

Commit

Permalink
refactor: two-character keys for languages. (ss220-space#4215)
Browse files Browse the repository at this point in the history
  • Loading branch information
Daeberdir authored Feb 21, 2024
1 parent ad7ae47 commit 68ba68c
Show file tree
Hide file tree
Showing 76 changed files with 521 additions and 410 deletions.
45 changes: 44 additions & 1 deletion code/__DEFINES/language.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@
//Language flags.
// Language keys.
#define LANGUAGE_NONE "None"
#define LANGUAGE_NOISE "Noise"
#define LANGUAGE_UNATHI "Sinta'unathi"
#define LANGUAGE_TAJARAN "Siik'tajr"
#define LANGUAGE_VULPKANIN "Canilunzt"
#define LANGUAGE_SKRELL "Skrellian"
#define LANGUAGE_VOX "Vox-pidgin"
#define LANGUAGE_DIONA "Rootspeak"
#define LANGUAGE_TRINARY "Trinary"
#define LANGUAGE_KIDAN "Chittin"
#define LANGUAGE_SLIME "Bubblish"
#define LANGUAGE_GREY "Psionic Communication"
#define LANGUAGE_DRASK "Orluum"
#define LANGUAGE_MOTH "Tkachi"
#define LANGUAGE_GALACTIC_COMMON "Galactic Common"
#define LANGUAGE_SOL_COMMON "Sol Common"
#define LANGUAGE_TRADER "Tradeband"
#define LANGUAGE_GUTTER "Gutter"
#define LANGUAGE_CLOWN "Clownish"
#define LANGUAGE_NEO_RUSSIAN "Neo-Russkiya"
#define LANGUAGE_WRYN "Wryn Hivemind"
#define LANGUAGE_XENOS "Xenomorph"
#define LANGUAGE_HIVE_XENOS "Xenomorph Hivemind"
#define LANGUAGE_HIVE_TERRORSPIDER "Spider Hivemind"
#define LANGUAGE_HIVE_CHANGELING "Changeling Hivemind"
#define LANGUAGE_HIVE_EVENTLING "Infiltrated Changeling Hivemind"
#define LANGUAGE_HIVE_SHADOWLING "Shadowling Hivemind"
#define LANGUAGE_HIVE_ABDUCTOR "Abductor Mindlink"
#define LANGUAGE_HIVE_GOLEM "Golem Mindlink"
#define LANGUAGE_HIVE_BORER "Cortical Link"
#define LANGUAGE_BINARY "Robot Talk"
#define LANGUAGE_DRONE_BINARY "Drone Talk"
#define LANGUAGE_DRONE "Drone"
#define LANGUAGE_HIVE_SWARMER "Swarmer"
#define LANGUAGE_MONKEY_HUMAN "Chimpanzee"
#define LANGUAGE_MONKEY_SKRELL "Neara"
#define LANGUAGE_MONKEY_UNATHI "Stok"
#define LANGUAGE_MONKEY_TAJARAN "Farwa"
#define LANGUAGE_MONKEY_VULPKANIN "Wolpin"


// Language flags.
#define WHITELISTED (1<<0) // Language is available if the speaker is whitelisted.
#define RESTRICTED (1<<1) // Language can only be accquired by spawning or an admin.
#define HIVEMIND (1<<4) // Broadcast to all mobs with this language.
Expand All @@ -7,6 +49,7 @@
#define NO_TALK_MSG (1<<7) // Do not show the "\The [speaker] talks into \the [radio]" message
#define NO_STUTTER (1<<8) // No stuttering, slurring, or other speech problems
#define NOBABEL (1<<9) // Not granted by book of babel. Typically antag languages.
#define UNIQUE (1<<10) // Secondary languages for species.

//Auto-accent level defines.
#define AUTOHISS_OFF 0
Expand Down
16 changes: 8 additions & 8 deletions code/__HELPERS/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@

// Setup languages
for(var/language_name in GLOB.all_languages)
var/datum/language/L = GLOB.all_languages[language_name]
if(!(L.flags & NONGLOBAL))
GLOB.language_keys[":[lowertext(L.key)]"] = L
GLOB.language_keys[".[lowertext(L.key)]"] = L
GLOB.language_keys["#[lowertext(L.key)]"] = L
GLOB.language_keys[":[sanitize_english_string_to_russian(L.key)]"] = L
GLOB.language_keys[".[sanitize_english_string_to_russian(L.key)]"] = L
GLOB.language_keys["#[sanitize_english_string_to_russian(L.key)]"] = L
var/datum/language/language = GLOB.all_languages[language_name]
if(!(language.flags & NONGLOBAL))
GLOB.language_keys[":[lowertext(language.key)]"] = language
GLOB.language_keys[".[lowertext(language.key)]"] = language
GLOB.language_keys["#[lowertext(language.key)]"] = language
GLOB.language_keys[":[sanitize_english_string_to_russian(language.key)]"] = language
GLOB.language_keys[".[sanitize_english_string_to_russian(language.key)]"] = language
GLOB.language_keys["#[sanitize_english_string_to_russian(language.key)]"] = language

var/rkey = 0
for(var/spath in subtypesof(/datum/species))
Expand Down
2 changes: 1 addition & 1 deletion code/datums/datumvars.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@
to_chat(usr, "Mob doesn't exist anymore")
return

if(H.remove_language(rem_language.name))
if(H.remove_language(rem_language))
to_chat(usr, "Removed [rem_language] from [H].")
log_and_message_admins("has removed language [rem_language] from [key_name(H)]")
else
Expand Down
2 changes: 1 addition & 1 deletion code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2732,7 +2732,7 @@
SSticker.mode.shadows -= src
special_role = null
current.spellremove(current)
current.remove_language("Shadowling Hivemind")
current.remove_language(LANGUAGE_HIVE_SHADOWLING)
else if(src in SSticker.mode.shadowling_thralls)
SSticker.mode.remove_thrall(src,0)

Expand Down
4 changes: 2 additions & 2 deletions code/datums/outfits/outfit_admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,8 @@

H.rename_character(null, "[rank_list.len ? pick(rank_list) : "[H.gender==FEMALE ? pick(GLOB.first_names_female) : pick(GLOB.first_names_male)]"] [H.gender==FEMALE ? pick(GLOB.last_names_female) : pick(GLOB.last_names)]")

H.add_language("Neo-Russkiya")
H.set_default_language(GLOB.all_languages["Neo-Russkiya"])
H.add_language(LANGUAGE_NEO_RUSSIAN)
H.set_default_language(GLOB.all_languages[LANGUAGE_NEO_RUSSIAN])

var/obj/item/card/id/I = H.wear_id
if(istype(I))
Expand Down
2 changes: 1 addition & 1 deletion code/datums/outfits/outfit_security_clown.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
genemutcheck(H, GLOB.comicblock, null, MUTCHK_FORCED)
H.dna.default_blocks.Add(GLOB.comicblock)
H.check_mutations = TRUE
H.add_language("Clownish")
H.add_language(LANGUAGE_CLOWN)

var/clownsecurity_rank = pick("Офицер", "Кадет", "Новобранец", "Рядовой", "Ефрейтор", "Сержант", "Детектив", "Оперуполномоченный", "Расследователь", "Охранник", "Полевой офицер")
if(is_physician)
Expand Down
4 changes: 2 additions & 2 deletions code/defines/procs/announce.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GLOBAL_DATUM_INIT(event_announcement, /datum/announcement/priority/command/event
var/channel_name = "Station Announcements"
var/announcement_type = "Оповещение"
var/admin_announcement = 0 // Admin announcements are received regardless of being in range of a radio, unless you're in the lobby to prevent metagaming
var/language = "Galactic Common"
var/language = LANGUAGE_GALACTIC_COMMON

/datum/announcement/New(var/do_log = 0, var/new_sound = null, var/do_newscast = 0)
sound = new_sound
Expand Down Expand Up @@ -44,7 +44,7 @@ GLOBAL_DATUM_INIT(event_announcement, /datum/announcement/priority/command/event
title = "Оповещение о безопасности"
announcement_type = "Оповещение о безопасности"

/datum/announcement/proc/Announce(var/message as text, var/new_title = "", var/new_sound = null, var/do_newscast = newscast, var/msg_sanitized = 0, var/from, var/msg_language)
/datum/announcement/proc/Announce(message as text, new_title = "", new_sound = null, do_newscast = newscast, msg_sanitized = 0, from, msg_language)
if(!message)
return

Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/clockwork/cogscarab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@

/mob/living/silicon/robot/cogscarab/Initialize(mapload)
. = ..()
remove_language("Robot Talk")
add_language("Drone Talk", 1)
remove_language(LANGUAGE_BINARY)
add_language(LANGUAGE_DRONE_BINARY, 1)
if(radio)
radio.wires.cut(WIRE_RADIO_TRANSMIT)

Expand Down
6 changes: 3 additions & 3 deletions code/game/gamemodes/heist/heist.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ GLOBAL_LIST_EMPTY(cortical_stacks) //Stacks for 'leave nobody behind' objective.
vox.s_tone = rand(1, 6)
vox.languages = list() // Removing language from chargen.
vox.flavor_text = ""
vox.add_language("Vox-pidgin")
vox.add_language("Galactic Common")
vox.add_language("Tradeband")
vox.add_language(LANGUAGE_VOX)
vox.add_language(LANGUAGE_GALACTIC_COMMON)
vox.add_language(LANGUAGE_TRADER)
head_organ.h_style = "Short Vox Quills"
head_organ.f_style = "Shaved"
vox.change_hair_color(97, 79, 25) //Same as the species default colour.
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/miniantags/abduction/gland.dm
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
/obj/item/organ/internal/heart/gland/slime/insert(mob/living/carbon/M, special = ORGAN_MANIPULATION_DEFAULT)
..()
owner.faction |= "slime"
owner.add_language("Bubblish")
owner.add_language(LANGUAGE_SLIME)

/obj/item/organ/internal/heart/gland/slime/activate()
to_chat(owner, "<span class='warning'>You feel nauseous!</span>")
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/miniantags/borer/borer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
..(newloc)
remove_from_all_data_huds()
generation = gen
add_language("Cortical Link")
add_language(LANGUAGE_HIVE_BORER)
notify_ghosts("Мозговой червь появился в [get_area(src)]!", enter_link = "<a href=?src=[UID()];ghostjoin=1>(Click to enter)</a>", source = src, action = NOTIFY_ATTACK)
real_name = "Cortical Borer [rand(1000,9999)]"
truename = "[borer_names[min(generation, borer_names.len)]] [rand(1000,9999)]"
Expand Down Expand Up @@ -157,7 +157,7 @@
/mob/living/simple_animal/borer/say(message, verb = "says", sanitize = TRUE, ignore_speech_problems = FALSE, ignore_atmospherics = FALSE, ignore_languages = FALSE)
var/list/message_pieces = parse_languages(message)
for(var/datum/multilingual_say_piece/S in message_pieces)
if(!istype(S.speaking, /datum/language/corticalborer) && loc == host && !talk_inside_host)
if(S.speaking != GLOB.all_languages[LANGUAGE_HIVE_BORER] && loc == host && !talk_inside_host)
Communicate(message)
return
return ..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/miniantags/bot_swarm/swarmer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@

/mob/living/simple_animal/hostile/swarmer/New()
..()
add_language("Swarmer", 1)
add_language(LANGUAGE_HIVE_SWARMER, 1)
verbs -= /mob/living/verb/pulled
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
diag_hud.add_to_hud(src)
Expand Down
6 changes: 3 additions & 3 deletions code/game/gamemodes/shadowling/shadowling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Made by Xhuis
var/mob/living/carbon/human/S = shadow_mind.current
shadow_mind.AddSpell(new /obj/effect/proc_holder/spell/shadowling_hatch(null))
spawn(0)
shadow_mind.current.add_language("Shadowling Hivemind")
shadow_mind.current.add_language(LANGUAGE_HIVE_SHADOWLING)
update_shadow_icons_added(shadow_mind)
if(shadow_mind.assigned_role == "Clown")
to_chat(S, "<span class='notice'>Your alien nature has allowed you to overcome your clownishness.</span>")
Expand All @@ -161,7 +161,7 @@ Made by Xhuis
new_thrall_mind.special_role = SPECIAL_ROLE_SHADOWLING_THRALL
update_shadow_icons_added(new_thrall_mind)
add_conversion_logs(new_thrall_mind.current, "Became a Shadow thrall")
new_thrall_mind.current.add_language("Shadowling Hivemind")
new_thrall_mind.current.add_language(LANGUAGE_HIVE_SHADOWLING)
//If you add spells to thrall, be sure to remove them on dethrallize
new_thrall_mind.AddSpell(new /obj/effect/proc_holder/spell/shadowling_guise(null))
new_thrall_mind.AddSpell(new /obj/effect/proc_holder/spell/shadowling_vision/thrall(null))
Expand Down Expand Up @@ -191,7 +191,7 @@ Made by Xhuis
//If you add spells to thrall, be sure to remove them on dethrallize
thrall_mind.RemoveSpell(/obj/effect/proc_holder/spell/shadowling_guise)
thrall_mind.RemoveSpell(/obj/effect/proc_holder/spell/shadowling_vision/thrall)
thrall_mind.current.remove_language("Shadowling Hivemind")
thrall_mind.current.remove_language(LANGUAGE_HIVE_SHADOWLING)
if(kill && ishuman(thrall_mind.current)) //If dethrallization surgery fails, kill the mob as well as dethralling them
var/mob/living/carbon/human/H = thrall_mind.current
H.visible_message("<span class='warning'>[H] jerks violently and falls still.</span>", \
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/shadowling/shadowling_abilities.dm
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@
to_chat(target, "<span class='userdanger'><font size=3>An agonizing spike of pain drives into your mind, and--</font></span>")
SSticker.mode.add_thrall(target.mind)
target.mind.special_role = SPECIAL_ROLE_SHADOWLING_THRALL
target.add_language("Shadowling Hivemind")
target.add_language(LANGUAGE_HIVE_SHADOWLING)



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ GLOBAL_LIST_INIT(possibleShadowlingNames, list("U'ruan", "Y`shej", "Nex", "Hel-u
undershirt = "None"
socks = "None"
faction |= "faithless"
add_language("Shadowling Hivemind")
add_language(LANGUAGE_HIVE_SHADOWLING)

set_species(/datum/species/shadow/ling)
equip_to_slot_or_del(new /obj/item/clothing/under/shadowling(src), slot_w_uniform)
Expand Down
2 changes: 1 addition & 1 deletion code/game/jobs/job/support.dm
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
genemutcheck(H, GLOB.comicblock, null, MUTCHK_FORCED)
H.dna.default_blocks.Add(GLOB.comicblock)
H.check_mutations = TRUE
H.add_language("Clownish")
H.add_language(LANGUAGE_CLOWN)

//action given to antag clowns
/datum/action/innate/toggle_clumsy
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/tcomms/core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
if(!new_language)
return
if(new_language == "--DISABLE--")
nttc.setting_language = null
nttc.setting_language = LANGUAGE_NONE
to_chat(usr, span_notice("Language conversion disabled."))
else
nttc.setting_language = new_language
Expand Down
16 changes: 8 additions & 8 deletions code/game/machinery/tcomms/nttc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
var/toggle_command_bold = FALSE

/* Strings */
var/setting_language = null
var/setting_language = LANGUAGE_NONE
var/job_indicator_type = null

// This tells the datum what is safe to serialize and what's not. It also applies to deserialization.
Expand Down Expand Up @@ -151,9 +151,9 @@
job_indicator_type = initial(job_indicator_type)

/datum/nttc_configuration/proc/update_languages()
for(var/language in GLOB.all_languages)
var/datum/language/L = GLOB.all_languages[language]
if(L.flags & HIVEMIND)
for(var/language_name in GLOB.all_languages)
var/datum/language/language = GLOB.all_languages[language_name]
if(language.flags & (HIVEMIND|NONGLOBAL))
continue
valid_languages[language] = TRUE

Expand Down Expand Up @@ -260,18 +260,18 @@
var/datum/multilingual_say_piece/S = message_pieces[I]
if(!S.message)
continue
if(I == 1 && !istype(S.speaking, /datum/language/noise)) // Capitalise the first section only, unless it's an emote.
if(I == 1 && S.speaking != GLOB.all_languages[LANGUAGE_NOISE]) // Capitalise the first section only, unless it's an emote.
S.message = "[capitalize(S.message)]"
S.message = "<b>[S.message]</b>" // Make everything bolded

// Language Conversion
if(setting_language && valid_languages[setting_language])
if(setting_language == "--DISABLE--")
setting_language = null
setting_language = LANGUAGE_NONE
else
for(var/datum/multilingual_say_piece/S in message_pieces)
if(S.speaking != GLOB.all_languages["Noise"]) // check if they are emoting, these do not need to be translated
S.speaking = GLOB.all_languages[setting_language]
if(S.speaking != GLOB.all_languages[LANGUAGE_NOISE]) // check if they are emoting, these do not need to be translated
S.speaking = setting_language

return tcm

Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/devices/radio/headset.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
/obj/item/radio/headset/handle_message_mode(mob/living/M, list/message_pieces, channel)
if(channel == "special")
if(translate_binary)
var/datum/language/binary = GLOB.all_languages["Robot Talk"]
var/datum/language/binary = GLOB.all_languages[LANGUAGE_BINARY]
binary.broadcast(M, strip_prefixes(multilingual_to_message(message_pieces)))
return RADIO_CONNECTION_NON_SUBSPACE
if(translate_hive)
var/datum/language/hivemind = GLOB.all_languages["Hivemind"]
var/datum/language/hivemind = GLOB.all_languages[LANGUAGE_HIVE_XENOS]
hivemind.broadcast(M, strip_prefixes(multilingual_to_message(message_pieces)))
return RADIO_CONNECTION_NON_SUBSPACE
return RADIO_CONNECTION_FAIL
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/honksquad.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ GLOBAL_VAR_INIT(sent_clownsequritysquad, 0)
new_honksquad.mind.assigned_role = SPECIAL_ROLE_HONKSQUAD
new_honksquad.mind.special_role = SPECIAL_ROLE_HONKSQUAD
new_honksquad.mind.offstation_role = TRUE
new_honksquad.add_language("Clownish")
new_honksquad.add_language(LANGUAGE_CLOWN)
new_honksquad.change_voice()
SSticker.mode.traitors |= new_honksquad.mind//Adds them to current traitor list. Which is really the extra antagonist list.
new_honksquad.equip_honksquad(honk_leader_selected, rankName)
Expand Down
12 changes: 6 additions & 6 deletions code/modules/antagonists/changeling/changeling_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ GLOBAL_LIST_INIT(possible_changeling_IDs, list("Alpha","Beta","Gamma","Delta","E
for(var/datum/language/language in new_languages)
if(is_type_in_UID_list(language, absorbed_languages))
continue
owner.current.add_language("[language.name]")
owner.current.add_language(language.name)
absorbed_languages += language.UID()


Expand All @@ -352,8 +352,8 @@ GLOBAL_LIST_INIT(possible_changeling_IDs, list("Alpha","Beta","Gamma","Delta","E
*/
/datum/antagonist/changeling/proc/update_languages()
for(var/lang_UID in absorbed_languages)
var/datum/language/lang = locateUID(lang_UID)
owner.current.add_language("[lang.name]")
var/datum/language/language = locateUID(lang_UID)
owner.current.add_language(language.name)


/**
Expand All @@ -378,10 +378,10 @@ GLOBAL_LIST_INIT(possible_changeling_IDs, list("Alpha","Beta","Gamma","Delta","E
ignored_languages += human_user.dna.species.secondary_langs

for(var/lang_UID in absorbed_languages)
var/datum/language/lang = locateUID(lang_UID)
if(lang.name in ignored_languages)
var/datum/language/language = locateUID(lang_UID)
if(language.name in ignored_languages)
continue
user.remove_language("[lang.name]")
user.remove_language(language.name)


/**
Expand Down
Loading

0 comments on commit 68ba68c

Please sign in to comment.