12 Commits

Author SHA1 Message Date
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
Ghom 8c89b371af [NO GBP] Fixes ear protection equipment doing nothing. Flashbangs don't work well in vacuums (#93866)
## About The Pull Request
Turns out ear protection was subtracting the values rather than adding
them to the protection, and I didn't notice that much until later (now).
Also flashbangs don't have much of a bang (flashbangs without the bang
basically) when there's no air.

## Why It's Good For The Game
Also everyone should know that IRL sounds don't work well in vacuums cuz
there are no molecules to carry sound waves around. Unfortunately we are
not so refined about it in game, which is a fucking shame. This is a
very simplistic implementation than anything. The fact that I'm adding
it to this PR as well is because being in a vacuum gives you plenty of
sound protection now. It's about *some* consistency.

## Changelog

🆑
fix: Fixes ear protection equipment doing nothing. 
balance: Detonating a flashbang in space or any environment with little
to no air no longer stuns anyone NOT on the same tile as the flashbang
with loud bangs. Flashing still works as intended though.
/🆑
2025-11-13 22:22:39 +11:00
Ghom 922bd0cb92 Refactor get_ear_protection() and soundbang_act() to be less bs (#93472)
so, the current `COMSIG_CARBON_SOUNDBANG` signal is kinda lame because:
1) it's relegated to carbon mobs
2) it means ear protection equipment actually has no effect when
`get_ear_protection` is called instead.
3) It's sent in more than one place in the code

So I replaced it with another signal, this one properly sent in
`get_ear_protection`, and therefore `soundbang_act` as well.

What's also lame is that the code for both `get_ear_protection` and
`soundbang_act` can be easily moved to the living type, and it wouldn't
make a huge impact aside causing simple mobs to be stunned very briefly
by flashbangs since they cannot be knocked down anyway. The less the
code is specific to a subtype, the easier it's to work with, the fewer
the paradigms etc.

Another lame thing is some of the code being kinda old. Also I wanted to
fix an issue with the shriek ling ability detailed in #93401. I wanted
to make the ability more consistent with how other sound-related
abilities work by making it use `soundbang_act`, but with an intensity
higher than any other feature so far, beside point-blank flashbangs
(holding on standing on one). I've also buffed the "ear protection"
offered by vacuums from 1 to 3, meaning nothing but point-blank
flashbangs will go through. Yes, this means shrieks are not good in a
vacuum because sound generally propagate in absence of molecules that
can transmit the vibration... at least IRL. The game's an approximation
anyway, but it's still inconsistent, like a fuckton of other things that
are even more outside of the scope of this PR. Well, at least it affects
simple/basic mobs too now.

## Why It's Good For The Game
This will fix #93401 and make some code less old and bad.

## Changelog

🆑
refactor: refactored code for ear/soundbang protection. Flashbangs and
other things can now affect simple/basic mobs as well, not just carbon
and occasionally silicons.
balance: Aliens are no longer impervious to soundbang_act. Still very
resistant to it due to their hardcoded ear protection
balance: How the resonant shriek changeling ability works is now
slightly more consistent with the ear/soundbang protection, meaning it
won't work well in a vacuum, but at least it works on simple mobs now.
fix: Everyone can now hear a changeling shriek, unless they're already
deafened or in a vacuum.
/🆑
2025-11-04 15:22:33 -05:00
MrMelbert dcedf89c70 Fixes being able to punch yourself (#79033)
## About The Pull Request

Fixes #79031 

Fixes #79042

I forgot some logic here when making the human override. 
Not the cleanest way to do it but it'll suffice. 

## Changelog

🆑 Melbert
fix: You can punch yourself again
/🆑
2023-10-17 13:02:07 -06:00
Zephyr 1900eb9484 Unit Tests use a consistent human subtype (#71515)
title
2022-11-26 20:36:20 +01:00
AnturK 4d6a8bc537 515 Compatibility (#71161)
Makes the code compatible with 515.1594+

Few simple changes and one very painful one.
Let's start with the easy:
* puts call behind `LIBCALL` define, so call_ext is properly used in 515
* Adds `NAMEOF_STATIC(_,X)` macro for nameof in static definitions since
src is now invalid there.
* Fixes tgui and devserver. From 515 onward the tmp3333{procid} cache
directory is not appened to base path in browser controls so we don't
check for it in base js and put the dev server dummy window file in
actual directory not the byond root.
* Renames the few things that had /final/ in typepath to ultimate since
final is a new keyword

And the very painful change:
`.proc/whatever` format is no longer valid, so we're replacing it with
new nameof() function. All this wrapped in three new macros.
`PROC_REF(X)`,`TYPE_PROC_REF(TYPE,X)`,`GLOBAL_PROC_REF(X)`. Global is
not actually necessary but if we get nameof that does not allow globals
it would be nice validation.
This is pretty unwieldy but there's no real alternative.
If you notice anything weird in the commits let me know because majority
was done with regex replace.

@tgstation/commit-access Since the .proc/stuff is pretty big change.

Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2022-11-15 03:50:11 +00:00
Ghom b84ad2dde8 Removes useless status effect path defines. (#64490) 2022-01-30 01:26:04 -08:00
Kylerace e13fe75590 use SIGNAL_HANDLER REEEEEE (#59242)
makes as many procs as i can find use the SIGNAL_HANDLER define which i assumed they all already did
2021-05-24 15:28:02 -04:00
Mothblocks a5010312d9 Put unit tests in a box, fixes sporradic gun test failure (#57408)
* Initial commit

* Fix removing old objects

* Remove define

* TGM
2021-03-05 12:59:57 +01:00
LemonInTheDark f4160f26db Converts all uses of modifiers to lazy access to avoid memes in future (#56846) 2021-02-12 15:25:31 -08:00
Qustinnus 707fc287b4 Replaces intents with combat mode (#56601)
About The Pull Request

This PR removes intents and replaces them with a combat mode. An explanation of what this means can be found below
Major changes:

    Disarm and Grab intents have been removed.
    Harm/Help is now combat mode, toggled by F or 4 by default
    The context/verb/popup menu now only works when you do shift+right-click
    Right click is now disarm, both in and out of combat mode.
    Grabbing is now on ctrl-click.
    If you're in combat mode, and are currently grabbing/pulling someone, and ctrl-click somewhere else, it will not release the grab (To prevent misclicks)

Minor interaction changes:

Right click to dissasemble tables, racks, filing cabinets (When holding the right tool to do so)
Left click to stunbaton, right click to harmbaton
Right click to tip cows
Right click to malpractice surgery
Right click to hold people at gunpoint (if youre holding a gun)
Why It's Good For The Game

Intents heavily cripple both the code and the UI design of interactions. While I understand that a lot of people will dislike this PR as they are used to intents, they are one of our weakest links in terms of explaining to players how to do specific things, and require a lot more keypresses to do compared to this.

As an example, martial arts can now be done without having to juggle 1 2 3 and 4 to switch intents quickly.

As some of you who saw the first combat mode PR, the context menu used to be disabled in combat mode. In this version it is instead on shift-right click ensuring that you can always use it in the same way.

In this version, combat mode also no longer prevents you from attacking with items when you would so before, as this was something that was commonly complained about.

The full intention of this shift in control scheme is that right click will become "secondary interaction" for items, which prevents some of the awkward juggling we have now with item modes etcetera.
Changelog

cl Qustinnus
add: Intents have been replaced with a combat mode. For more info find the PR here: #56601
/cl
2021-02-04 16:37:32 +13:00
Jared-Fogle 151dab8601 Test basic attacks along with the attack chain (#54769)
Tests shoving (as well as the knock down and dropping your item), harming (both with and without an item), and the attack chain.

I can think of a few cases in very recent memory that these have been broken (devil removal breaking melee damage, attack chain breaking due to something else).

Also adds `TRAIT_PERFECT_ATTACKER` which makes your punches always hit. This is currently only used for tests, as they are meant to be reliable.
2020-11-04 10:06:29 -05:00