All camelCase (Brute|Burn|Fire|Tox|Oxy|Organ|Stamina)(Loss) procs now use snake_case. UNDERSCORES RULE! (#94111)

## About The Pull Request
It's just a partial cleanup of
anti-[STYLE](https://github.com/tgstation/tgstation/blob/master/.github/guides/STYLE.md)
code from /tg/'s ancient history. I compiled & tested with my helpful
assistant and damage is still working.

<img width="1920" height="1040" alt="image"
src="https://github.com/user-attachments/assets/26dabc17-088f-4008-b299-3ff4c27142c3"
/>


I'll upload the .cs script I used to do it shortly.

## Why It's Good For The Game
Just minor code cleanup.

Script used is located at https://metek.tech/camelTo-Snake.7z

EDIT 11/23/25: Updated the script to use multithreading and sequential
scan so it works a hell of a lot faster
```
/*
//
Copyright 2025 Joshua 'Joan Metekillot' Kidder

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
//
*/
using System.Text.RegularExpressions;
class Program
{
    static async Task Main(string[] args)
    {
        var readFile = new FileStreamOptions
        {
            Access = FileAccess.Read,
            Share = FileShare.ReadWrite,
            Options = FileOptions.Asynchronous | FileOptions.SequentialScan
        };
        FileStreamOptions writeFile = new FileStreamOptions
        {
            Share = FileShare.ReadWrite,
            Access = FileAccess.ReadWrite,
            Mode = FileMode.Truncate,
            Options = FileOptions.Asynchronous
        };
        RegexOptions regexOptions = RegexOptions.Multiline | RegexOptions.Compiled;
        Dictionary<string, int> changedProcs = new();
        string regexPattern = @"(?<=\P{L})([a-z]+)([A-Z]{1,2}[a-z]+)*(Brute|Burn|Fire|Tox|Oxy|Organ|Stamina)(Loss)([A-Z]{1,2}[a-z]+)*";
        Regex camelCaseProcRegex = new(regexPattern, regexOptions);

        string snakeify(Match matchingRegex)
        {
            var vals =
            matchingRegex.Groups.Cast<Group>().SelectMany(_ => _.Captures).Select(_ => _.Value).ToArray();
            var newVal = string.Join("_", vals.Skip(1).ToArray()).ToLower();
            string logString = $"{vals[0]} => {newVal}";
            if (changedProcs.TryGetValue(logString, out int value))
            {
                changedProcs[logString] = value + 1;
            }
            else
            {
                changedProcs.Add(logString, 1);
            }
            return newVal;
        }
        var dmFiles = Directory.EnumerateFiles(".", "*.dm", SearchOption.AllDirectories).ToAsyncEnumerable<string>();

        // uses default ParallelOptions
        // https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.paralleloptions?view=net-10.0#main
        await Parallel.ForEachAsync(dmFiles, async (filePath, UnusedCancellationToken) =>
        {
            var reader = new StreamReader(filePath, readFile);
            string oldContent = await reader.ReadToEndAsync();
            string newContent = camelCaseProcRegex.Replace(oldContent, new MatchEvaluator((Func<Match, string>)snakeify));
            if (oldContent != newContent)
            {
                var writer = new StreamWriter(filePath, writeFile);
                await writer.WriteAsync(newContent);
                await writer.DisposeAsync();
            }
            reader.Dispose();
        });
        var logToList = changedProcs.Cast<KeyValuePair<string, int>>().ToList();
        foreach (var pair in logToList)
        {
            Console.WriteLine($"{pair.Key}: {pair.Value} locations");
        }
    }
}

```

## Changelog
🆑 Bisar
code: All (Brute|Burn|Fire|Tox|Oxy|Organ|Stamina)(Loss) procs now use
snake_case, in-line with the STYLE guide. Underscores rule!
/🆑
This commit is contained in:
Joshua Kidder
2025-11-27 15:50:23 -05:00
committed by GitHub
parent 0079462f05
commit 7a3ad79506
410 changed files with 1695 additions and 1695 deletions
@@ -34,7 +34,7 @@
if(organ_flags & ORGAN_FAILING)
// forced to ensure people don't use it to gain tox as slime person
owner.adjustToxLoss(2 * seconds_per_tick, forced = TRUE)
owner.adjust_tox_loss(2 * seconds_per_tick, forced = TRUE)
else if(inflamation_stage)
inflamation(seconds_per_tick)
else if(SPT_PROB(APPENDICITIS_PROB, seconds_per_tick) && !HAS_TRAIT(owner, TRAIT_TEMPORARY_BODY))
@@ -68,13 +68,13 @@
if(2)
if(SPT_PROB(1.5, seconds_per_tick))
to_chat(organ_owner, span_warning("You feel a stabbing pain in your abdomen!"))
organ_owner.adjustOrganLoss(ORGAN_SLOT_APPENDIX, 5)
organ_owner.adjust_organ_loss(ORGAN_SLOT_APPENDIX, 5)
organ_owner.Stun(rand(40, 60))
organ_owner.adjustToxLoss(1, forced = TRUE)
organ_owner.adjust_tox_loss(1, forced = TRUE)
if(3)
if(SPT_PROB(0.5, seconds_per_tick))
organ_owner.vomit(VOMIT_CATEGORY_DEFAULT, lost_nutrition = 95)
organ_owner.adjustOrganLoss(ORGAN_SLOT_APPENDIX, 15)
organ_owner.adjust_organ_loss(ORGAN_SLOT_APPENDIX, 15)
/obj/item/organ/appendix/feel_for_damage(self_aware)
var/effective_stage = floor(inflamation_stage + (damage / maxHealth))
@@ -244,7 +244,7 @@
to_chat(owner, span_userdanger("You feel an explosion erupt inside your [parse_zone(zone)] as your implant breaks!"))
owner.adjust_fire_stacks(20)
owner.ignite_mob()
owner.adjustFireLoss(25)
owner.adjust_fire_loss(25)
organ_flags |= ORGAN_FAILING
/obj/item/organ/cyberimp/arm/toolkit/gun/laser
@@ -90,19 +90,19 @@
/// boolean that stands for if PHYSICAL damage being patched
var/body_damage_patched = FALSE
var/need_mob_update = FALSE
if(owner.getOxyLoss())
need_mob_update += owner.adjustOxyLoss(-5, updating_health = FALSE)
if(owner.get_oxy_loss())
need_mob_update += owner.adjust_oxy_loss(-5, updating_health = FALSE)
revive_cost += 5
if(owner.getBruteLoss())
need_mob_update += owner.adjustBruteLoss(-2, updating_health = FALSE)
if(owner.get_brute_loss())
need_mob_update += owner.adjust_brute_loss(-2, updating_health = FALSE)
revive_cost += 40
body_damage_patched = TRUE
if(owner.getFireLoss())
need_mob_update += owner.adjustFireLoss(-2, updating_health = FALSE)
if(owner.get_fire_loss())
need_mob_update += owner.adjust_fire_loss(-2, updating_health = FALSE)
revive_cost += 40
body_damage_patched = TRUE
if(owner.getToxLoss())
need_mob_update += owner.adjustToxLoss(-1, updating_health = FALSE)
if(owner.get_tox_loss())
need_mob_update += owner.adjust_tox_loss(-1, updating_health = FALSE)
revive_cost += 40
if(need_mob_update)
owner.updatehealth()
@@ -202,8 +202,8 @@
owner.SetKnockdown(0)
owner.SetImmobilized(0)
owner.SetParalyzed(0)
owner.setStaminaLoss(0)
addtimer(CALLBACK(owner, TYPE_PROC_REF(/mob/living, setStaminaLoss), 0), stun_resistance_time)
owner.set_stamina_loss(0)
addtimer(CALLBACK(owner, TYPE_PROC_REF(/mob/living, set_stamina_loss), 0), stun_resistance_time)
var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread
sparks.set_up(5, 1, src)
@@ -254,7 +254,7 @@
wounded_owner.adjust_blood_volume(2 * seconds_per_tick)
if(toxification_probability && prob(toxification_probability))
wounded_owner.adjustToxLoss(1 * seconds_per_tick, updating_health = FALSE)
wounded_owner.adjust_tox_loss(1 * seconds_per_tick, updating_health = FALSE)
var/datum/wound/bloodiest_wound
@@ -188,8 +188,8 @@
if(owner.health <= owner.crit_threshold)
owner.heal_overall_damage(5, 5)
owner.adjustOxyLoss(-5)
owner.adjustToxLoss(-5)
owner.adjust_oxy_loss(-5)
owner.adjust_tox_loss(-5)
/datum/status_effect/voltaic_overdrive/on_apply()
. = ..()
@@ -165,17 +165,17 @@
switch(failure_time)
//After 60 seconds we begin to feel the effects
if(1 * LIVER_FAILURE_STAGE_SECONDS to 2 * LIVER_FAILURE_STAGE_SECONDS - 1)
owner.adjustToxLoss(0.2 * seconds_per_tick,forced = TRUE)
owner.adjust_tox_loss(0.2 * seconds_per_tick,forced = TRUE)
owner.adjust_disgust(0.1 * seconds_per_tick)
if(2 * LIVER_FAILURE_STAGE_SECONDS to 3 * LIVER_FAILURE_STAGE_SECONDS - 1)
owner.adjustToxLoss(0.4 * seconds_per_tick,forced = TRUE)
owner.adjust_tox_loss(0.4 * seconds_per_tick,forced = TRUE)
owner.adjust_drowsiness(0.5 SECONDS * seconds_per_tick)
owner.adjust_disgust(0.3 * seconds_per_tick)
if(3 * LIVER_FAILURE_STAGE_SECONDS to 4 * LIVER_FAILURE_STAGE_SECONDS - 1)
owner.adjustToxLoss(0.6 * seconds_per_tick,forced = TRUE)
owner.adjustOrganLoss(pick(ORGAN_SLOT_HEART,ORGAN_SLOT_LUNGS,ORGAN_SLOT_STOMACH,ORGAN_SLOT_EYES,ORGAN_SLOT_EARS),0.2 * seconds_per_tick)
owner.adjust_tox_loss(0.6 * seconds_per_tick,forced = TRUE)
owner.adjust_organ_loss(pick(ORGAN_SLOT_HEART,ORGAN_SLOT_LUNGS,ORGAN_SLOT_STOMACH,ORGAN_SLOT_EYES,ORGAN_SLOT_EARS),0.2 * seconds_per_tick)
owner.adjust_drowsiness(1 SECONDS * seconds_per_tick)
owner.adjust_disgust(0.6 * seconds_per_tick)
@@ -183,8 +183,8 @@
owner.emote("drool")
if(4 * LIVER_FAILURE_STAGE_SECONDS to INFINITY)
owner.adjustToxLoss(0.8 * seconds_per_tick,forced = TRUE)
owner.adjustOrganLoss(pick(ORGAN_SLOT_HEART,ORGAN_SLOT_LUNGS,ORGAN_SLOT_STOMACH,ORGAN_SLOT_EYES,ORGAN_SLOT_EARS),0.5 * seconds_per_tick)
owner.adjust_tox_loss(0.8 * seconds_per_tick,forced = TRUE)
owner.adjust_organ_loss(pick(ORGAN_SLOT_HEART,ORGAN_SLOT_LUNGS,ORGAN_SLOT_STOMACH,ORGAN_SLOT_EYES,ORGAN_SLOT_EARS),0.5 * seconds_per_tick)
owner.adjust_drowsiness(1.6 SECONDS * seconds_per_tick)
owner.adjust_disgust(1.2 * seconds_per_tick)
@@ -247,7 +247,7 @@
if(. & EMP_PROTECT_SELF)
return
if(!COOLDOWN_FINISHED(src, severe_cooldown)) //So we cant just spam emp to kill people.
owner.adjustToxLoss(10)
owner.adjust_tox_loss(10)
COOLDOWN_START(src, severe_cooldown, 10 SECONDS)
if(prob(emp_vulnerability/severity)) //Chance of permanent effects
organ_flags |= ORGAN_EMP //Starts organ faliure - gonna need replacing soon.
@@ -302,7 +302,7 @@
if(!(organ_owner.mob_biotypes & MOB_PLANT))
return
if(chem.type == /datum/reagent/toxin/plantbgone)
organ_owner.adjustToxLoss(3 * REM * seconds_per_tick)
organ_owner.adjust_tox_loss(3 * REM * seconds_per_tick)
/obj/item/organ/liver/snail
name = "snail liver"
@@ -328,7 +328,7 @@
return
if(istype(chem, /datum/reagent/consumable/salt))
playsound(organ_owner, SFX_SEAR, 30, TRUE)
organ_owner.adjustFireLoss(2 * REM * seconds_per_tick)
organ_owner.adjust_fire_loss(2 * REM * seconds_per_tick)
organ_owner.reagents.remove_reagent(chem.type, REAGENTS_METABOLISM * seconds_per_tick)
return COMSIG_MOB_STOP_REAGENT_TICK
@@ -19,8 +19,8 @@
if((. & COMSIG_MOB_STOP_REAGENT_TICK) || (organ_flags & ORGAN_FAILING))
return
if(istype(chem, /datum/reagent/toxin/bonehurtingjuice))
organ_owner.adjustStaminaLoss(7.5 * REM * seconds_per_tick, updating_stamina = FALSE)
organ_owner.adjustBruteLoss(0.5 * REM * seconds_per_tick, updating_health = FALSE)
organ_owner.adjust_stamina_loss(7.5 * REM * seconds_per_tick, updating_stamina = FALSE)
organ_owner.adjust_brute_loss(0.5 * REM * seconds_per_tick, updating_health = FALSE)
if(SPT_PROB(10, seconds_per_tick))
switch(rand(1, 3))
if(1)
@@ -263,7 +263,7 @@
breathe_gas_volume(breath, /datum/gas/oxygen, /datum/gas/carbon_dioxide)
// Heal mob if not in crit.
if(breather.health >= breather.crit_threshold && breather.oxyloss)
breather.adjustOxyLoss(-5)
breather.adjust_oxy_loss(-5)
/// Maximum Oxygen effects. "Too much O2!"
/obj/item/organ/lungs/proc/too_much_oxygen(mob/living/carbon/breather, datum/gas_mixture/breath, o2_pp, old_o2_pp)
@@ -310,7 +310,7 @@
breathe_gas_volume(breath, /datum/gas/nitrogen, /datum/gas/carbon_dioxide)
// Heal mob if not in crit.
if(breather.health >= breather.crit_threshold && breather.oxyloss)
breather.adjustOxyLoss(-5)
breather.adjust_oxy_loss(-5)
/// Maximum CO2 effects. "Too much CO2!"
/obj/item/organ/lungs/proc/too_much_co2(mob/living/carbon/breather, datum/gas_mixture/breath, co2_pp, old_co2_pp)
@@ -364,7 +364,7 @@
breathe_gas_volume(breath, /datum/gas/plasma, /datum/gas/carbon_dioxide)
// Heal mob if not in crit.
if(breather.health >= breather.crit_threshold && breather.oxyloss)
breather.adjustOxyLoss(-5)
breather.adjust_oxy_loss(-5)
/// Maximum Plasma effects. "Too much Plasma!"
/obj/item/organ/lungs/proc/too_much_plasma(mob/living/carbon/breather, datum/gas_mixture/breath, plasma_pp, old_plasma_pp)
@@ -390,7 +390,7 @@
if(bz_pp > BZ_trip_balls_min)
breather.reagents.add_reagent(/datum/reagent/bz_metabolites, clamp(bz_pp, 1, 5))
if(bz_pp > BZ_brain_damage_min && prob(33))
breather.adjustOrganLoss(ORGAN_SLOT_BRAIN, 3, 150, ORGAN_ORGANIC)
breather.adjust_organ_loss(ORGAN_SLOT_BRAIN, 3, 150, ORGAN_ORGANIC)
/// Breathing in refridgerator coolent, shit's caustic
/obj/item/organ/lungs/proc/too_much_freon(mob/living/carbon/breather, datum/gas_mixture/breath, freon_pp, old_freon_pp)
@@ -402,12 +402,12 @@
to_chat(breather, span_alert("Your mouth feels like it's burning!"))
if (freon_pp > 40)
breather.emote("gasp")
breather.adjustFireLoss(15)
breather.adjust_fire_loss(15)
if (prob(freon_pp / 2))
to_chat(breather, span_alert("Your throat closes up!"))
breather.set_silence_if_lower(6 SECONDS)
else
breather.adjustFireLoss(freon_pp / 4)
breather.adjust_fire_loss(freon_pp / 4)
/// Breathing in halon, convert it to a reagent
/obj/item/organ/lungs/proc/too_much_halon(mob/living/carbon/breather, datum/gas_mixture/breath, halon_pp, old_halon_pp)
@@ -415,7 +415,7 @@
breathe_gas_volume(breath, /datum/gas/halon)
// Metabolize to reagent.
if(halon_pp > gas_stimulation_min)
breather.adjustOxyLoss(5)
breather.adjust_oxy_loss(5)
breather.reagents.add_reagent(/datum/reagent/halon, max(0, 1 - breather.reagents.get_reagent_amount(/datum/reagent/halon)))
/// Sleeping gas with healing properties.
@@ -555,7 +555,7 @@
// Random chance to inflict side effects increases with pressure.
if((prob(nitrium_pp) && (nitrium_pp > 15)))
// Nitrium side-effect.
breather.adjustOrganLoss(ORGAN_SLOT_LUNGS, nitrium_pp * 0.1)
breather.adjust_organ_loss(ORGAN_SLOT_LUNGS, nitrium_pp * 0.1)
to_chat(breather, span_notice("You feel a burning sensation in your chest"))
// Metabolize to reagents.
if (nitrium_pp > 5)
@@ -572,7 +572,7 @@
// Tritium side-effects.
if(gas_breathed > moles_visible)
var/ratio = gas_breathed * 15
breather.adjustToxLoss(clamp(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE))
breather.adjust_tox_loss(clamp(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE))
// If you're breathing in half an atmosphere of radioactive gas, you fucked up.
if((trit_pp > tritium_irradiation_moles_min) && SSradiation.can_irradiate_basic(breather))
var/lerp_scale = min(tritium_irradiation_moles_max, trit_pp - tritium_irradiation_moles_min) / (tritium_irradiation_moles_max - tritium_irradiation_moles_min)
@@ -629,7 +629,7 @@
breather.failed_last_breath = FALSE
// Vacuum-adapted lungs regenerate oxyloss even when breathing nothing.
if(breather.health >= breather.crit_threshold && breather.oxyloss)
breather.adjustOxyLoss(-5)
breather.adjust_oxy_loss(-5)
else
// Can't breathe!
breather.failed_last_breath = TRUE