From 140795ea3bf68efec3ddb7112b42dc13a804e30f Mon Sep 17 00:00:00 2001 From: Charlie <69320440+hal9000PR@users.noreply.github.com> Date: Thu, 7 Apr 2022 17:19:30 +0100 Subject: [PATCH] Makes check_self_for_injuries lag the client less. (#17537) * less to_chats * all other messages * review --- code/modules/mob/living/carbon/carbon.dm | 57 ++++++++++++++---------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 60e00dd7192..107a8862405 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -291,53 +291,62 @@ /mob/living/carbon/proc/check_self_for_injuries() var/mob/living/carbon/human/H = src - visible_message( \ - text("[src] examines [].",gender==MALE?"himself":"herself"), \ + visible_message("[src] examines [H.p_them()]self.", \ "You check yourself for injuries." \ ) + var/list/status_list = list() var/list/missing = list("head", "chest", "groin", "l_arm", "r_arm", "l_hand", "r_hand", "l_leg", "r_leg", "l_foot", "r_foot") for(var/X in H.bodyparts) var/obj/item/organ/external/LB = X missing -= LB.limb_name - var/status = "" + var/status var/brutedamage = LB.brute_dam var/burndamage = LB.burn_dam - if(brutedamage > 0) - status = "bruised" - if(brutedamage > 20) - status = "battered" - if(brutedamage > 40) - status = "mangled" + switch(brutedamage) + if(0.1 to 20) + status = "bruised" + if(20 to 40) + status = "battered" + if(40 to INFINITY) + status = "mangled" if(brutedamage > 0 && burndamage > 0) status += " and " - if(burndamage > 40) - status += "peeling away" - else if(burndamage > 10) - status += "blistered" - else if(burndamage > 0) - status += "numb" + switch(burndamage) + if(0.1 to 10) + status += "numb" + if(10 to 40) + status += "blistered" + if(40 to INFINITY) + status += "peeling away" + if(LB.status & ORGAN_MUTATED) - status = "weirdly shapen." - if(status == "") - status = "OK" - to_chat(src, "\t Your [LB.name] is [status].") + status = "weirdly shapen" + + var/msg = "Your [LB.name] is OK." + if(!isnull(status)) + msg = "Your [LB.name] is [status]." + status_list += msg for(var/obj/item/I in LB.embedded_objects) - to_chat(src, "\t There is \a [I] embedded in your [LB.name]!") + status_list += "There is \a [I] embedded in your [LB.name]!" for(var/t in missing) - to_chat(src, "Your [parse_zone(t)] is missing!") + status_list += "Your [parse_zone(t)] is missing!" if(H.bleed_rate) - to_chat(src, "You are bleeding!") + status_list += "You are bleeding!" if(staminaloss) if(staminaloss > 30) - to_chat(src, "You're completely exhausted.") + status_list += "You're completely exhausted." else - to_chat(src, "You feel fatigued.") + status_list += "You feel fatigued." + + var/output = status_list.Join("\n") + to_chat(src, output) + if(HAS_TRAIT(H, TRAIT_SKELETONIZED) && (!H.w_uniform) && (!H.wear_suit)) H.play_xylophone()