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
+1 -1
View File
@@ -166,7 +166,7 @@
/mob/living/basic/Life(seconds_per_tick = SSMOBS_DT, times_fired)
. = ..()
if(staminaloss > 0)
adjustStaminaLoss(-stamina_recovery * seconds_per_tick, forced = TRUE)
adjust_stamina_loss(-stamina_recovery * seconds_per_tick, forced = TRUE)
/mob/living/basic/get_default_say_verb()
return length(speak_emote) ? pick(speak_emote) : ..()
+4 -4
View File
@@ -74,7 +74,7 @@
qdel(victim.get_organ_slot(ORGAN_SLOT_LUNGS))
qdel(victim.get_organ_slot(ORGAN_SLOT_HEART))
qdel(victim.get_organ_slot(ORGAN_SLOT_LIVER))
victim.adjustBruteLoss(500)
victim.adjust_brute_loss(500)
victim.death() //make sure they die
victim.apply_status_effect(/datum/status_effect/gutted)
return TRUE
@@ -87,12 +87,12 @@
/mob/living/basic/boss/ex_act(severity, target)
switch (severity)
if (EXPLODE_DEVASTATE)
adjustBruteLoss(250)
adjust_brute_loss(250)
if (EXPLODE_HEAVY)
adjustBruteLoss(100)
adjust_brute_loss(100)
if (EXPLODE_LIGHT)
adjustBruteLoss(50)
adjust_brute_loss(50)
return TRUE
+1 -1
View File
@@ -771,7 +771,7 @@ GLOBAL_LIST_INIT(command_strings, list(
update_appearance()
/mob/living/basic/bot/rust_heretic_act()
adjustBruteLoss(400)
adjust_brute_loss(400)
/mob/living/basic/bot/proc/attempt_access(mob/bot, obj/door_attempt)
SIGNAL_HANDLER
+2 -2
View File
@@ -470,10 +470,10 @@
health += 10
if(istype(eaten_atom, /obj/item/food/grown/banana))
var/obj/item/food/grown/banana/banana_morsel = eaten_atom
adjustBruteLoss(-(banana_morsel.seed.potency / 100 ) * maxHealth * 0.2)
adjust_brute_loss(-(banana_morsel.seed.potency / 100 ) * maxHealth * 0.2)
prank_pouch += banana_morsel.generate_trash(src)
else
adjustBruteLoss(-maxHealth * 0.1)
adjust_brute_loss(-maxHealth * 0.1)
qdel(eaten_atom)
playsound(loc,'sound/items/eatfood.ogg', rand(30,50), TRUE)
@@ -258,7 +258,7 @@
Stun(70)
to_chat(src, span_danger("<b>ER@%R: MME^RY CO#RU9T!</b> R&$b@0tin)..."))
if(severity == 1)
adjustBruteLoss(heavy_emp_damage)
adjust_brute_loss(heavy_emp_damage)
to_chat(src, span_userdanger("HeAV% DA%^MMA+G TO I/O CIR!%UUT!"))
/mob/living/basic/drone/proc/alarm_triggered(datum/source, alarm_type, area/source_area)
@@ -16,7 +16,7 @@
drone.visible_message(span_notice("[drone] begins to cannibalize parts from [src]."), span_notice("You begin to cannibalize parts from [src]..."))
if(do_after(drone, 6 SECONDS, 0, target = src))
drone.visible_message(span_notice("[drone] repairs itself using [src]'s remains!"), span_notice("You repair yourself using [src]'s remains."))
drone.adjustBruteLoss(-src.maxHealth)
drone.adjust_brute_loss(-src.maxHealth)
new /obj/effect/decal/cleanable/blood/splatter/oil(get_turf(src))
ghostize(can_reenter_corpse = FALSE)
qdel(src)
@@ -93,7 +93,7 @@
to_chat(user, span_warning("You need to remain still to tighten [src]'s screws!"))
return ITEM_INTERACT_SUCCESS
adjustBruteLoss(-getBruteLoss())
adjust_brute_loss(-get_brute_loss())
visible_message(span_notice("[user] tightens [src == user ? "[user.p_their()]" : "[src]'s"] loose screws!"), span_notice("[src == user ? "You tighten" : "[user] tightens"] your loose screws."))
return ITEM_INTERACT_SUCCESS
@@ -72,7 +72,7 @@
if(!(living_target.mob_biotypes & MOB_PLANT))
return
living_target.adjustBruteLoss(20)
living_target.adjust_brute_loss(20)
playsound(src, 'sound/items/eatfood.ogg', rand(30, 50), TRUE)
var/obj/item/bodypart/edible_bodypart
@@ -191,9 +191,9 @@
gib()
return TRUE
if (EXPLODE_HEAVY)
adjustBruteLoss(60)
adjust_brute_loss(60)
if (EXPLODE_LIGHT)
adjustBruteLoss(30)
adjust_brute_loss(30)
return TRUE
@@ -294,7 +294,7 @@
summoner.visible_message(span_bolddanger("Blood sprays from [summoner] as [src] takes damage!"))
if(summoner.stat == UNCONSCIOUS || summoner.stat == HARD_CRIT)
to_chat(summoner, span_bolddanger("Your head pounds, you can't take the strain of sustaining [src] in this condition!"))
summoner.adjustOrganLoss(ORGAN_SLOT_BRAIN, amount * 0.5)
summoner.adjust_organ_loss(ORGAN_SLOT_BRAIN, amount * 0.5)
/// When our owner is deleted, we go too.
/mob/living/basic/guardian/proc/on_summoner_deletion(mob/living/source)
@@ -34,7 +34,7 @@
/mob/living/basic/guardian/protector/ex_act(severity)
if(severity >= EXPLODE_DEVASTATE)
adjustBruteLoss(400) //if in protector mode, will do 20 damage and not actually necessarily kill the summoner
adjust_brute_loss(400) //if in protector mode, will do 20 damage and not actually necessarily kill the summoner
return TRUE
return ..()
@@ -23,7 +23,7 @@
return modifier * damage_coeff[damage_type]
return modifier
/mob/living/basic/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
/mob/living/basic/adjust_brute_loss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
if(!can_adjust_brute_loss(amount, forced, required_bodytype))
return 0
if(forced)
@@ -31,7 +31,7 @@
else if(damage_coeff[BRUTE])
. = adjust_health(amount * damage_coeff[BRUTE] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
/mob/living/basic/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
/mob/living/basic/adjust_fire_loss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
if(!can_adjust_fire_loss(amount, forced, required_bodytype))
return 0
if(forced)
@@ -39,7 +39,7 @@
else if(damage_coeff[BURN])
. = adjust_health(amount * damage_coeff[BURN] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
/mob/living/basic/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype, required_respiration_type)
/mob/living/basic/adjust_oxy_loss(amount, updating_health = TRUE, forced = FALSE, required_biotype, required_respiration_type)
if(!can_adjust_oxy_loss(amount, forced, required_biotype, required_respiration_type))
return 0
if(forced)
@@ -47,7 +47,7 @@
else if(damage_coeff[OXY])
. = adjust_health(amount * damage_coeff[OXY] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
/mob/living/basic/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype)
/mob/living/basic/adjust_tox_loss(amount, updating_health = TRUE, forced = FALSE, required_biotype)
if(!can_adjust_tox_loss(amount, forced, required_biotype))
return 0
if(forced)
@@ -55,7 +55,7 @@
else if(damage_coeff[TOX])
. = adjust_health(amount * damage_coeff[TOX] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
/mob/living/basic/adjustStaminaLoss(amount, updating_stamina = TRUE, forced = FALSE, required_biotype)
/mob/living/basic/adjust_stamina_loss(amount, updating_stamina = TRUE, forced = FALSE, required_biotype)
if(!can_adjust_stamina_loss(amount, forced, required_biotype))
return 0
. = staminaloss
@@ -23,4 +23,4 @@
/mob/living/basic/heretic_summon/ash_spirit/Life(seconds_per_tick, times_fired)
. = ..()
adjustBruteLoss(-3) // 3 health passively healing
adjust_brute_loss(-3) // 3 health passively healing
@@ -111,8 +111,8 @@
back.on_arm_eaten()
return
adjustBruteLoss(-maxHealth * 0.5, FALSE)
adjustFireLoss(-maxHealth * 0.5, FALSE)
adjust_brute_loss(-maxHealth * 0.5, FALSE)
adjust_fire_loss(-maxHealth * 0.5, FALSE)
if(health < maxHealth * 0.8)
return
@@ -44,7 +44,7 @@
return
var/turf/our_turf = get_turf(src)
if(HAS_TRAIT(our_turf, TRAIT_RUSTY))
adjustBruteLoss(-3 * seconds_per_tick)
adjust_brute_loss(-3 * seconds_per_tick)
return ..()
@@ -87,7 +87,7 @@
if(!do_after(src, 5 SECONDS, target))
return
target.gib(DROP_ALL_REMAINS)
adjustBruteLoss(-1 * heal_on_cannibalize)
adjust_brute_loss(-1 * heal_on_cannibalize)
///Ash whelp, the "lava" variant of ice whelps.
/mob/living/basic/mining/ice_whelp/ash
@@ -66,7 +66,7 @@
. = ..()
if(volume <= 5)
return
if(poisoned_mob.adjustToxLoss(2.5 * REM * seconds_per_tick, updating_health = FALSE))
if(poisoned_mob.adjust_tox_loss(2.5 * REM * seconds_per_tick, updating_health = FALSE))
return UPDATE_MOB_HEALTH
// bubble ability structure
@@ -336,7 +336,7 @@
var/mob/living/living_target = target_atom
living_target.adjust_fire_stacks(0.2)
living_target.ignite_mob()
living_target.adjustFireLoss(30)
living_target.adjust_fire_loss(30)
playsound(target_turf, 'sound/effects/magic/lightningbolt.ogg', 50, TRUE)
if(!is_seedling)
@@ -110,7 +110,7 @@
if(isliving(AM))
var/mob/living/L = AM
if(!isvineimmune(L))
L.adjustBruteLoss(5)
L.adjust_brute_loss(5)
to_chat(L, span_alert("You cut yourself on the thorny vines."))
/**
@@ -197,7 +197,7 @@
else if(vines_in_range)
alert_shown = FALSE
adjustBruteLoss(vines_in_range ? -weed_heal : no_weed_damage) //every life tick take 20 damage if not near vines or heal 10 if near vines, 5 times out of weeds = u ded
adjust_brute_loss(vines_in_range ? -weed_heal : no_weed_damage) //every life tick take 20 damage if not near vines or heal 10 if near vines, 5 times out of weeds = u ded
/datum/action/cooldown/mob_cooldown/projectile_attack/vine_tangle
name = "Tangle"
@@ -47,7 +47,7 @@
continue
balloon_alert(victim, "grabbed")
visible_message(span_danger("[src] grabs hold of [victim]!"))
victim.adjustBruteLoss(rand(min_damage, max_damage))
victim.adjust_brute_loss(rand(min_damage, max_damage))
if (victim.apply_status_effect(/datum/status_effect/incapacitating/stun/goliath_tentacled, grapple_time, src))
buckle_mob(victim, TRUE)
SEND_SIGNAL(victim, COMSIG_GOLIATH_TENTACLED_GRABBED)
@@ -240,8 +240,8 @@
grown.tamed()
for(var/friend in ai_controller?.blackboard?[BB_FRIENDS_LIST])
grown.befriend(friend)
grown.setBruteLoss(getBruteLoss())
grown.setFireLoss(getFireLoss())
grown.set_brute_loss(get_brute_loss())
grown.set_fire_loss(get_fire_loss())
qdel(src) //We called change_mob_type without 'delete_old_mob = TRUE' since we had to pass down friends and damage
/mob/living/basic/mining/lobstrosity/juvenile/lava
@@ -119,7 +119,7 @@
user.balloon_alert(user, "at full integrity!")
return TRUE
if(welder.use_tool(src, user, 0, volume=40))
adjustBruteLoss(-15)
adjust_brute_loss(-15)
user.balloon_alert(user, "successfully repaired!")
return TRUE
@@ -517,7 +517,7 @@
visible_message(span_warning("[src] arises again, revived by the dark magicks!"), \
span_cult_large("RISE"))
revive(ADMIN_HEAL_ALL) //also means that a dead Nars-Ian can consume a pet and revive
adjustBruteLoss(-maxHealth)
adjust_brute_loss(-maxHealth)
//LISA! SQUEEEEEEEEE~
/mob/living/basic/pet/dog/corgi/lisa
@@ -125,7 +125,7 @@
return
if(health < maxHealth)
adjustBruteLoss(-4 * seconds_per_tick) //Fast life regen
adjust_brute_loss(-4 * seconds_per_tick) //Fast life regen
for(var/mob/living/carbon/humanoid_entities in view(3, src)) //Mood aura which stay as long you do not wear Sanallite as hat or carry(I will try to make it work with hat someday(obviously weaker than normal one))
humanoid_entities.add_mood_event("kobun", /datum/mood_event/kobun)
@@ -350,7 +350,7 @@ GLOBAL_LIST_INIT(strippable_parrot_items, create_strippable_list(list(
return TRUE // we still ate it
if(health < maxHealth)
adjustBruteLoss(-10)
adjust_brute_loss(-10)
speech_probability_rate *= 1.27
speech_shuffle_rate += 10
update_speech_blackboards()
@@ -288,7 +288,7 @@ GLOBAL_LIST_INIT(animatable_blacklist, typecacheof(list(
if(!.) //dead or deleted
return
if(idledamage && !ckey && !ai_controller?.blackboard[BB_BASIC_MOB_CURRENT_TARGET]) //Objects eventually revert to normal if no one is around to terrorize
adjustBruteLoss(0.5 * seconds_per_tick)
adjust_brute_loss(0.5 * seconds_per_tick)
for(var/mob/living/victim in contents) //a fix for animated statues from the flesh to stone spell
death()
return
@@ -103,7 +103,7 @@
///Handles the adverse effects of water on slimes
/mob/living/basic/slime/proc/apply_water()
adjustBruteLoss(rand(15,20))
adjust_brute_loss(rand(15,20))
discipline_slime()
///Stops the slime from feeding, and might remove rabidity and targets
+1 -1
View File
@@ -59,7 +59,7 @@
if(nutrition == 0) //adjust nutrition ensures it can't go below 0
if(SPT_PROB(50, seconds_per_tick))
adjustBruteLoss(rand(0,5))
adjust_brute_loss(rand(0,5))
return
if (SLIME_GROW_NUTRITION <= nutrition)
+1 -1
View File
@@ -345,7 +345,7 @@
target_slime.adjust_nutrition(-stolen_nutrition)
our_slime.adjust_nutrition(stolen_nutrition)
if(target_slime.health > 0)
our_slime.adjustBruteLoss(is_adult_slime ? -20 : -10)
our_slime.adjust_brute_loss(is_adult_slime ? -20 : -10)
///Spawns a crossed slimecore item
@@ -158,9 +158,9 @@
investigate_log("has died from a devastating explosion.", INVESTIGATE_DEATHS)
death()
if(EXPLODE_HEAVY)
adjustBruteLoss(60)
adjust_brute_loss(60)
if(EXPLODE_LIGHT)
adjustBruteLoss(30)
adjust_brute_loss(30)
return TRUE
@@ -72,7 +72,7 @@
return
if(istype(attack_target, /obj/item/food/grown/carrot))
adjustBruteLoss(-5)
adjust_brute_loss(-5)
to_chat(src, span_warning("You eat [attack_target]! It restores some health!"))
qdel(attack_target)
return TRUE
@@ -101,7 +101,7 @@
if (!(heal_biotypes & target.mob_biotypes))
return FALSE
if (!iscarbon(target))
return target.getBruteLoss() > 0 || target.getFireLoss() > 0
return target.get_brute_loss() > 0 || target.get_fire_loss() > 0
var/mob/living/carbon/carbon_target = target
for (var/obj/item/bodypart/part in carbon_target.bodyparts)
if (!part.brute_dam && !part.burn_dam)
@@ -110,7 +110,7 @@
var/level_gain = (consumed.powerlevel - powerlevel)
if(level_gain >= 0 && !ckey && !consumed.bruised)//Player shrooms can't level up to become robust gods.
consumed.level_up(level_gain)
adjustBruteLoss(-consumed.maxHealth)
adjust_brute_loss(-consumed.maxHealth)
qdel(consumed)
/mob/living/basic/mushroom/revive(full_heal_flags = NONE, excess_healing = 0, force_grab_ghost = FALSE)
@@ -144,11 +144,11 @@
if(stat == DEAD)
revive(HEAL_ALL)
else
adjustBruteLoss(-5)
adjust_brute_loss(-5)
COOLDOWN_START(src, recovery_cooldown, 5 MINUTES)
/mob/living/basic/mushroom/proc/level_up(level_gain)
adjustBruteLoss(-maxHealth) //They'll always heal, even if they don't gain a level
adjust_brute_loss(-maxHealth) //They'll always heal, even if they don't gain a level
if(powerlevel > 9)
return
if(level_gain == 0)
@@ -123,7 +123,7 @@
SIGNAL_HANDLER
if(!(attack_flags & (ATTACKER_STAMINA_ATTACK|ATTACKER_SHOVING)))
attacker.adjustBruteLoss(20)
attacker.adjust_brute_loss(20)
to_chat(attacker, span_warning("The clone casts a spell to damage you before he dies!"))
@@ -277,7 +277,7 @@
if(mob.reagents)
mob.reagents.add_reagent(/datum/reagent/toxin/plasma, 5)
else
mob.adjustToxLoss(5)
mob.adjust_tox_loss(5)
for(var/obj/structure/spacevine/vine in victim) //Fucking with botanists, the ability.
vine.add_atom_colour("#823abb", TEMPORARY_COLOUR_PRIORITY)
new /obj/effect/temp_visual/revenant(vine.loc)
@@ -303,7 +303,7 @@
if (severity != EXPLODE_DEVASTATE)
return
var/damage_coefficient = rand(devastation_damage_min_percentage, devastation_damage_max_percentage)
adjustBruteLoss(initial(maxHealth)*damage_coefficient)
adjust_brute_loss(initial(maxHealth)*damage_coefficient)
return COMPONENT_CANCEL_EX_ACT // we handled it
/// Subtype used by the midround/event
@@ -155,8 +155,8 @@
grown.faction = faction.Copy()
grown.directive = directive
grown.set_name()
grown.setBruteLoss(getBruteLoss())
grown.setFireLoss(getFireLoss())
grown.set_brute_loss(get_brute_loss())
grown.set_fire_loss(get_fire_loss())
qdel(src)
/**