Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: Aphasia disability #6181

Open
wants to merge 11 commits into
base: master220
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion code/__DEFINES/genetics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
#define DISABILITY_FLAG_TEA_ADDICT (1<<13)
#define DISABILITY_FLAG_ALCOHOLE_ADDICT (1<<14)
#define DISABILITY_FLAG_NICOTINE_ADDICT (1<<15)
#define DISABILITY_FLAG_PARAPLEGIA (1<<16)
#define DISABILITY_FLAG_PARAPLEGIA (1<<16)
#define DISABILITY_FLAG_APHASIA (1<<17)


//Nutrition levels for humans. No idea where else to put it
Expand Down
2 changes: 1 addition & 1 deletion code/_globalvars/genetics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ GLOBAL_VAR_INIT(weakblock, 0)
GLOBAL_VAR_INIT(hornsblock, 0)
GLOBAL_VAR_INIT(comicblock, 0)
GLOBAL_VAR_INIT(paraplegiablock, 0)
GLOBAL_VAR_INIT(aphasiablock, 0)

// Powers
GLOBAL_VAR_INIT(soberblock, 0)
Expand Down Expand Up @@ -74,5 +75,4 @@ GLOBAL_LIST_EMPTY(global_mutations)
GLOBAL_VAR_INIT(fakeblock1, 0)
GLOBAL_VAR_INIT(fakeblock2, 0)
GLOBAL_VAR_INIT(fakeblock3, 0)
GLOBAL_VAR_INIT(fakeblock4, 0)

34 changes: 34 additions & 0 deletions code/game/dna/genes/disabilities.dm
Original file line number Diff line number Diff line change
Expand Up @@ -386,3 +386,37 @@
/datum/dna/gene/disability/paraplegia/New()
..()
block = GLOB.paraplegiablock

/datum/dna/gene/disability/aphasia
name = "Aphasia"
desc = "Цель теряет возможность говорить на своем основном языке."
activation_message = list("Вам становится труднее выражать свои мысли. Meh nahbleh blahmeh?")
deactivation_message = list("Ваша речь возвращается в норму.")
instability = -GENE_INSTABILITY_MINOR
/// Default language can be changed, so don't use initial(), use this.
var/cached_default_language

/datum/dna/gene/disability/aphasia/New()
. = ..()
block = GLOB.aphasiablock

/datum/dna/gene/disability/aphasia/can_activate(mob/living/carbon/human/H, flags)
if(isplasmaman(H) || iswryn(H))
to_chat(H, span_warning("Вы чувствуете, что что-то не так, но не можете понять, что именно."))
return FALSE

return ..()

/datum/dna/gene/disability/aphasia/activate(mob/living/carbon/human/H, flags)
. = ..()
cached_default_language = H.dna.species.default_language
if(H.remove_language(cached_default_language))
H.add_language(cached_default_language, TRUE)
H.dna.species.default_language = H.dna.species.language
Antoonij marked this conversation as resolved.
Show resolved Hide resolved


/datum/dna/gene/disability/aphasia/deactivate(mob/living/carbon/human/H, flags)
. = ..()
if(H.remove_language(cached_default_language, TRUE))
H.add_language(cached_default_language)
H.dna.species.default_language = cached_default_language
6 changes: 0 additions & 6 deletions code/game/dna/genes/gene.dm
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,3 @@
/datum/dna/gene/basic/fake/fake3/New()
..()
block = GLOB.fakeblock3


/datum/dna/gene/basic/fake/fake4/New()
..()
block = GLOB.fakeblock4

2 changes: 1 addition & 1 deletion code/game/gamemodes/setupgame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
GLOB.fakeblock1 = getAssignedBlock("", numsToAssign)
GLOB.fakeblock2 = getAssignedBlock("", numsToAssign)
GLOB.fakeblock3 = getAssignedBlock("", numsToAssign)
GLOB.fakeblock4 = getAssignedBlock("", numsToAssign)

// Bay muts
GLOB.breathlessblock = getAssignedBlock("BREATHLESS", numsToAssign, DNA_HARD_BOUNDS, good = TRUE)
Expand Down Expand Up @@ -100,6 +99,7 @@
// Paradise1984 Disabilities
GLOB.auld_imperial_block = getAssignedBlock("AULD_IMPERIAL", numsToAssign)
GLOB.paraplegiablock = getAssignedBlock("PARAPLEGIA", numsToAssign)
GLOB.aphasiablock = getAssignedBlock("APHASIA", numsToAssign)

//
// Static Blocks
Expand Down
5 changes: 5 additions & 0 deletions code/modules/client/preference/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,8 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
HTML += ShowDisabilityState(user, DISABILITY_FLAG_ALCOHOLE_ADDICT, "Alcohole addict")
if(!(S.blacklisted_disabilities & DISABILITY_FLAG_PARAPLEGIA))
HTML += ShowDisabilityState(user, DISABILITY_FLAG_PARAPLEGIA, "Paraplegia")
if(!(S.blacklisted_disabilities & DISABILITY_FLAG_APHASIA))
HTML += ShowDisabilityState(user, DISABILITY_FLAG_APHASIA, "Aphasia")

HTML += {"</ul>
<a href=\"?_src_=prefs;task=close;preference=disabilities\">\[Done\]</a>
Expand Down Expand Up @@ -2959,6 +2961,9 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
if((disabilities & DISABILITY_FLAG_PARAPLEGIA) && !(new_species.blacklisted_disabilities & DISABILITY_FLAG_PARAPLEGIA))
character.force_gene_block(GLOB.paraplegiablock, TRUE, TRUE)

if((disabilities & DISABILITY_FLAG_APHASIA) && !(new_species.blacklisted_disabilities & DISABILITY_FLAG_APHASIA))
character.force_gene_block(GLOB.aphasiablock, TRUE, TRUE)

character.dna.species.handle_dna(character)

if(character.dna.dirtySE)
Expand Down
31 changes: 20 additions & 11 deletions code/modules/mob/language.dm
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,9 @@


// Language handling.
/mob/proc/add_language(language_name)
/mob/proc/add_language(language_name, var/only_listening = FALSE)
if(SEND_SIGNAL(src, COMSIG_MOB_LANGUAGE_ADD, language_name) & DISEASE_MOB_LANGUAGE_PROCESSED)
return TRUE
return FALSE

var/datum/language/new_language = GLOB.all_languages[language_name]
if(new_language in languages)
Expand All @@ -920,24 +920,33 @@
if(!istype(new_language))
return FALSE

. = !LAZYIN(languages, new_language)
if(.)
LAZYADD(languages, new_language)
if(only_listening)
. = !LAZYIN(languages_only_listen, new_language)
if(.)
LAZYADD(languages_only_listen, new_language)
else
. = !LAZYIN(languages, new_language)
if(.)
LAZYADD(languages, new_language)


/mob/proc/remove_language(language_name)
/mob/proc/remove_language(language_name, var/only_listening = FALSE)
if(SEND_SIGNAL(src, COMSIG_MOB_LANGUAGE_REMOVE, language_name) & DISEASE_MOB_LANGUAGE_PROCESSED)
return TRUE
return FALSE

var/datum/language/rem_language = GLOB.all_languages[language_name]
if(!istype(rem_language))
rem_language = GLOB.all_languages[convert_lang_key_to_name(language_name)]
if(!istype(rem_language))
return FALSE

. = LAZYIN(languages, rem_language)
if(.)
LAZYREMOVE(languages, rem_language)
if(only_listening)
. = LAZYIN(languages_only_listen, rem_language)
if(.)
LAZYREMOVE(languages_only_listen, rem_language)
else
. = LAZYIN(languages, rem_language)
if(.)
LAZYREMOVE(languages, rem_language)


/mob/living/remove_language(language_name)
Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/carbon/human/human_say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
if(dna?.species?.can_understand(other))
return TRUE

if(speaking in languages_only_listen)
return TRUE

//These only pertain to common. Languages are handled by mob/say_understands()
if(!speaking)
if(isnymph(other) && LAZYLEN(other.languages) >= 2) //They've sucked down some blood and can speak common now.
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
var/exploit_record = ""
/// For speaking/listening.
var/list/datum/language/languages
/// For understanding the language without ability to speak. Still can speak if lang is in /languages list
var/list/datum/language/languages_only_listen
/// For reagents that grant language knowlege.
var/list/temporary_languages
var/list/speak_emote = list("says") // Verbs used when speaking. Defaults to 'say' if speak_emote is null.
Expand Down