From 0135644e073ea463721bf07718d605fb6e880702 Mon Sep 17 00:00:00 2001 From: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com> Date: Sat, 13 May 2023 18:24:21 -0400 Subject: [PATCH] Chemicals that reduce pain make the users personal health bar less accurate (#20970) * Chemicals that reduce pain make the users personal health bar less accurate * Update medicine.dm * health doll accuracy / screen cover * define that shit * makes it a proc --- code/modules/mob/living/carbon/carbon.dm | 8 ++++++++ code/modules/mob/living/carbon/carbon_life.dm | 7 ++++--- code/modules/mob/living/carbon/human/human_life.dm | 10 ++++++++-- code/modules/mob/living/carbon/human/human_mob.dm | 4 ++-- code/modules/reagents/chemistry/reagents/medicine.dm | 4 ++++ 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 746e6400690..00c070b2c4e 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -1122,6 +1122,14 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven KnockDown(knockdown) return TRUE +/mob/living/carbon/proc/shock_reduction() + var/shock_reduction = 0 + if(reagents) + for(var/datum/reagent/R in reagents.reagent_list) + if(R.shock_reduction) + shock_reduction += R.shock_reduction + return shock_reduction + /mob/living/carbon/proc/can_eat(flags = 255) return 1 diff --git a/code/modules/mob/living/carbon/carbon_life.dm b/code/modules/mob/living/carbon/carbon_life.dm index e991281fb7f..fc7df749d7d 100644 --- a/code/modules/mob/living/carbon/carbon_life.dm +++ b/code/modules/mob/living/carbon/carbon_life.dm @@ -293,10 +293,11 @@ /mob/living/carbon/update_damage_hud() if(!client) return + var/shock_reduction = shock_reduction() if(stat == UNCONSCIOUS && health <= HEALTH_THRESHOLD_CRIT) if(check_death_method()) var/severity = 0 - switch(health) + switch(health - shock_reduction) if(-20 to -10) severity = 1 if(-30 to -20) @@ -323,7 +324,7 @@ clear_fullscreen("crit") if(getOxyLoss()) var/severity = 0 - switch(getOxyLoss()) + switch(getOxyLoss() - shock_reduction) if(10 to 20) severity = 1 if(20 to 25) @@ -345,7 +346,7 @@ //Fire and Brute damage overlay (BSSR) var/hurtdamage = getBruteLoss() + getFireLoss() + damageoverlaytemp damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not. - if(hurtdamage) + if(hurtdamage - shock_reduction > 0) var/severity = 0 switch(hurtdamage) if(5 to 15) severity = 1 diff --git a/code/modules/mob/living/carbon/human/human_life.dm b/code/modules/mob/living/carbon/human/human_life.dm index 38edfd103f8..069c56367fc 100644 --- a/code/modules/mob/living/carbon/human/human_life.dm +++ b/code/modules/mob/living/carbon/human/human_life.dm @@ -658,14 +658,17 @@ to_chat(src, "You feel [pick("terrible", "awful", "like shit", "sick", "numb", "cold", "sweaty", "tingly", "horrible")]!") Weaken(6 SECONDS) +#define BODYPART_PAIN_REDUCTION 5 + /mob/living/carbon/human/update_health_hud() if(!client) return if(dna.species.update_health_hud()) return else + var/shock_reduction = shock_reduction() if(healths) - var/health_amount = get_perceived_trauma() + var/health_amount = get_perceived_trauma(shock_reduction) if(..(health_amount)) //not dead switch(health_hud_override) if(HEALTH_HUD_OVERRIDE_CRIT) @@ -687,9 +690,10 @@ healthdoll.icon_state = "healthdoll_DEAD" for(var/obj/item/organ/external/O in bodyparts) var/damage = O.get_damage() + damage -= shock_reduction / BODYPART_PAIN_REDUCTION var/comparison = (O.max_damage/5) var/icon_num = 0 - if(damage) + if(damage > 0) icon_num = 1 if(damage > (comparison)) icon_num = 2 @@ -704,6 +708,8 @@ healthdoll.overlays -= (cached_overlays - new_overlays) healthdoll.cached_healthdoll_overlays = new_overlays +#undef BODYPART_PAIN_REDUCTION + /mob/living/carbon/human/proc/handle_nutrition_alerts() //This is a terrible abuse of the alert system; something like this should be a HUD element if(HAS_TRAIT(src, TRAIT_NOHUNGER)) return diff --git a/code/modules/mob/living/carbon/human/human_mob.dm b/code/modules/mob/living/carbon/human/human_mob.dm index 04072b6cc74..ca4a3cc2f51 100644 --- a/code/modules/mob/living/carbon/human/human_mob.dm +++ b/code/modules/mob/living/carbon/human/human_mob.dm @@ -2011,8 +2011,8 @@ Eyes need to have significantly high darksight to shine unless the mob has the X O.toggle_biolum(TRUE) visible_message("[src] is engulfed in shadows and fades into the darkness.", "A sense of dread washes over you as you suddenly dim dark.") -/mob/living/carbon/human/proc/get_perceived_trauma() - return min(health, maxHealth - getStaminaLoss()) +/mob/living/carbon/human/proc/get_perceived_trauma(shock_reduction) + return min(health, maxHealth - getStaminaLoss()) + shock_reduction /mob/living/carbon/human/WakeUp(updating = TRUE) if(dna.species.spec_WakeUp(src)) diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index 48d5277fc9a..f1a3f4cddbe 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -23,6 +23,10 @@ shock_reduction = 200 taste_description = "numbness" +/datum/reagent/medicine/hydrocodone/on_mob_life(mob/living/M) //Needed so the hud updates when injested / removed from system + var/update_flags = STATUS_UPDATE_HEALTH + return ..() | update_flags + /datum/reagent/medicine/sterilizine name = "Sterilizine" id = "sterilizine"