From 0d139a55493a766c3fff9a25ed11153514ef3de5 Mon Sep 17 00:00:00 2001 From: Carlen White Date: Tue, 21 May 2019 23:03:06 -0400 Subject: [PATCH] Batch messages on checking yourself Instead of sending a bunch of to_chat() functions, it'll just create an array and send it all out at once instead of freezing the client for a moment. --- .../mob/living/carbon/human/human_defense.dm | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index b66ebdb001..d87cf0783d 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -649,6 +649,7 @@ if(health >= 0) if(src == M) + var/to_send = list() visible_message("[src] examines [p_them()]self.", \ "You check yourself for injuries.") @@ -695,53 +696,55 @@ var/no_damage if(status == "OK" || status == "no damage") no_damage = TRUE - to_chat(src, "\t Your [LB.name] [has_trait(TRAIT_SELF_AWARE) ? "has" : "is"] [status].") + to_send += "\t Your [LB.name] [has_trait(TRAIT_SELF_AWARE) ? "has" : "is"] [status]." for(var/obj/item/I in LB.embedded_objects) - to_chat(src, "\t There is \a [I] embedded in your [LB.name]!") + to_send += "\t There is \a [I] embedded in your [LB.name]!" for(var/t in missing) - to_chat(src, "Your [parse_zone(t)] is missing!") + to_send += "Your [parse_zone(t)] is missing!" if(bleed_rate) - to_chat(src, "You are bleeding!") + to_send += "You are bleeding!" if(getStaminaLoss()) if(getStaminaLoss() > 30) - to_chat(src, "You're completely exhausted.") + to_send += "You're completely exhausted." else - to_chat(src, "You feel fatigued.") + to_send += "You feel fatigued." if(has_trait(TRAIT_SELF_AWARE)) if(toxloss) if(toxloss > 10) - to_chat(src, "You feel sick.") + to_send += "You feel sick." else if(toxloss > 20) - to_chat(src, "You feel nauseated.") + to_send += "You feel nauseated." else if(toxloss > 40) - to_chat(src, "You feel very unwell!") + to_send += "You feel very unwell!" if(oxyloss) if(oxyloss > 10) - to_chat(src, "You feel lightheaded.") + to_send += "You feel lightheaded." else if(oxyloss > 20) - to_chat(src, "Your thinking is clouded and distant.") + to_send += "Your thinking is clouded and distant." else if(oxyloss > 30) - to_chat(src, "You're choking!") + to_send += "You're choking!" switch(nutrition) if(NUTRITION_LEVEL_FULL to INFINITY) - to_chat(src, "You're completely stuffed!") + to_send += "You're completely stuffed!" if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL) - to_chat(src, "You're well fed!") + to_send += "You're well fed!" if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED) - to_chat(src, "You're not hungry.") + to_send += "You're not hungry." if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED) - to_chat(src, "You could use a bite to eat.") + to_send += "You could use a bite to eat." if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY) - to_chat(src, "You feel quite hungry.") + to_send += "You feel quite hungry." if(0 to NUTRITION_LEVEL_STARVING) - to_chat(src, "You're starving!") + to_send += "You're starving!" if(roundstart_quirks.len) - to_chat(src, "You have these quirks: [get_trait_string()].") + to_send += "You have these quirks: [get_trait_string()]." + + to_chat(src, jointext(to_send, "\n")) else if(wear_suit) wear_suit.add_fingerprint(M)