Files
Joshua Kidder 7a3ad79506 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!
/🆑
2025-11-27 15:50:23 -05:00

113 lines
3.8 KiB
Plaintext

/**
* ## Lightgeists
*
* Small critters meant to heal other living mobs and unable to interact with almost everything else.
*
*/
/mob/living/basic/lightgeist
name = "lightgeist"
desc = "This small floating creature is a completely unknown form of life... being near it fills you with a sense of tranquility."
icon_state = "lightgeist"
icon_living = "lightgeist"
icon_dead = "butterfly_dead"
response_help_continuous = "waves away"
response_help_simple = "wave away"
response_disarm_continuous = "brushes aside"
response_disarm_simple = "brush aside"
response_harm_continuous = "disrupts"
response_harm_simple = "disrupt"
speak_emote = list("oscillates")
maxHealth = 2
health = 2
melee_damage_lower = 5
melee_damage_upper = 5
melee_attack_cooldown = 5 SECONDS
friendly_verb_continuous = "taps"
friendly_verb_simple = "tap"
density = FALSE
basic_mob_flags = DEL_ON_DEATH
pass_flags = PASSTABLE | PASSGRILLE | PASSMOB
mob_size = MOB_SIZE_TINY
gold_core_spawnable = HOSTILE_SPAWN
verb_say = "warps"
verb_ask = "floats inquisitively"
verb_exclaim = "zaps"
verb_yell = "bangs"
initial_language_holder = /datum/language_holder/lightbringer
damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, STAMINA = 1, OXY = 0)
light_range = 4
faction = list(FACTION_NEUTRAL)
unsuitable_atmos_damage = 0
minimum_survivable_temperature = 0
maximum_survivable_temperature = 1500
obj_damage = 0
environment_smash = ENVIRONMENT_SMASH_NONE
ai_controller = /datum/ai_controller/basic_controller/lightgeist
/mob/living/basic/lightgeist/Initialize(mapload)
. = ..()
ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT)
ADD_TRAIT(src, TRAIT_MEDICAL_HUD, INNATE_TRAIT)
remove_verb(src, /mob/living/verb/pulled)
remove_verb(src, /mob/verb/me_verb)
AddElement(/datum/element/simple_flying)
AddComponent(\
/datum/component/healing_touch,\
heal_brute = melee_damage_upper,\
heal_burn = melee_damage_upper,\
heal_time = 0,\
valid_targets_typecache = typecacheof(list(/mob/living)),\
action_text = "%SOURCE% begins mending the wounds of %TARGET%",\
complete_text = "%TARGET%'s wounds mend together.",\
)
/mob/living/basic/lightgeist/melee_attack(atom/target, list/modifiers, ignore_cooldown = FALSE)
. = ..()
if (. && isliving(target))
faction |= REF(target) // Anyone we heal will treat us as a friend
/mob/living/basic/lightgeist/ghost()
. = ..()
if(.)
death()
/datum/ai_controller/basic_controller/lightgeist
blackboard = list(
BB_TARGETING_STRATEGY = /datum/targeting_strategy/lightgeist,
)
ai_traits = PASSIVE_AI_FLAGS
ai_movement = /datum/ai_movement/basic_avoidance
idle_behavior = /datum/idle_behavior/idle_random_walk/less_walking
planning_subtrees = list(
/datum/ai_planning_subtree/simple_find_target,
/datum/ai_planning_subtree/basic_melee_attack_subtree, // We heal things by attacking them
)
/// Attack only mobs who have damage that we can heal, I think this is specific enough not to be a generic type
/datum/targeting_strategy/lightgeist
/// Types of mobs we can heal, not in a blackboard key because there is no point changing this at runtime because the component will already exist
var/heal_biotypes = MOB_ORGANIC | MOB_MINERAL
/// Type of limb we can heal
var/required_bodytype = BODYTYPE_ORGANIC
/datum/targeting_strategy/lightgeist/can_attack(mob/living/living_mob, mob/living/target, vision_range)
if (!isliving(target) || target.stat == DEAD)
return FALSE
if (!(heal_biotypes & target.mob_biotypes))
return FALSE
if (!iscarbon(target))
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)
continue
if (!(part.bodytype & required_bodytype))
continue
return TRUE
return FALSE