From bd2506d8a0f01fb51e7ff570711db7a435097aa7 Mon Sep 17 00:00:00 2001 From: Geeves Date: Sat, 8 Feb 2020 16:31:11 +0200 Subject: [PATCH] Hearing Aids (#8138) --- aurorastation.dme | 1 + code/game/objects/items/devices/hearing_aid.dm | 14 ++++++++++++++ .../preference_setup/loadout/loadout_utility.dm | 14 +++++++++++++- code/modules/mob/emote.dm | 12 ++++++++---- code/modules/mob/hear_say.dm | 7 ++++++- .../mob/living/carbon/human/human_helpers.dm | 7 ++++++- html/changelogs/geeves-cockleear.yml | 6 ++++++ icons/obj/hearing_aid.dmi | Bin 0 -> 661 bytes 8 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 code/game/objects/items/devices/hearing_aid.dm create mode 100644 html/changelogs/geeves-cockleear.yml create mode 100644 icons/obj/hearing_aid.dmi diff --git a/aurorastation.dme b/aurorastation.dme index 8247eb13a14..e9c267a116f 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -804,6 +804,7 @@ #include "code\game\objects\items\devices\flash.dm" #include "code\game\objects\items\devices\floor_painter.dm" #include "code\game\objects\items\devices\hacktool.dm" +#include "code\game\objects\items\devices\hearing_aid.dm" #include "code\game\objects\items\devices\holowarrant.dm" #include "code\game\objects\items\devices\laserpointer.dm" #include "code\game\objects\items\devices\lightmeter.dm" diff --git a/code/game/objects/items/devices/hearing_aid.dm b/code/game/objects/items/devices/hearing_aid.dm new file mode 100644 index 00000000000..0d879cfa0bc --- /dev/null +++ b/code/game/objects/items/devices/hearing_aid.dm @@ -0,0 +1,14 @@ +/obj/item/device/hearing_aid + name = "hearing aid" + desc = "A device of Skrellian design. It allows the naturally deaf to hear, to an extent." + icon = 'icons/obj/hearing_aid.dmi' + icon_state = "hearing_aid" + item_state = "hearing_aid" + contained_sprite = TRUE + slot_flags = SLOT_EARS + w_class = ITEMSIZE_SMALL + +/obj/item/device/hearing_aid/human + desc = "A device that allows the naturally deaf to hear, to an extent." + icon_state = "hearing_aid_human" + item_state = "hearing_aid_human" \ No newline at end of file diff --git a/code/modules/client/preference_setup/loadout/loadout_utility.dm b/code/modules/client/preference_setup/loadout/loadout_utility.dm index ab732461043..c02e0496fb4 100644 --- a/code/modules/client/preference_setup/loadout/loadout_utility.dm +++ b/code/modules/client/preference_setup/loadout/loadout_utility.dm @@ -51,6 +51,18 @@ fountainpens["white fountain pen"] = /obj/item/pen/fountain/white gear_tweaks += new/datum/gear_tweak/path(fountainpens) +/datum/gear/utility/hearing_aid + display_name = "hearing aid selection" + path = /obj/item/device/hearing_aid + cost = 1 + +/datum/gear/utility/hearing_aid/New() + ..() + var/hearingaids = list() + hearingaids["hearing aid, skrell design"] = /obj/item/device/hearing_aid + hearingaids["hearing aid, human design"] = /obj/item/device/hearing_aid/human + gear_tweaks += new/datum/gear_tweak/path(hearingaids) + /datum/gear/utility/paicard display_name = "personal AI device" path = /obj/item/device/paicard @@ -125,4 +137,4 @@ display_name = "tool-belt, alt" cost = 0 path = /obj/item/storage/belt/utility/alt - allowed_roles = list("Station Engineer", "Atmospheric Technician", "Chief Engineer", "Engineering Apprentice", "Roboticist") \ No newline at end of file + allowed_roles = list("Station Engineer", "Atmospheric Technician", "Chief Engineer", "Engineering Apprentice", "Roboticist") diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm index a19cbd91747..2844707a554 100644 --- a/code/modules/mob/emote.dm +++ b/code/modules/mob/emote.dm @@ -57,6 +57,12 @@ var/list/messageturfs = list()//List of turfs we broadcast to. var/list/messagemobs = list()//List of living mobs nearby who can hear it, and distant ghosts who've chosen to hear it var/list/messagemobs_neardead = list()//List of nearby ghosts who can hear it. Those that qualify ONLY go in this list + + var/hearing_aid = FALSE + if(type == 2 && ishuman(src)) + var/mob/living/carbon/human/H = src + hearing_aid = H.has_hearing_aid() + for (var/turf in view(world.view, get_turf(src))) messageturfs += turf @@ -67,10 +73,10 @@ if (istype(M, /mob/abstract/observer)) messagemobs_neardead += M continue - else if (istype(M, /mob/living) && !(type == 2 && (sdisabilities & DEAF || ear_deaf))) + else if (isliving(M) && !(type == 2 && ((sdisabilities & DEAF) && !hearing_aid) || ear_deaf > 1)) messagemobs += M else if(src.client) - if (M.stat == DEAD && (M.client.prefs.toggles & CHAT_GHOSTSIGHT)) + if (M.stat == DEAD && (M.client.prefs.toggles & CHAT_GHOSTSIGHT)) messagemobs += M continue @@ -81,5 +87,3 @@ for (var/mob/O in messagemobs_neardead) O.show_message(message, type) - - diff --git a/code/modules/mob/hear_say.dm b/code/modules/mob/hear_say.dm index 51562e4055e..38e49c55fd1 100644 --- a/code/modules/mob/hear_say.dm +++ b/code/modules/mob/hear_say.dm @@ -59,7 +59,12 @@ if(client.prefs.toggles & CHAT_GHOSTEARS && speaker in view(src)) message = "[message]" - if(sdisabilities & DEAF || ear_deaf) + var/hearing_aid = FALSE + if(ishuman(src)) + var/mob/living/carbon/human/H = src + hearing_aid = H.has_hearing_aid() + + if(((sdisabilities & DEAF) && !hearing_aid) || ear_deaf > 1) if(!language || !(language.flags & INNATE)) // INNATE is the flag for audible-emote-language, so we don't want to show an "x talks but you cannot hear them" message if it's set if(speaker == src) to_chat(src, "You cannot hear yourself speak!") diff --git a/code/modules/mob/living/carbon/human/human_helpers.dm b/code/modules/mob/living/carbon/human/human_helpers.dm index 15e4f2e8396..79bcf394544 100644 --- a/code/modules/mob/living/carbon/human/human_helpers.dm +++ b/code/modules/mob/living/carbon/human/human_helpers.dm @@ -184,4 +184,9 @@ if(istype(bg) && bg.client) return bg - return src \ No newline at end of file + return src + +/mob/living/carbon/human/proc/has_hearing_aid() + if(istype(l_ear, /obj/item/device/hearing_aid) || istype(r_ear, /obj/item/device/hearing_aid)) + return TRUE + return FALSE \ No newline at end of file diff --git a/html/changelogs/geeves-cockleear.yml b/html/changelogs/geeves-cockleear.yml new file mode 100644 index 00000000000..72c4e97c224 --- /dev/null +++ b/html/changelogs/geeves-cockleear.yml @@ -0,0 +1,6 @@ +author: Code by Geeves, Sprites by Wezzy + +delete-after: True + +changes: + - rscadd: "Added a hearing aid item. Also added it to the Utility catagory in the loadout menu. There are two designs, Skrellian and Human. Both designs work for any species." \ No newline at end of file diff --git a/icons/obj/hearing_aid.dmi b/icons/obj/hearing_aid.dmi new file mode 100644 index 0000000000000000000000000000000000000000..b7afd3fba00f5f34aa5084ff37175c63626bfa7d GIT binary patch literal 661 zcmV;G0&4w004jp0{{R3ySfFDZ*Bkpc$`yKaB_9`^iy#0_2eo` zEh^5;&r`5fFwryM;w;ZhDainGjE%TBGg33tGfE(w;*!LYR3K9+BQ>!oGcP?pF*8Mp zi!&v&s2C_}$i#|4O6|9!a)bX~n&bdb_ z)Jd4D;yT|&cN4bdeBbw8IHBuL=Tq;M176M-G1pojN_73>c`|6Ac zllBhy();R+2vhct&z>@X3&RkiN3Oen-+_c-FlHFXF_W>GVg86sTr#!}^Pk^Pv3+w! z!GyO+b3(y@!|i8~Y~d>4@^@|)BxM_LnwkYkS+^`G9`W`j6zrf0)3s}w9W>#ZY6?NH zgX_L2p77i^!H3JnB%Tid001h!3fJpYFS)>X!D_i=o!u8mZLE{