diff --git a/code/modules/mob/language/language.dm b/code/modules/mob/language/language.dm index 3332ac6fa95..a6a0f91af79 100644 --- a/code/modules/mob/language/language.dm +++ b/code/modules/mob/language/language.dm @@ -261,8 +261,22 @@ default_language = null return ..() -// Can we speak this language, as opposed to just understanding it? +/** + * Check if the language can be spoken by the mob, + * not the same thing as understood (you can understand a language without speaking it) + * + * * speaking - The `/datum/language` to check against, if the mob can speak it + * + * Returns `TRUE` if the mob speaks the language, `FALSE` otherwise + */ /mob/proc/can_speak(datum/language/speaking) + SHOULD_NOT_SLEEP(TRUE) + SHOULD_BE_PURE(TRUE) + + if(!istype(speaking)) + stack_trace("No language supplied to check if it can be spoken!") + return FALSE + return (speaking.check_speech_restrict(src) && (universal_speak || (speaking && speaking.flags & INNATE) || (speaking in src.languages))) /mob/proc/get_language_prefix() diff --git a/code/modules/mob/say.dm b/code/modules/mob/say.dm index 0344e48135c..28bd4cf3151 100644 --- a/code/modules/mob/say.dm +++ b/code/modules/mob/say.dm @@ -174,7 +174,7 @@ L = GLOB.language_keys[language_prefix] //Check if we can speak the language, otherwise return null - if(can_speak(L)) + if(istype(L) && can_speak(L)) return L else return null diff --git a/html/changelogs/fluffyghost-fixcanspeakruntime2.yml b/html/changelogs/fluffyghost-fixcanspeakruntime2.yml new file mode 100644 index 00000000000..4fe68c7ac43 --- /dev/null +++ b/html/changelogs/fluffyghost-fixcanspeakruntime2.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: FluffyGhost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixed yet another canspeak runtime." + - backend: "Added some SDMM markings, DMDoced the proc, added a guard in case the language is not supplied to the proc."