From 32aed1c9849278f64b1ad11314dd3323b67fd46f Mon Sep 17 00:00:00 2001 From: Fluffy <65877598+FluffyGhoster@users.noreply.github.com> Date: Wed, 21 Feb 2024 12:44:05 +0100 Subject: [PATCH] sdaf (#18492) --- code/modules/balloon_alert/balloon_alert.dm | 2 +- .../preference_setup/loadout/gear_tweaks.dm | 4 +- code/modules/mob/say.dm | 30 ++++++++++--- code/modules/organs/subtypes/augment.dm | 14 +++++- html/changelogs/fluffyghost-fixbundle.yml | 45 +++++++++++++++++++ 5 files changed, 86 insertions(+), 9 deletions(-) create mode 100644 html/changelogs/fluffyghost-fixbundle.yml diff --git a/code/modules/balloon_alert/balloon_alert.dm b/code/modules/balloon_alert/balloon_alert.dm index 9d5172951dc..02150772e53 100644 --- a/code/modules/balloon_alert/balloon_alert.dm +++ b/code/modules/balloon_alert/balloon_alert.dm @@ -20,7 +20,7 @@ var/list/hearers = UNLINT(get_hearers_in_view(vision_distance, src)) hearers -= ignored_mobs - for(var/mob/hearer as anything in hearers - src) + for(var/mob/hearer in hearers - src) if(hearer.is_blind()) continue balloon_alert(hearer, message) diff --git a/code/modules/client/preference_setup/loadout/gear_tweaks.dm b/code/modules/client/preference_setup/loadout/gear_tweaks.dm index 2381e06b6f9..7df536d4f4c 100644 --- a/code/modules/client/preference_setup/loadout/gear_tweaks.dm +++ b/code/modules/client/preference_setup/loadout/gear_tweaks.dm @@ -234,7 +234,9 @@ Reagents adjustment . = valid_reagents[pick(valid_reagents)] else . = valid_reagents[metadata] - I.reagents.add_reagent(., REAGENTS_FREE_SPACE(I.reagents)) + + if(!isnull(.)) + I.reagents.add_reagent(., REAGENTS_FREE_SPACE(I.reagents)) /* Custom Name diff --git a/code/modules/mob/say.dm b/code/modules/mob/say.dm index 72abe2ea6e8..0344e48135c 100644 --- a/code/modules/mob/say.dm +++ b/code/modules/mob/say.dm @@ -143,20 +143,38 @@ return null -//parses the language code (e.g. :j) from text, such as that supplied to say. -//returns the language object only if the code corresponds to a language that src can speak, otherwise null. -/mob/proc/parse_language(var/message) +/** + * Parses the language code (e.g. :j) from text, such as that supplied to say + * + * Returns a `/datum/language` only if the code corresponds to a language that src can speak, otherwise `null` + * + * * message - A string, the message to parse + */ +/mob/proc/parse_language(message) + SHOULD_NOT_SLEEP(TRUE) + SHOULD_BE_PURE(TRUE) + RETURN_TYPE(/datum/language) + var/prefix = copytext(message,1,2) if(length(message) >= 1 && prefix == "!") return GLOB.all_languages[LANGUAGE_NOISE] + //Check that the message is at least 2 characters long and is there's a prefix starting it if(length(message) >= 2 && is_language_prefix(prefix)) + + //Get the first 2 letters after the prefix (position 2 and 3) var/language_prefix = lowertext(copytext(message, 2, 4)) + + //Try to grab a language associated with said prefix var/datum/language/L = GLOB.language_keys[language_prefix] - if(!L || !can_speak(L)) + + //If we didn't find a language, or we found one we cannot speak, try with a single letter identification + if(!istype(L) || (istype(L) && !can_speak(L))) language_prefix = lowertext(copytext(message, 2, 3)) L = GLOB.language_keys[language_prefix] + + //Check if we can speak the language, otherwise return null if(can_speak(L)) return L - - return null + else + return null diff --git a/code/modules/organs/subtypes/augment.dm b/code/modules/organs/subtypes/augment.dm index f7b563e2915..1bceecd87e2 100644 --- a/code/modules/organs/subtypes/augment.dm +++ b/code/modules/organs/subtypes/augment.dm @@ -120,7 +120,19 @@ M.item_flags |= ITEM_FLAG_NO_MOVE owner.equip_to_slot(M, aug_slot) var/obj/item/organ/O = owner.organs_by_name[parent_organ] - owner.visible_message(SPAN_NOTICE("\The [M] slides out of \the [owner]'s [O.name]."), SPAN_NOTICE("You deploy \the [M]!")) + + //If we didn't found the organ, it might be a sub-organ, search for it + if(!O) + for(var/external_organ_key in owner.organs_by_name) + var/obj/item/organ/external/external_organ = owner.organs_by_name[external_organ_key] + for(var/obj/item/organ/internal/internal_organ in external_organ.internal_organs) + if(internal_organ.organ_tag == parent_organ) + O = internal_organ + break + + //If we have found it, print the message, otherwise don't bother, it would just runtime + if(O) + owner.visible_message(SPAN_NOTICE("\The [M] slides out of \the [owner]'s [O.name]."), SPAN_NOTICE("You deploy \the [M]!")) /obj/item/organ/internal/augment/tool/combitool name = "retractable combitool" diff --git a/html/changelogs/fluffyghost-fixbundle.yml b/html/changelogs/fluffyghost-fixbundle.yml new file mode 100644 index 00000000000..27aeb12829a --- /dev/null +++ b/html/changelogs/fluffyghost-fixbundle.yml @@ -0,0 +1,45 @@ +################################ +# 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: "Resolved a runtime with reagents gear tweak on fill." + - bugfix: "Resolved a runtime with baloon alerts that assumed every hearer was a mob, while that could not be the case." + - bugfix: "Resolved a runtime with a chat parsing proc." + - refactor: "Refactored said parsing proc (parse_language) to be slightly less bad, added DMDoc, added SDMM headers." + - bugfix: "Resolved a runtime with implants on non-major organs."