Skip to content

Commit

Permalink
[MIRROR] Add Sensitive Hearing: Teshari ears for everyone (#5297)
Browse files Browse the repository at this point in the history
* Add Sensitive Hearing: Teshari ears for everyone (#4754)

* Add Sensitive Hearing quirk
Add sensitive ears organ for quirk users
Fix Teshari hearing being broken without admin intervention when ears are removed while teshari hearing is active
Add conditional flavor text changes to Teshari hearing for Sensitive Hearing users

* I'm not doing that lol

* neocloudy teaches me why ternary exists
Reformatted comments / add one explaining why the ternary

* dmdoc-ified the comments but for real this time

* MORE COMMENT TOUCHING

* Update code/controllers/subsystem/processing/quirks.dm

---------

Co-authored-by: Bloop <[email protected]>

* [MIRROR] Add Sensitive Hearing: Teshari ears for everyone

---------

Co-authored-by: DBGit42 <[email protected]>
Co-authored-by: Bloop <[email protected]>
Co-authored-by: StealsThePRs <[email protected]>
  • Loading branch information
4 people authored Jan 18, 2025
1 parent 392a892 commit 4d6aac7
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 11 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/~nova_defines/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define TRAIT_EXCITABLE "wagwag" //Will wag when patted!
#define TRAIT_OXYIMMUNE "oxyimmune" // Immune to oxygen damage, ideally give this to all non-breathing species or bad stuff will happen
#define TRAIT_AFFECTION_AVERSION "affection_aversion" // No more dogborg licking. "Dogborg bad" is no longer a personality
#define TRAIT_SENSITIVE_HEARING "sensitive_hearing" // Teshari hearing, but as a quirk
#define TRAIT_PERSONALSPACE "personalspace" // Block/counter-attack ass-slaps
#define TRAIT_QUICKREFLEXES "quickreflexes" // Counters hugs and headpats
#define TRAIT_MOOD_NOEXAMINE "mood_noexamine" // Can't assess your own mood
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_RSD_COMPATIBLE" = TRAIT_RSD_COMPATIBLE,
"TRAIT_SACRIFICED" = TRAIT_SACRIFICED ,
"TRAIT_SADISM" = TRAIT_SADISM,
"TRAIT_SENSITIVE_HEARING" = TRAIT_SENSITIVE_HEARING,
"TRAIT_SENSITIVESNOUT" = TRAIT_SENSITIVESNOUT,
"TRAIT_SLICK_SKIN" = TRAIT_SLICK_SKIN,
"TRAIT_SLIPPERY" = TRAIT_SLIPPERY,
Expand Down
3 changes: 2 additions & 1 deletion code/controllers/subsystem/processing/quirks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ GLOBAL_LIST_INIT_TYPED(quirk_blacklist, /list/datum/quirk, list(
list(/datum/quirk/light_drinker, /datum/quirk/drunkhealing),
list(/datum/quirk/oversized, /datum/quirk/freerunning),
list(/datum/quirk/oversized, /datum/quirk/item_quirk/settler),
list(/datum/quirk/echolocation, /datum/quirk/item_quirk/blindness, /datum/quirk/item_quirk/nearsighted, /datum/quirk/item_quirk/deafness)
list(/datum/quirk/echolocation, /datum/quirk/item_quirk/blindness, /datum/quirk/item_quirk/nearsighted, /datum/quirk/item_quirk/deafness),
list(/datum/quirk/sensitive_hearing, /datum/quirk/item_quirk/blindness, /datum/quirk/item_quirk/deafness, /datum/quirk/echolocation),
//NOVA EDIT ADDITION END
))

Expand Down
38 changes: 38 additions & 0 deletions modular_nova/master_files/code/datums/traits/good.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,41 @@
qdel(old_appendix)

old_appendix = null

/datum/quirk/sensitive_hearing // Teshari hearing but as a quirk
name = "Sensitive Hearing"
desc = "You can hear even the quietest of sounds, but you're more vulnerable to hearing damage as a result. NOTE: This is a direct downgrade for Teshari!"
icon = FA_ICON_HEADPHONES_SIMPLE
value = 6
gain_text = span_notice("You could hear a pin drop from 10 feet away.")
lose_text = span_danger("Your hearing feels less sensitive.")
medical_record_text = "Patient scored very highly in hearing tests."

var/obj/item/organ/ears/old_ears // The mob's original ears, just in case.
var/obj/item/organ/ears/sensitive/sensitive_ears = new /obj/item/organ/ears/sensitive // The replacement ears.

/datum/quirk/sensitive_hearing/post_add()
var/mob/living/carbon/carbon_quirk_holder = quirk_holder
old_ears = carbon_quirk_holder.get_organ_slot(ORGAN_SLOT_EARS)

if(!isnull(old_ears))
old_ears.Remove(carbon_quirk_holder, special = TRUE)
old_ears.moveToNullspace()
STOP_PROCESSING(SSobj, old_ears)

sensitive_ears.Insert(carbon_quirk_holder, special = TRUE)

/datum/quirk/sensitive_hearing/remove()
var/mob/living/carbon/carbon_quirk_holder = quirk_holder
var/obj/item/organ/ears/current_ears = carbon_quirk_holder.get_organ_slot(ORGAN_SLOT_EARS)

if(isnull(old_ears)) // Make new generic ears if the original ones are missing
old_ears = new /obj/item/organ/ears

// Return the original ears.
if(!isnull(current_ears))
current_ears.Remove(carbon_quirk_holder, special = TRUE)
qdel(current_ears)

old_ears.Insert(carbon_quirk_holder, special = TRUE)
old_ears = null
60 changes: 50 additions & 10 deletions modular_nova/modules/organs/code/ears.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/// Teshari ears, but as a quirk/organ
/obj/item/organ/ears/sensitive
name = "sensitive ears"
desc = "Highly sensitive ears capable of detecting even the smallest noises."
damage_multiplier = 2
actions_types = list(/datum/action/cooldown/spell/teshari_hearing)

/obj/item/organ/ears/sensitive/on_mob_remove(mob/living/carbon/ear_owner)
. = ..()
// Prevents sensitive hearing from being broken without admin intervention if the quirk/organ is removed while active
if(ear_owner.has_status_effect(/datum/status_effect/teshari_hearing))
ear_owner.remove_status_effect(/datum/status_effect/teshari_hearing)

ear_owner.remove_traits(list(TRAIT_GOOD_HEARING, TRAIT_SENSITIVE_HEARING), ORGAN_TRAIT)

/obj/item/organ/ears/sensitive/on_mob_insert(mob/living/carbon/ear_owner)
. = ..()
// TRAIT_SENSITIVE_HEARING is important for the flavor text distinction
ADD_TRAIT(ear_owner, TRAIT_SENSITIVE_HEARING, ORGAN_TRAIT)

/obj/item/organ/ears/teshari
name = "teshari ears"
desc = "A set of four long rabbit-like ears, a Teshari's main tool while hunting. Naturally extremely sensitive to loud sounds."
Expand All @@ -8,11 +28,15 @@

/obj/item/organ/ears/teshari/on_mob_remove(mob/living/carbon/ear_owner)
. = ..()
// Prevents teshari hearing from being broken without admin intervention if the organ is removed while active
if(ear_owner.has_status_effect(/datum/status_effect/teshari_hearing))
ear_owner.remove_status_effect(/datum/status_effect/teshari_hearing)

REMOVE_TRAIT(ear_owner, TRAIT_GOOD_HEARING, ORGAN_TRAIT)

/datum/action/cooldown/spell/teshari_hearing
name = "Toggle Sensitive Hearing"
desc = "Perk up your ears to listen for quiet sounds, useful for picking up whispering."
desc = "Listen for quiet sounds, useful for picking up whispering."
button_icon = 'modular_nova/master_files/icons/hud/actions.dmi'
button_icon_state = "echolocation_off"
background_icon_state = "bg_alien"
Expand All @@ -21,7 +45,8 @@
cooldown_time = 1 SECONDS
spell_requirements = NONE

/datum/action/cooldown/spell/teshari_hearing/proc/update_button_state(new_state) //This makes it so that the button icon changes dynamically based on ears being up or not.
/// Updates the icon on the teshari hearing action for when it's on/off
/datum/action/cooldown/spell/teshari_hearing/proc/update_button_state(new_state)
button_icon_state = new_state
owner.update_action_buttons()

Expand All @@ -33,29 +58,40 @@
/datum/action/cooldown/spell/teshari_hearing/cast(list/targets, mob/living/carbon/human/user = usr)
. = ..()

if(HAS_TRAIT(user, TRAIT_GOOD_HEARING))
if(user.has_status_effect(/datum/status_effect/teshari_hearing))
teshari_hearing_deactivate(user)
return

var/hearing_enable_message = "[user] perks up [user.p_their()] four ears, each twitching intently!"
var/hearing_enable_usermessage = "You perk up all four of your ears, hunting for even the quietest sounds."
if(HAS_TRAIT(user, TRAIT_SENSITIVE_HEARING))
hearing_enable_message = "[user] starts to listen intently!"
hearing_enable_usermessage = "You start to listen intently for quiet sounds."

user.apply_status_effect(/datum/status_effect/teshari_hearing)
user.visible_message(span_notice("[user], pricks up [user.p_their()] four ears, each twitching intently!"), span_notice("You perk up all four of your ears, hunting for even the quietest sounds."))
user.visible_message(span_notice(hearing_enable_message), span_notice(hearing_enable_usermessage))
update_button_state("echolocation_on")

var/obj/item/organ/ears/ears = user.get_organ_slot(ORGAN_SLOT_EARS)
if(ears)
ears.damage_multiplier = 3

/datum/action/cooldown/spell/teshari_hearing/proc/teshari_hearing_deactivate(mob/living/carbon/human/user) //Called when you activate it again after casting the ability-- turning them off, so to say.
if(!HAS_TRAIT_FROM(user, TRAIT_GOOD_HEARING, ORGAN_TRAIT))
return
/// Called when you cast teshari hearing again after enabling it, thereby making it a one-button toggle
/datum/action/cooldown/spell/teshari_hearing/proc/teshari_hearing_deactivate(mob/living/carbon/human/user)
var/hearing_disable_message = "[user] drops [user.p_their()] ears down a bit, no longer listening as closely."
var/hearing_disable_usermessage = "You drop your ears down, no longer paying close attention."
if(HAS_TRAIT(user, TRAIT_SENSITIVE_HEARING))
hearing_disable_message = "[user] stops listening for quiet sounds."
hearing_disable_usermessage = "You stop listening for quiet sounds."

user.remove_status_effect(/datum/status_effect/teshari_hearing)
user.visible_message(span_notice("[user] drops [user.p_their()] ears down a bit, no longer listening as closely."), span_notice("You drop your ears down, no longer paying close attention."))
user.visible_message(span_notice(hearing_disable_message), span_notice(hearing_disable_usermessage))
update_button_state("echolocation_off")

var/obj/item/organ/ears/ears = user.get_organ_slot(ORGAN_SLOT_EARS)
if(ears)
ears.damage_multiplier = 1.5
// Sensitive Hearing users take more hearing damage when they're not listening
ears.damage_multiplier = HAS_TRAIT(user, TRAIT_SENSITIVE_HEARING) ? 2 : 1.5

/datum/status_effect/teshari_hearing
id = "teshari_hearing"
Expand All @@ -71,4 +107,8 @@
return ..()

/datum/status_effect/teshari_hearing/get_examine_text()
return span_notice("[owner.p_They()] [owner.p_have()] [owner.p_their()] ears perked up, listening closely to whisper-quiet sounds.")
var/hearing_examine_text = "[owner.p_They()] [owner.p_have()] [owner.p_their()] ears perked up, listening closely to whisper-quiet sounds."
if(HAS_TRAIT(owner, TRAIT_SENSITIVE_HEARING))
hearing_examine_text = "[owner.p_Theyre()] listening intently for whisper-quiet sounds."

return span_notice(hearing_examine_text)

0 comments on commit 4d6aac7

Please sign in to comment.