From 209e7c0dfe7cbbc379b6746c57c89d37f6be3149 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Mon, 25 Apr 2022 20:34:23 -0700 Subject: [PATCH] wacky... (#3932) --- code/_rendering/atom_huds/data_huds.dm | 4 ++ .../gamemodes/changeling/powers/revive.dm | 3 +- .../mob/living/carbon/human/human_damage.dm | 55 ++++++++----------- code/modules/mob/living/living.dm | 6 +- 4 files changed, 29 insertions(+), 39 deletions(-) diff --git a/code/_rendering/atom_huds/data_huds.dm b/code/_rendering/atom_huds/data_huds.dm index 4511b7aa7d5..e21bef4ce40 100644 --- a/code/_rendering/atom_huds/data_huds.dm +++ b/code/_rendering/atom_huds/data_huds.dm @@ -65,6 +65,10 @@ else holder.icon_state = "healthy" +/mob/proc/update_hud_med_all() + update_hud_med_health() + update_hud_med_status() + /mob/proc/update_hud_sec_implants() var/image/Itrack = hud_list[IMPTRACK_HUD] var/image/Ichem = hud_list[IMPCHEM_HUD] diff --git a/code/game/gamemodes/changeling/powers/revive.dm b/code/game/gamemodes/changeling/powers/revive.dm index f1533e84f5b..91c16e6a335 100644 --- a/code/game/gamemodes/changeling/powers/revive.dm +++ b/code/game/gamemodes/changeling/powers/revive.dm @@ -41,8 +41,7 @@ current_limb.relocate() current_limb.open = 0 - H.update_hud_med_health() - H.update_hud_med_status() + H.update_hud_med_all() if(H.handcuffed) var/obj/item/W = H.handcuffed diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 73e792f0960..6186a43e558 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -1,10 +1,9 @@ //Updates the mob's health from organs and mob damage variables /mob/living/carbon/human/updatehealth() - if(status_flags & GODMODE) health = getMaxHealth() set_stat(CONSCIOUS) - return + update_hud_med_all() var/total_burn = 0 var/total_brute = 0 @@ -14,12 +13,15 @@ total_brute += O.brute_dam total_burn += O.burn_dam + var/old = health health = getMaxHealth() - getOxyLoss() - getToxLoss() - getCloneLoss() - total_burn - total_brute //TODO: fix husking if( ((getMaxHealth() - total_burn) < config_legacy.health_threshold_dead) && stat == DEAD) ChangeToHusk() - return + + if(old != health) + update_hud_med_all() /mob/living/carbon/human/adjustBrainLoss(var/amount) @@ -124,7 +126,7 @@ if(!isnull(M.incoming_healing_percent)) amount *= M.incoming_healing_percent heal_overall_damage(-amount, 0, include_robo) - update_hud_med_health() + update_hud_med_all() //'include_robo' only applies to healing, for legacy purposes, as all damage typically hurts both types of organs /mob/living/carbon/human/adjustFireLoss(var/amount,var/include_robo) @@ -142,7 +144,7 @@ if(!isnull(M.incoming_healing_percent)) amount *= M.incoming_healing_percent heal_overall_damage(0, -amount, include_robo) - update_hud_med_health() + update_hud_med_all() /mob/living/carbon/human/proc/adjustBruteLossByPart(var/amount, var/organ_name, var/obj/damage_source = null) amount = amount*species.brute_mod @@ -164,7 +166,7 @@ //if you don't want to heal robot organs, they you will have to check that yourself before using this proc. O.heal_damage(-amount, 0, internal=0, robo_repair=(O.robotic >= ORGAN_ROBOT)) - update_hud_med_health() + update_hud_med_all() /mob/living/carbon/human/proc/adjustFireLossByPart(var/amount, var/organ_name, var/obj/damage_source = null) amount = amount*species.burn_mod @@ -186,18 +188,21 @@ //if you don't want to heal robot organs, they you will have to check that yourself before using this proc. O.heal_damage(0, -amount, internal=0, robo_repair=(O.robotic >= ORGAN_ROBOT)) - update_hud_med_health() + update_hud_med_all() /mob/living/carbon/human/Stun(amount) - if(HULK in mutations) return + if(HULK in mutations) + return ..() /mob/living/carbon/human/Weaken(amount) - if(HULK in mutations) return + if(HULK in mutations) + return ..() /mob/living/carbon/human/Paralyse(amount) - if(HULK in mutations) return + if(HULK in mutations) + return // Notify our AI if they can now control the suit. if(wearing_rig && !stat && paralysis < amount) //We are passing out right this second. wearing_rig.notify_ai("Warning: user consciousness failure. Mobility control passed to integrated intelligence system.") @@ -267,7 +272,7 @@ if (O.status & ORGAN_MUTATED) O.unmutate() to_chat(src, "Your [O.name] is shaped normally again.") - update_hud_med_health() + update_hud_med_all() // Defined here solely to take species flags into account without having to recast at mob/living level. /mob/living/carbon/human/getOxyLoss() @@ -333,10 +338,8 @@ var/obj/item/organ/external/picked = pick(parts) if(picked.heal_damage(brute,burn)) UpdateDamageIcon() - update_hud_med_health() updatehealth() - /* In most cases it makes more sense to use apply_damage() instead! And make sure to check armour if applicable. */ @@ -345,14 +348,13 @@ In most cases it makes more sense to use apply_damage() instead! And make sure t //It automatically updates health status /mob/living/carbon/human/take_organ_damage(var/brute = 0, var/burn = 0, var/sharp = 0, var/edge = 0, var/emp = 0) var/list/obj/item/organ/external/parts = get_damageable_organs() - if(!parts.len) return + if(!parts.len) + return var/obj/item/organ/external/picked = pick(parts) if(picked.take_damage(brute,burn,sharp,edge)) UpdateDamageIcon() - update_hud_med_health() updatehealth() - //Heal MANY external organs, in random order //'include_robo' only applies to healing, for legacy purposes, as all damage typically hurts both types of organs /mob/living/carbon/human/heal_overall_damage(var/brute, var/burn, var/include_robo) @@ -372,8 +374,8 @@ In most cases it makes more sense to use apply_damage() instead! And make sure t parts -= picked updatehealth() - update_hud_med_health() - if(update) UpdateDamageIcon() + if(update) + UpdateDamageIcon() // damage MANY external organs, in random order /mob/living/carbon/human/take_overall_damage(var/brute, var/burn, var/sharp = 0, var/edge = 0, var/used_weapon = null) @@ -392,9 +394,8 @@ In most cases it makes more sense to use apply_damage() instead! And make sure t parts -= picked updatehealth() - update_hud_med_health() - if(update) UpdateDamageIcon() - + if(update) + UpdateDamageIcon() //////////////////////////////////////////// @@ -414,17 +415,6 @@ This function restores all organs. for(var/obj/item/organ/external/current_organ in organs) current_organ.rejuvenate(ignore_prosthetic_prefs) -/mob/living/carbon/human/proc/HealDamage(zone, brute, burn) - var/obj/item/organ/external/E = get_organ(zone) - if(istype(E, /obj/item/organ/external)) - if (E.heal_damage(brute, burn)) - UpdateDamageIcon() - update_hud_med_health() - else - return 0 - return - - /mob/living/carbon/human/proc/get_organ(var/zone) if(!zone) zone = BP_TORSO @@ -501,5 +491,4 @@ This function restores all organs. // Will set our damageoverlay icon to the next level, which will then be set back to the normal level the next mob.Life(). updatehealth() - update_hud_med_health() return 1 diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 77387b76123..e7dff242de8 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -18,8 +18,7 @@ prepare_data_huds() /mob/living/proc/prepare_data_huds() - update_hud_med_health() - update_hud_med_status() + update_hud_med_all() /mob/living/Destroy() if(LAZYLEN(status_effects)) @@ -698,8 +697,7 @@ default behaviour is: // make the icons look correct regenerate_icons() - update_hud_med_health() - update_hud_med_status() + update_hud_med_all() failed_last_breath = 0 //So mobs that died of oxyloss don't revive and have perpetual out of breath. reload_fullscreen()