Files
Joshua KidderandGitHub 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

178 lines
6.0 KiB
Plaintext

/mob/living/basic/mushroom
name = "walking mushroom"
desc = "It's a massive mushroom... with legs?"
icon_state = "mushroom_color"
icon_living = "mushroom_color"
icon_dead = "mushroom_dead"
mob_biotypes = MOB_ORGANIC | MOB_PLANT
response_help_continuous = "pets"
response_help_simple = "pet"
response_disarm_continuous = "gently pushes aside"
response_disarm_simple = "gently push aside"
response_harm_continuous = "whacks"
response_harm_simple = "whack"
speed = 1
melee_damage_lower = 4
melee_damage_upper = 4
maxHealth = 60
attack_verb_continuous = "chomps"
attack_verb_simple = "chomp"
attack_sound = 'sound/items/weapons/bite.ogg'
attack_vis_effect = ATTACK_EFFECT_BITE
faction = list(FACTION_MUSHROOM)
speak_emote = list("squeaks")
death_message = "fainted!"
ai_controller = /datum/ai_controller/basic_controller/mushroom
var/cap_color = "#ffffff"
///Tracks our general strength level gained from eating other shrooms
var/powerlevel = 0
///If someone tries to cheat the system by attacking a shroom to lower its health, punish them so that it won't award levels to shrooms that eat it
var/bruised = FALSE
///If we hit three, another mushroom's gonna eat us
var/faint_ticker = 0
///Where we store our cap icons so we dont generate them constantly to update our icon
var/static/mutable_appearance/cap_living
///Where we store our cap icons so we dont generate them constantly to update our icon
var/static/mutable_appearance/cap_dead
///Cooldown that tracks how long its been since revival
COOLDOWN_DECLARE(recovery_cooldown)
/mob/living/basic/mushroom/Initialize(mapload)
. = ..()
melee_damage_lower = rand(3, 5)
melee_damage_upper = rand(10,20)
maxHealth = rand(50,70)
cap_living = cap_living || mutable_appearance(icon, "mushroom_cap")
cap_dead = cap_dead || mutable_appearance(icon, "mushroom_cap_dead")
cap_color = rgb(rand(0, 255), rand(0, 255), rand(0, 255))
update_mushroomcap()
health = maxHealth
AddElement(/datum/element/swabable, CELL_LINE_TABLE_WALKING_MUSHROOM, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 5)
ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT)
/datum/ai_controller/basic_controller/mushroom
blackboard = list(
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/mushroom,
BB_TARGET_MINIMUM_STAT = DEAD,
)
ai_movement = /datum/ai_movement/basic_avoidance
idle_behavior = /datum/idle_behavior/idle_random_walk
planning_subtrees = list(
/datum/ai_planning_subtree/simple_find_target,
/datum/ai_planning_subtree/basic_melee_attack_subtree,
/datum/ai_planning_subtree/find_and_hunt_target/mushroom_food,
)
/datum/targeting_strategy/basic/mushroom
///we only attacked another mushrooms
/datum/targeting_strategy/basic/mushroom/faction_check(datum/ai_controller/controller, mob/living/living_mob, mob/living/the_target)
return !living_mob.faction_check_atom(the_target, exact_match = check_factions_exactly)
/datum/ai_planning_subtree/find_and_hunt_target/mushroom_food
target_key = BB_LOW_PRIORITY_HUNTING_TARGET
hunting_behavior = /datum/ai_behavior/hunt_target/interact_with_target/reset_target
hunt_targets = list(/obj/item/food/grown/mushroom)
hunt_range = 6
/mob/living/basic/mushroom/UnarmedAttack(atom/attack_target, proximity_flag, list/modifiers)
. = ..()
if(!.)
return
if(!proximity_flag)
return
if(istype(attack_target, /obj/item/food/grown/mushroom))
recover(attack_target)
return TRUE
/mob/living/basic/mushroom/melee_attack(mob/living/basic/mushroom/target, list/modifiers, ignore_cooldown = FALSE)
. = ..()
if(!.)
return FALSE
if(!istype(target) || target.stat != DEAD)
return
if(target.faint_ticker >= 3)
consume_mushroom(target)
return
target.faint_ticker++
visible_message(span_notice("[src] chews a bit on [target]."))
/mob/living/basic/mushroom/proc/consume_mushroom(mob/living/basic/mushroom/consumed)
visible_message(span_warning("[src] devours [consumed]!"))
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)
adjust_brute_loss(-consumed.maxHealth)
qdel(consumed)
/mob/living/basic/mushroom/revive(full_heal_flags = NONE, excess_healing = 0, force_grab_ghost = FALSE)
. = ..()
if(!.)
return
icon_state = "mushroom_color"
update_mushroomcap()
/mob/living/basic/mushroom/death(gibbed)
. = ..()
update_mushroomcap()
/mob/living/basic/mushroom/proc/update_mushroomcap()
cut_overlays()
cap_living.color = cap_color
cap_dead.color = cap_color
if(stat == DEAD)
add_overlay(cap_dead)
else
add_overlay(cap_living)
/mob/living/basic/mushroom/proc/recover(obj/item/mush_meal)
visible_message(span_notice("[src] eats [mush_meal]!"))
update_mushroomcap()
qdel(mush_meal)
if(!COOLDOWN_FINISHED(src, recovery_cooldown))
return
faint_ticker = 0
if(stat == DEAD)
revive(HEAL_ALL)
else
adjust_brute_loss(-5)
COOLDOWN_START(src, recovery_cooldown, 5 MINUTES)
/mob/living/basic/mushroom/proc/level_up(level_gain)
adjust_brute_loss(-maxHealth) //They'll always heal, even if they don't gain a level
if(powerlevel > 9)
return
if(level_gain == 0)
level_gain = 1
powerlevel += level_gain
if(prob(25))
melee_damage_lower += (level_gain * rand(1,5))
else
melee_damage_upper += (level_gain * rand(1,5))
maxHealth += (level_gain * rand(1,5))
/mob/living/basic/mushroom/attackby(obj/item/mush, mob/living/carbon/human/user, list/modifiers, list/attack_modifiers)
if(istype(mush, /obj/item/food/grown/mushroom))
recover(mush)
return
if(mush.force || user.combat_mode)
bruised = TRUE
return ..()
/mob/living/basic/mushroom/harvest(mob/living/user)
var/counter
for(counter=0, counter <= powerlevel, counter++)
var/obj/item/food/hugemushroomslice/shroomslice = new /obj/item/food/hugemushroomslice(src.loc)
shroomslice.reagents.add_reagent(/datum/reagent/drug/mushroomhallucinogen, powerlevel)
shroomslice.reagents.add_reagent(/datum/reagent/medicine/omnizine, powerlevel)
shroomslice.reagents.add_reagent(/datum/reagent/medicine/synaptizine, powerlevel)