mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 07:08:00 +01:00
Fixes some issues with deafness & earhealing (#69136)
1- Replaces checks for deafness as a clothing trait, since clothing traits' have a ref to themselves in the source 2- Makes ear healing not NOT heal if you're above 0 ear damage, because that's the point of fixing your ears?
This commit is contained in:
@@ -2,25 +2,23 @@
|
||||
element_flags = ELEMENT_DETACH
|
||||
var/list/user_by_item = list()
|
||||
|
||||
/datum/element/earhealing/New()
|
||||
START_PROCESSING(SSdcs, src)
|
||||
|
||||
/datum/element/earhealing/Attach(datum/target)
|
||||
. = ..()
|
||||
if(!isitem(target))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
|
||||
RegisterSignal(target, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED), .proc/equippedChanged)
|
||||
RegisterSignal(target, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED), .proc/on_equip)
|
||||
|
||||
/datum/element/earhealing/Detach(datum/target)
|
||||
. = ..()
|
||||
UnregisterSignal(target, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED))
|
||||
user_by_item -= target
|
||||
|
||||
/datum/element/earhealing/proc/equippedChanged(datum/source, mob/living/carbon/user, slot)
|
||||
/datum/element/earhealing/proc/on_equip(datum/source, mob/living/carbon/user, slot)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(slot == ITEM_SLOT_EARS && istype(user))
|
||||
START_PROCESSING(SSdcs, src)
|
||||
user_by_item[source] = user
|
||||
else
|
||||
user_by_item -= source
|
||||
@@ -29,8 +27,8 @@
|
||||
for(var/i in user_by_item)
|
||||
var/mob/living/carbon/user = user_by_item[i]
|
||||
var/obj/item/organ/internal/ears/ears = user.getorganslot(ORGAN_SLOT_EARS)
|
||||
if(!ears || HAS_TRAIT_NOT_FROM(user, TRAIT_DEAF, EAR_DAMAGE))
|
||||
if(!ears || !ears.damage || ears.organ_flags & ORGAN_FAILING)
|
||||
continue
|
||||
ears.deaf = max(ears.deaf - 0.25 * delta_time, (ears.damage < ears.maxHealth ? 0 : 1)) // Do not clear deafness if our ears are too damaged
|
||||
ears.applyOrganDamage(-0.025 * delta_time, 0)
|
||||
ears.applyOrganDamage(-0.025 * delta_time)
|
||||
CHECK_TICK
|
||||
|
||||
@@ -193,8 +193,8 @@
|
||||
if(HAS_TRAIT_FROM(owner, TRAIT_BLIND, BLINDFOLD_TRAIT) || is_sleeping_in_darkness)
|
||||
healing += 0.1
|
||||
|
||||
// sleeping with earmuffs helps blockout the noise as well
|
||||
if(HAS_TRAIT_FROM(src, TRAIT_DEAF, CLOTHING_TRAIT))
|
||||
// sleeping in silence is always better
|
||||
if(HAS_TRAIT(src, TRAIT_DEAF))
|
||||
healing += 0.1
|
||||
|
||||
// check for beds
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
victim = null
|
||||
return
|
||||
victim.cure_blind("hypnochair")
|
||||
REMOVE_TRAIT(victim, TRAIT_DEAF, "hypnochair")
|
||||
REMOVE_TRAIT(victim, TRAIT_DEAF, HYPNOCHAIR_TRAIT)
|
||||
if(!(victim.get_eye_protection() > 0))
|
||||
var/time_diff = world.time - start_time
|
||||
switch(time_diff)
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
if(!ishuman(user) || !IS_HERETIC_OR_MONSTER(user))
|
||||
return
|
||||
|
||||
ADD_TRAIT(user, heretic_only_trait, "[CLOTHING_TRAIT] [REF(src)]")
|
||||
ADD_TRAIT(user, heretic_only_trait, "[CLOTHING_TRAIT]_[REF(src)]")
|
||||
user.update_sight()
|
||||
|
||||
/obj/item/clothing/neck/eldritch_amulet/dropped(mob/user)
|
||||
. = ..()
|
||||
REMOVE_TRAIT(user, heretic_only_trait, "[CLOTHING_TRAIT] [REF(src)]")
|
||||
REMOVE_TRAIT(user, heretic_only_trait, "[CLOTHING_TRAIT]_[REF(src)]")
|
||||
user.update_sight()
|
||||
|
||||
/obj/item/clothing/neck/eldritch_amulet/piercing
|
||||
|
||||
@@ -239,7 +239,7 @@
|
||||
return
|
||||
UnregisterSignal(user, COMSIG_MOVABLE_MOVED)
|
||||
for(var/trait in clothing_traits)
|
||||
REMOVE_TRAIT(user, trait, "[CLOTHING_TRAIT] [REF(src)]")
|
||||
REMOVE_TRAIT(user, trait, "[CLOTHING_TRAIT]_[REF(src)]")
|
||||
|
||||
|
||||
if(LAZYLEN(user_vars_remembered))
|
||||
@@ -257,7 +257,7 @@
|
||||
if(iscarbon(user) && LAZYLEN(zones_disabled))
|
||||
RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/bristle, override = TRUE)
|
||||
for(var/trait in clothing_traits)
|
||||
ADD_TRAIT(user, trait, "[CLOTHING_TRAIT] [REF(src)]")
|
||||
ADD_TRAIT(user, trait, "[CLOTHING_TRAIT]_[REF(src)]")
|
||||
if (LAZYLEN(user_vars_to_edit))
|
||||
for(var/variable in user_vars_to_edit)
|
||||
if(variable in user.vars)
|
||||
|
||||
@@ -442,7 +442,7 @@
|
||||
brute_loss = 30*(2 - round(bomb_armor*0.01, 0.05))
|
||||
burn_loss = brute_loss //damage gets reduced from 120 to up to 60 combined brute+burn
|
||||
damage_clothes(200 - bomb_armor, BRUTE, BOMB)
|
||||
if (ears && !HAS_TRAIT_FROM(src, TRAIT_DEAF, CLOTHING_TRAIT))
|
||||
if (ears && !HAS_TRAIT_FROM_ONLY(src, TRAIT_DEAF, EAR_DAMAGE))
|
||||
ears.adjustEarDamage(30, 120)
|
||||
Unconscious(20) //short amount of time for follow up attacks against elusive enemies like wizards
|
||||
Knockdown(200 - (bomb_armor * 1.6)) //between ~4 and ~20 seconds of knockdown depending on bomb armor
|
||||
@@ -452,7 +452,7 @@
|
||||
if(bomb_armor)
|
||||
brute_loss = 15*(2 - round(bomb_armor*0.01, 0.05))
|
||||
damage_clothes(max(50 - bomb_armor, 0), BRUTE, BOMB)
|
||||
if (ears && !HAS_TRAIT_FROM(src, TRAIT_DEAF, CLOTHING_TRAIT))
|
||||
if (ears && !HAS_TRAIT_FROM_ONLY(src, TRAIT_DEAF, EAR_DAMAGE))
|
||||
ears.adjustEarDamage(15,60)
|
||||
Knockdown(160 - (bomb_armor * 1.6)) //100 bomb armor will prevent knockdown altogether
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
current_target.set_timed_status_effect(40 SECONDS, /datum/status_effect/speech/stutter)
|
||||
var/obj/item/organ/internal/ears/target_ears = current_target.getorganslot(ORGAN_SLOT_EARS)
|
||||
if(target_ears && !HAS_TRAIT_FROM(current_target, TRAIT_DEAF, CLOTHING_TRAIT))
|
||||
if(target_ears && !HAS_TRAIT(current_target, TRAIT_DEAF))
|
||||
target_ears.adjustEarDamage(0, 5) //far less damage than the H.O.N.K.
|
||||
current_target.set_timed_status_effect(100 SECONDS, /datum/status_effect/jitter, only_if_higher = TRUE)
|
||||
current_target.Paralyze(6 SECONDS)
|
||||
|
||||
Reference in New Issue
Block a user