diff --git a/code/modules/client/preference_setup/global/setting_datums.dm b/code/modules/client/preference_setup/global/setting_datums.dm index 9d9d98db59..e9f4de8bda 100644 --- a/code/modules/client/preference_setup/global/setting_datums.dm +++ b/code/modules/client/preference_setup/global/setting_datums.dm @@ -381,6 +381,14 @@ var/list/_client_preferences_by_type key = "RECEIVE_TIPS" enabled_description = "Enabled" disabled_description = "Disabled" + +/datum/client_preference/pain_frequency + description = "Pain Messages Cooldown" + key = "PAIN_FREQUENCY" + enabled_by_default = FALSE + enabled_description = "Extended" + disabled_description = "Default" + /******************** * Staff Preferences * diff --git a/code/modules/client/preferences_vr.dm b/code/modules/client/preferences_vr.dm index 1fc5632052..8ac78b09f0 100644 --- a/code/modules/client/preferences_vr.dm +++ b/code/modules/client/preferences_vr.dm @@ -139,3 +139,14 @@ SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb", "TReceivePlayerTips") + +/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 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 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 b65b3fc2fb..d26b7e3088 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,10 +18,32 @@ message = "[message]" // Anti message spam checks - if(force || (message != last_pain_message) || (world.time >= next_pain_time)) + // 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) + force = 0 + if(6 to 20) + force = prob(1) + if(force || (message != last_pain_message) || (world.time >= next_pain_time)) + 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) + multilimb_pain_time = world.time + (100 - power) + last_pain_message = message + to_chat(src,message) + + else if(force || (message != last_pain_message) || (world.time >= next_pain_time)) last_pain_message = message to_chat(src,message) - next_pain_time = world.time + (100-power) + next_pain_time = world.time + (100 - power) + multilimb_pain_time = world.time + (100 - power) /mob/living/carbon/human/proc/handle_pain() if(stat) @@ -28,7 +52,7 @@ if(!can_feel_pain() && !synth_cosmetic_pain) return - if(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 @@ -77,4 +101,4 @@ if(31 to 60) custom_pain("Your whole body hurts badly.", getToxLoss()) if(61 to INFINITY) - custom_pain("Your body aches all over, it's driving you mad.", getToxLoss()) \ No newline at end of file + custom_pain("Your body aches all over, it's driving you mad.", getToxLoss())