diff --git a/code/modules/client/preferences_vr.dm b/code/modules/client/preferences_vr.dm index b608c823938..494c7cb075e 100644 --- a/code/modules/client/preferences_vr.dm +++ b/code/modules/client/preferences_vr.dm @@ -124,10 +124,10 @@ /client/verb/toggle_pain_frequency() set name = "Toggle Pain Frequency" set category = "Preferences" - set desc = "When toggled on, increases the cooldown of pain messages sent to chat for minor, single-limb injuries." + set desc = "When toggled on, increases the cooldown of pain messages sent to chat for minor injuries" var/pref_path = /datum/client_preference/pain_frequency toggle_preference(pref_path) - to_chat(src, "The cooldown between pain messages for minor (under 20/5 single limb injury) is now [ (is_preference_enabled(pref_path)) ? "extended" : "default"].") + to_chat(src, "The cooldown between pain messages for minor (under 20/5 injury. Multi-limb injuries are still faster) is now [ (is_preference_enabled(pref_path)) ? "extended" : "default"].") diff --git a/code/modules/organs/pain.dm b/code/modules/organs/pain.dm index 1f4e8de6f09..d26b7e30880 100644 --- a/code/modules/organs/pain.dm +++ b/code/modules/organs/pain.dm @@ -4,6 +4,8 @@ /mob/var/list/pain_stored = list() /mob/var/last_pain_message = "" /mob/var/next_pain_time = 0 +/mob/var/multilimb_pain_time = 0 // Global pain cooldown exists to prevent spam for multi-limb damage + // message is the custom message to be displayed // power decides how much painkillers will stop the message @@ -16,6 +18,7 @@ message = "[message]" // Anti message spam checks + // If multiple limbs are injured, cooldown is ignored to print all injuries until all limbs are iterated over if(src.is_preference_enabled(/datum/client_preference/pain_frequency)) switch(power) if(0 to 5) @@ -26,12 +29,13 @@ switch(power) if(0 to 5) next_pain_time = world.time + 300 SECONDS + multilimb_pain_time = world.time + 45 SECONDS if(6 to 20) next_pain_time = world.time + clamp((30 - power) SECONDS, 10 SECONDS, 30 SECONDS) + multilimb_pain_time = world.time + clamp((30 - power) SECONDS, 10 SECONDS, 30 SECONDS) if(21 to INFINITY) next_pain_time = world.time + (100 - power) - if((message != last_pain_message) && prob(30)) - return //since our cooldowns can be much higher than the 10 seconds, using 30% probability to avoid being MORE spammy than default + multilimb_pain_time = world.time + (100 - power) last_pain_message = message to_chat(src,message) @@ -39,6 +43,7 @@ last_pain_message = message to_chat(src,message) next_pain_time = world.time + (100 - power) + multilimb_pain_time = world.time + (100 - power) /mob/living/carbon/human/proc/handle_pain() if(stat) @@ -47,7 +52,7 @@ if(!can_feel_pain() && !synth_cosmetic_pain) return - if(!src.is_preference_enabled(/datum/client_preference/pain_frequency) && (world.time < next_pain_time)) + if(world.time < multilimb_pain_time) //prevents spam in case of multi-limb injuries. return var/maxdam = 0 var/obj/item/organ/external/damaged_organ = null