Commit Graph

4 Commits

Author SHA1 Message Date
SyncIt21 2618cffef3 Replaces micro dosing with volumetric dosing (#94621)
## About The Pull Request
To understand the PR we should first define what is micro dosing &
volumetric dosing

- **Micro dosing:** The reagent effects are **independent** of the
volume of reagent metabolized and are constant every tick, so the effect
you get from metabolizing 0.01u of a reagent is the same as metabolizing
1u of a reagent
- **Volumetric dosing:** The reagent effects are **dependent** on the
volume of reagent metabolized per tick, so the effect you get from
metabolizing 0.01u is much lower compared to metabolizing 1u of a
reagent which is much higher

This PR replaces **micro dosing** with **volumetric dosing** so if you
increase metabolization rates and absorb more reagents you get higher
effects from that reagent & vice versa for lower metabolization rates.

With that lets ask the core questions

**How does this affect present reagent values?**

_This PR scales all reagent effects such that even if it has a lower
metabolization rate the value is the same as before but will still scale
with reagent volumes & mob metabolization levels_

Under normal circumstances most reagents metabolize at 0.4u of reagent
per tick so as long as this value isn't changed by cybernetic body parts
or other reagents you will get the same values as before and won't
notice anything different in normal gameplay.

However, if you do get enhanced body parts like a cybernetic
liver/stomach or use reagents with metabolization rates different from
0.4u you will now get more/less affects depending on how much reagent is
consumed. Here is an example

Consider Syriniver this is how the formulae look like.

```dm
adjust_tox_loss(-1 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype)
``` 

as long as 0.4u of it is metabolized every tick you get 2 tox loss
healing which is the same as before. However, this time if you
metabolize 0.01u of the reagent you get only 0.1 tox loss healing. If
you metabolize 1u reagent per tick, then you get 5 tox loss healing

**What about cigarettes?**
Unaffected. The amount of reagents injected into a mob per tick **does
not** affect the rate at which it is metabolized. Even if you have like
10u of cigarette reagents within you, if you are metabolizing just 0.4u
of it every tick then nothing changes

## Why It's Good For The Game
- Volumetric dosing is realistic. If you metabolize more reagent you
should be getting more benefits and lesser volumes should yield lesser
affects
- Microdosing is an exploit that should have been patched a long of time
ago because it encourages people to put in minimal effort to produce
just 0.01u of reagent to get maximum affects. This coupled with slower
metabolization rates leads to unbalanced higher reagent effects for
longer periods of time.
- This PR address the core issue in #93991 which is heal all patches.
Plumbing was gutted in an unnatural way by making the plumbing iv
drip/output gate/pill press behave essentially as mini reaction chambers
by filtering just 5 reagents. With this heal all patches are nerfed
based on the number & now volume of reagents you can put in a patch, so
its concern is addressed. If this does get merged, we can hopefully
revert it and make plumbing great and behave like large factories again
<img width="914" height="230" alt="Screenshot (532)"
src="https://github.com/user-attachments/assets/96467fad-b32f-409a-a1e8-2a92b8ff6565"
/>


## Changelog
🆑
fix: probability reagent affects scale correctly
balance: reagent affects now scale with the volume of reagent
metabolized meaning lower metabolization rates (from like cybernetic
organs) yield lower effects & higher rates yield higher effects
/🆑
2026-01-07 00:14:54 -05:00
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 778ed9f1ab The death or internal/external organ pathing (ft. fixed fox ears and recoloring bodypart overlays with dye sprays) (#87434)
## About The Pull Request
This PR kills the abstract internal and external typepaths for organs,
now replaced by an EXTERNAL_ORGAN flag to distinguish the two kinds.

This PR also fixes fox ears (from #87162, no tail is added) and
mushpeople's caps (they should be red, the screenshot is a tad
outdated).

And yes, you can now use a hair dye spray to recolor body parts like
most tails, podpeople hair, mushpeople caps and cat ears. The process
can be reversed by using the spray again.

## Why It's Good For The Game
Time-Green put some effort during the last few months to untie functions
and mechanics from external/internal organ pathing. Now, all that this
pathing is good for are a few typechecks, easily replaceable with
bitflags.

Also podpeople and mushpeople need a way to recolor their "hair". This
kind of applies to fish tails from the fish infusion, which colors can't
be selected right now. The rest is just there if you ever want to
recolor your lizard tail for some reason.

Proof of testing btw (screenshot taken before mushpeople cap fix, right
side has dyed body parts, moth can't be dyed, they're already fabolous):

![immagine](https://github.com/user-attachments/assets/2bb625c9-9233-42eb-b9b8-e0bd6909ce89)

## Changelog

🆑
code: Removed internal/external pathing from organs in favor of a bit
flag. Hopefully this shouldn't break anything about organs.
fix: Fixed invisible fox ears.
fix: Fixed mushpeople caps not being colored red by default.
add: You can now dye most tails, podpeople hair, mushpeople caps etc.
with a hair dye spray.
/🆑
2024-10-30 08:03:02 +01:00
tattle 7d88cab6da Unit tests for bone livers (#76421)
## About The Pull Request
For the unit test project; checks to make sure skeletons with bone
livers heal from drinking milk and get damaged from bone hurting juice.

Also adds unit tests for plasmamen (slowly) healing wounds from plasma
and hot ice, as well as getting druggy and hallucinating from gunpowder.

## Why It's Good For The Game
https://github.com/tgstation/tgstation/projects/17#card-88900874

---------

Co-authored-by: tattle <article.disaster@gmail.com>
2023-06-30 21:38:25 -06:00