## About The Pull Request
Empy lists. There are a lot of 'em.
<img width="981" height="512" alt="image"
src="https://github.com/user-attachments/assets/b94b041a-2904-466b-ab89-54bd1de11b4e"
/>
Going through ways to reduce memory I found a few easy ones here. Wires,
the edible component, the seethrough component. None of these are really
a concern when it comes to needing lists in memory for performance
reasons. Wires aren't going to be cut most of the time for each door. A
lot of food does not have any junkiness. Seethrough component lies
dormant most of the round. Etc.
Making lists lazy in these cases should be a no brainer.
Everything I tested still seems to work exactly the same.
## Why It's Good For The Game
Frees memory that is just taking up space a lot of the time.
## Changelog
Not player-facing, this is all under-the-hood stuff.
## About The Pull Request
Plumbing IV drip now has an input and an output, the input only works
when it's injecting and the output only works when it's draining.
You can rotate with it alt click like all other plumbing things now, IV
drip hotkeys removed
## Why It's Good For The Game
It's an *automated* IV drip, the whole point is you can connect it to
plumbing and having half it's functionality just not work is bad.
As for the rotation it's waaaaaay more useful than the IV hotkeys for
plumbing.
## Changelog
🆑 Cat
qol: The plumbing IV drip can be rotate with alt click now
add: The plumbing IV drip can now output chemicals into plumbing
factories
/🆑fixes#93586
---------
Co-authored-by: John Doe <markkavalerov87@gmail.com>
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
## About The Pull Request
nullchecks `held_item` in `iv_drip/plumbing/add_context()` to prevent
runtimes when attempting to check null.tool_behaviour
## Why It's Good For The Game
fixes#93815
## Changelog
🆑
fix: prevents runtime when hovering over plumbing iv drip
/🆑
## About The Pull Request
As Chemists, when make our massive plumbing factories we always use 5u
because anything under is pointless, and only makes our plumbing
factories slower, and takes up extra tedious/unnecessary time to setup.
This is simply a QoL change so that we don't have to keep pressing the
5u button when we make our synthesizers (its very tedious when working
on huge factories).
## Why It's Good For The Game
Less tediousness, notably when making huge factories
## Changelog
🆑 ArchBTW
qol: Makes plumbing synthesizers default to 5u
/🆑
## About The Pull Request
Toilets no longer act as infinite instant water sources, instead working
like showers and sinks - requiring either plumbing, or water reclaimers
to restore their cistern's supply. If a toilet has a large enough fish
inside, or if someone accidentally drops a small item into it, when
flushing it'll spew out all of its cistern's contents around itself
(Dropped items can be removed using a plunger after a small delay).
Also fixed plunger act code on some plumbing objects, and converted
toilets to use item interactions.
### This is a commission for ImprovedName/Ezel
## Why It's Good For The Game
Makes toilets more intresting with plumbing, and brings them more inline
with other plumbing appliances so that way you can't just make a toilet
with 1 material sheet and conjure a infinite water resouce anywhere you
please without a water recycler.
Also you can get up to some silly stuff with foam production.
## Changelog
🆑
add: Toilets now require plumbing or water reclaimers to function, and
can get clogged by small items.
fix: Trying to use plungers on plumbing objects will no longer hit them
after finishing the interaction.
code: Updated toilet item interaction code
/🆑
## About The Pull Request
Packaging category was unset until you swapped the product type in the
UI, so it'd default to naming the pills bottles. Also decapitalized the
suffixes for parity with the rest of pills/patches/bottles.
## Changelog
🆑
fix: Fixed unconfigured pill presses manufacturing pills that claim to
be bottles
spellcheck: Decapitalized pill press suffixes for parity with the rest
of pills/patches/bottles
/🆑
## About The Pull Request
Merges `/datum/reagents/proc/copy_to()` ->
`/datum/reagents/proc/trans_to()`. Added a parameter `copy_only` to
indicate we want a copy operation
## Why It's Good For The Game
- Less code to maintain
- All the functionality of `trans_to()`[logging, transferring single
reagent, expelling reagents from stomach, etc] now applies for copying
reagents as well which was missing a lot of it, so we have consistent
behaviour
## Changelog
🆑
refactor: code for copying reagents has been refactored. Please report
bugs on github
/🆑
(cherry picked from commit a1d27e384d)
## About The Pull Request
Merges `/datum/reagents/proc/copy_to()` ->
`/datum/reagents/proc/trans_to()`. Added a parameter `copy_only` to
indicate we want a copy operation
## Why It's Good For The Game
- Less code to maintain
- All the functionality of `trans_to()`[logging, transferring single
reagent, expelling reagents from stomach, etc] now applies for copying
reagents as well which was missing a lot of it, so we have consistent
behaviour
## Changelog
🆑
refactor: code for copying reagents has been refactored. Please report
bugs on github
/🆑
## About The Pull Request
Most of this is just the standard refactoring `attackby(...) >
item_interaction(...)`, and adding associated screentips.
The plumbing subtype doesn't need its own separate context code, because
the missing alt-click parts get overridden and thus aren't present
anyway.
The alt-click felt very unclear without feedback, so now makes the
standard clicking sound and plays a balloon alert.
The plumbing iv-drip wrench act no longer needs to check for combat
mode, as that's assumed for tool acts, and we use early returns instead
of that odd order of operations.
## Why It's Good For The Game
Less `attackby`
More screentips
More interaction feedback
## Changelog
🆑
refactor: Refactored IV drip item interactions. Please report any
issues.
sound: IV drip alt-click flow minimization/maximization makes the click
sound.
qol: IV drip alt-click flow minimization/maximization gives feedback.
qol: Updated IV drip screentips.
/🆑
## About The Pull Request
Most of this is just the standard refactoring `attackby(...) >
item_interaction(...)`, and adding associated screentips.
The plumbing subtype doesn't need its own separate context code, because
the missing alt-click parts get overridden and thus aren't present
anyway.
The alt-click felt very unclear without feedback, so now makes the
standard clicking sound and plays a balloon alert.
The plumbing iv-drip wrench act no longer needs to check for combat
mode, as that's assumed for tool acts, and we use early returns instead
of that odd order of operations.
## Why It's Good For The Game
Less `attackby`
More screentips
More interaction feedback
## Changelog
🆑
refactor: Refactored IV drip item interactions. Please report any
issues.
sound: IV drip alt-click flow minimization/maximization makes the click
sound.
qol: IV drip alt-click flow minimization/maximization gives feedback.
qol: Updated IV drip screentips.
/🆑
## About The Pull Request
Because it does nothing.
The only reagents that had this flag were inverse reagents & some
medicines but those reagents already had their `inverse_chem` set to
null meaning they are incapable of splitting even without this flag.
From the comments it said the flag had something to do with stomachs
constantly calling `on_mob_add()` which would split the reagent twice
however upon inspecting stomach code no such thing exists so it didn't
create any problems.
Once the reagent enters the mob it splits just once because purity is
preserved when transferring the reagent to different organs so this flag
never had a chance to do anything
Less code to worry about
## Changelog
🆑
code: removed `REAGENT_NOSPLIT` flag
/🆑
## About The Pull Request
Because it does nothing.
The only reagents that had this flag were inverse reagents & some
medicines but those reagents already had their `inverse_chem` set to
null meaning they are incapable of splitting even without this flag.
From the comments it said the flag had something to do with stomachs
constantly calling `on_mob_add()` which would split the reagent twice
however upon inspecting stomach code no such thing exists so it didn't
create any problems.
Once the reagent enters the mob it splits just once because purity is
preserved when transferring the reagent to different organs so this flag
never had a chance to do anything
Less code to worry about
## Changelog
🆑
code: removed `REAGENT_NOSPLIT` flag
/🆑
## About The Pull Request
This has the potential to create a lot of needless mob updates which is
not great. Now should only update a mob's clothing if it was actually
washed.
This PR
1) ensures that all wash() procs return a bitflag.
2) ensures that `wash()` proccalls which result in expensive operations
like icon updates only do so when it is necessary
## Why It's Good For The Game
Updating mob sprites is expensive, and doing it when nothing has been
changed is bad.
## Changelog
Nothing really player facing
## About The Pull Request
This has the potential to create a lot of needless mob updates which is
not great. Now should only update a mob's clothing if it was actually
washed.
This PR
1) ensures that all wash() procs return a bitflag.
2) ensures that `wash()` proccalls which result in expensive operations
like icon updates only do so when it is necessary
## Why It's Good For The Game
Updating mob sprites is expensive, and doing it when nothing has been
changed is bad.
## Changelog
Nothing really player facing
Melee attack chain now has a list passed along with it,
`attack_modifiers`, which you can stick force modifiers to change the
resulting attack
This is basically a soft implementation of damage packets until a more
definitive pr, but one that only applies to item attack chain, and not
unarmed attacks.
This change was done to facilitate a baton refactor - batons no longer
hack together their own attack chain, and are now integrated straight
into the real attack chain. This refactor itself was done because batons
don't send any attack signals, which has been annoying in the past (for
swing combat).
🆑 Melbert
refactor: Batons have been refactored again. Baton stuns now properly
count as an attack, when before it was a nothing. Report any oddities,
particularly in regards to harmbatonning vs normal batonning.
refactor: The method of adjusting item damage mid-attack has been
refactored - some affected items include the Nullblade and knives.
Report any strange happenings with damage numbers.
refactor: A few objects have been moved to the new interaction chain -
records consoles, mawed crucible, alien weeds and space vines, hedges,
restaurant portals, and some mobs - to name a few.
fix: Spears only deal bonus damage against secure lockers, not all
closet types (including crates)
/🆑
## About The Pull Request
Adds printable injectors to chemmaster and chemfactory, re-adds bottles
to chemmaster, fixes chemfactory being unable to print 100u bottles that
broke because of upstream changes - see changelog
## Why It's Good For The Game
bugs are bad, there's no real reason why you shouldnt be able to factory
1u pills
and, well... - printable injectors have been a very much requested
feature - we already have hyposprays, but they arent the kind of
disposable slop you can just throw out to crew and have their own issues
- having a 25u 1.5 sec injection is a good alternative to patches and
pills
having them be non-instant limits the potential to use them for murder
(piercing hypospray is still a much better option for that since you can
pump 50u of death slop into people...)
## Proof Of Testing
there would be some if github didnt refuse to load images for some
reason
i did test it a bunch of localhost though, i swear :3
## Changelog
🆑
add: printable 25u injectors, 1.5 sec injection time to other, instant
self inject, AP
add: you can print bottles and large bottles in the chemmaster, no more
pharmacy condimasters
qol: chemfactory can print items with less than 5u reagents now, down to
1u
fix: chemfactory can print 100u bottles properly again
fix: chemfactory doesn't call vials "bottles" anymore
image: added new injector sprites
/🆑
## About The Pull Request
Melee attack chain now has a list passed along with it,
`attack_modifiers`, which you can stick force modifiers to change the
resulting attack
This is basically a soft implementation of damage packets until a more
definitive pr, but one that only applies to item attack chain, and not
unarmed attacks.
This change was done to facilitate a baton refactor - batons no longer
hack together their own attack chain, and are now integrated straight
into the real attack chain. This refactor itself was done because batons
don't send any attack signals, which has been annoying in the past (for
swing combat).
## Changelog
🆑 Melbert
refactor: Batons have been refactored again. Baton stuns now properly
count as an attack, when before it was a nothing. Report any oddities,
particularly in regards to harmbatonning vs normal batonning.
refactor: The method of adjusting item damage mid-attack has been
refactored - some affected items include the Nullblade and knives.
Report any strange happenings with damage numbers.
refactor: A few objects have been moved to the new interaction chain -
records consoles, mawed crucible, alien weeds and space vines, hedges,
restaurant portals, and some mobs - to name a few.
fix: Spears only deal bonus damage against secure lockers, not all
closet types (including crates)
/🆑
People can now pet held mothroaches and pugs if they want to, or use
items on them, hopefully without causing many issues. After all, it only
took about a couple dozen lines of code to make...
...Oh, did the 527 files changed or the 850~ lines added/removed perhaps
catch your eye? Made you wonder if I accidentally pushed the wrong
branch? or skewed something up big time? Well, nuh uh. I just happen to
be fed up with the melee attack chain still using stringized params
instead of an array/list. It was frankly revolting to see how I'd have
had to otherwise call `list2params` for what I'm trying to accomplish
here, and make this PR another tessera to the immense stupidity of our
attack chain procs calling `params2list` over and over and over instead
of just using that one call instance from `ClickOn` as an argument. It's
2025, honey, wake up!
I also tried to replace some of those single letter vars/args but there
are just way too many of them.
Improving old code. And I want to be able to pet mobroaches while
holding them too.
🆑
qol: You can now interact with held mobs in more ways beside wearing
them.
/🆑
## About The Pull Request
Chemical presses now have a setting to customize pill duration, at 3s by
default (like chemmasters). Both presses and chemmasters now have a
setting for 0s pills, previously the cap was 1 as allowing to completely
dissolve the coating with water was something I only implemented down
the line.
Also slightly cleaned up both chemmaster and chem press files so they
pass linters now.
- Closes#90427
## Why It's Good For The Game
Presses not being able to customize pill durations is kinda silly and
was an oversight on my part, same with 0s pills - you can achieve the
same result, and ideally you should be able to produce those with
presses, at which point there's no reason to not add them to
chemmasters.
## Changelog
🆑
add: You can now customize pill duration in chemical presses
balance: ChemMasters and chemical presses can now create 0s duration
pills.
/🆑
## About The Pull Request
People can now pet held mothroaches and pugs if they want to, or use
items on them, hopefully without causing many issues. After all, it only
took about a couple dozen lines of code to make...
...Oh, did the 527 files changed or the 850~ lines added/removed perhaps
catch your eye? Made you wonder if I accidentally pushed the wrong
branch? or skewed something up big time? Well, nuh uh. I just happen to
be fed up with the melee attack chain still using stringized params
instead of an array/list. It was frankly revolting to see how I'd have
had to otherwise call `list2params` for what I'm trying to accomplish
here, and make this PR another tessera to the immense stupidity of our
attack chain procs calling `params2list` over and over and over instead
of just using that one call instance from `ClickOn` as an argument. It's
2025, honey, wake up!
I also tried to replace some of those single letter vars/args but there
are just way too many of them.
## Why It's Good For The Game
Improving old code. And I want to be able to pet mobroaches while
holding them too.
## Changelog
🆑
qol: You can now interact with held mobs in more ways beside wearing
them.
/🆑
## About The Pull Request
Chemical presses now have a setting to customize pill duration, at 3s by
default (like chemmasters). Both presses and chemmasters now have a
setting for 0s pills, previously the cap was 1 as allowing to completely
dissolve the coating with water was something I only implemented down
the line.
Also slightly cleaned up both chemmaster and chem press files so they
pass linters now.
- Closes#90427
## Why It's Good For The Game
Presses not being able to customize pill durations is kinda silly and
was an oversight on my part, same with 0s pills - you can achieve the
same result, and ideally you should be able to produce those with
presses, at which point there's no reason to not add them to
chemmasters.
## Changelog
🆑
add: You can now customize pill duration in chemical presses
balance: ChemMasters and chemical presses can now create 0s duration
pills.
/🆑
## About The Pull Request
Currently patches are a subtype of pills, and while they have the
``dissolveable`` var set to FALSE, barely anything checks it (because
people don't expect patches to be pills in disguise) so we end up
patches being dissolveable and implantable, which is far from ideal.
Both have been moved into an ``/obj/item/reagent_containers/applicator``
class, which handles their common logic and helps handling cases where
either one fits. As for gameplay changes:
* Pills no longer dissolve instantly, instead adding their contents to
your stomach after 3 seconds (by default). You can increase the timer by
dropping sugar onto them to thicken their coating, 1s per 1u applied, up
to a full minute. Coating can also be dissolved with water, similarly
-1s per 1u applied. Pills with no coating will work like before.
* Patches now only take half as long to apply (1.5s), but also slowly
trickle in their reagents instead of instantly applying all of them.
This is done via embedding so you could theoretically (if you get lucky)
stick a ranged patch at someone, although they are rather quick to rip
off. The implementation and idea itself are separate, but the idea for
having a visual display has been taken from
https://github.com/Monkestation/Monkestation2.0/pull/2558.

* In order to support the new pill mechanics, stomachs have received
contents. Pills and items that you accidentally swallow now go into your
stomach instead of your chest cavity, and may damage it if they're
sharp, requiring having them surgically cut out (cut the stomach open
with a scalpel, then cauterize it to mend the incision). Or maybe you
can get a bacchus's blessing, or a geneticist hulk to gut punch you,
that may also work. Alien devour ability also uses this system now. If
you get a critical slashing wound on your chest contents of your cut
apart stomach (if a surgeon forgot to mend it, or if you ate too much
glass shard for breakfast) may fall out. However, spacemen with the
strong stomach trait can eat as much glass cereal as they want.
Pill duration can also be chosen in ChemMaster when you have a pill
selected, 0 to 30 seconds.

## Why It's Good For The Game
Patches and pills are extremely similar in their implemenation, former
being a worse version of sprays and pills, with only change being that
pills cannot be applied through helmets while patches and sprays ignore
both. This change makes them useful for separate cases, and allows
reenactment of some classic... movie, scenes, with the pill change. As
for stomach contents, this was probably the sanest way of implementing
pill handling, and everything else (item swallowing and cutting stomachs
open to remove a cyanide pill someone ate before it dissolves) kind of
snowballed from there. I pray to whatever gods that are out there that
this won't have some extremely absurd and cursed interactions (it
probably will).
## Changelog
🆑
add: Instead of dissolving instantly, pills now activate after 4
seconds. This timer can be increased by using a dropper filled with
sugar on them, 1s added per 1u dropped.
add: Patches now stick to you and slowly bleed their reagents, instead
of being strictly inferior to both pills and sprays.
add: Items that you accidentally swallow now go into your stomach
contents.
refactor: Patches are no longer considered pills by the game
refactor: All stomachs now have contents, instead of it being exclusive
to aliens. You can cut open a stomach to empty it with a scalpel, and
mend an existing incision with a cautery.
/🆑
Replaces the asset subsystem's spritesheet generator with a rust-based
implementation (https://github.com/tgstation/rust-g/pull/160).
This is a rough port of
https://github.com/BeeStation/BeeStation-Hornet/pull/10404, but it
includes fixes for some cases I didn't catch that apply on TG.
(FWIW we've been using this system on prod for over a year and
encountered no major issues.)

`/datum/asset/spritesheet_batched`: A version of the spritesheet system
that collects a list of `/datum/universal_icon`s and sends them off to
rustg asynchronously, and the generation also runs on another thread, so
the game doesn't block during realize_spritesheet. The rust generation
is about 10x faster when it comes to actual icon generation, but the
biggest perk of the batched spritesheets is the caching system.
This PR notably does not convert a few things to the new spritesheet
generator.
- Species and antagonist icons in the preferences view because they use
getFlatIcon ~~which can't be converted to universal icons~~.
- Yes, this is still a *massive* cost to init, unfortunately. On Bee, I
actually enabled the 'legacy' cache on prod and development, which you
can see in my PR. That's why I added the 'clear cache' verb and the
`unregister()` procs, because it can force a regeneration at runtime. I
decided not to port this, since I think it would be detrimental to the
large amount of contributors here.
- It is *technically* possible to port parts of this to the uni_icon
system by making a uni_icon version of getFlatIcon. However, some
overlays use runtime-generated icons which are ~~completely unparseable
to IconForge, since they're stored in the RSC and don't exist as files
anywhere~~. This is most noticeable with things like hair (which blend
additively with the hair mask on the server, thus making them invisible
to `get_flat_uni_icon`). It also doesn't help that species and antag
icons will still need to generate a bunch of dummies and delete them to
even verify cache validity.
- It is actually possible to write the RSC icons to the filesystem
(using fcopy) and reference them in IconForge. However, I'm going to
wait on doing this until I port my GAGS implementation because it
requires GAGS to exist on the filesystem as well.
IconForge generates a cache based on the set of icons used, all
transform operations applied, and the source DMIs of each icon used
within the spritesheet. It can compare the hashes and invalidate the
cache automatically if any of these change. This means we can enable
caching on development, and have absolutely no downsides, because if
anything changes, the cache invalidates itself.
The caching has a mean cost of ~5ms and saves a lot of time compared to
generating the spritesheet, even with rust's faster generation. The main
downside is that the cache still requires building the list of icons and
their transforms, then json encoding it to send to rustg.
Here's an abbreviated example of a cache JSON. All of these need to
match for the cache to be valid. `input_hash` contains the transform
definitions for all the sprites in the spritesheet, so if the input to
iconforge changes, that hash catches it. The `sizes` and `sprites` are
loaded into DM.
```json
{
"input_hash": "99f1bc67d590e000",
"dmi_hashes": {
"icons/ui/achievements/achievements.dmi": "771200c75da11c62"
},
"sizes": [
"76x76"
],
"sprites": {
"achievement-rustascend": {
"size_id": "76x76",
"position": 1
}
},
"rustg_version": "3.6.0",
"dm_version": 1
}
```
Universal icons are just a collection of DMI, Icon State, and any icon
transformation procs you apply (blends, crops, scales). They can be
convered to DM icons via `to_icon()`. I've included an implementation of
GAGS that produces universal icons, allowing GAGS items to be converted
into them. IconForge can read universal icons and add them to
spritesheets. It's basically just a wrapper that reimplements BYOND icon
procs.
Converts some uses of md5asfile within legacy spritesheets to use
rustg_hash_file instead, improving the performance of their generation.
Fixes lizard body markings not showing in previews, and re-adds eyes to
the ethereal color preview. This is a side effect of IconForge having
*much* better error handling than DM icon procs. Invalid stuff that gets
passed around will error instead of silently doing nothing.
Changes the CSS used in legacy spritesheet generation to split
`background: url(...) no-repeat` into separate props. This is necessary
for WebView2, as IE treats these properties differently - adding
`background-color` to an icon object (as seen in the R&D console) won't
work if you don't split these out.
Deletes unused spritesheets and their associated icons (condiments
spritesheet, old PDA spritesheet)
If you press "Character Setup", the 10-13sec of lag is now approximately
0.5-2 seconds.
Tracy profile showing the time spent on get_asset_datum. I pressed the
preferences button during init on both branches. Do note that this was
ran with a smart cache HIT, so no generation occurred.

Much lower worst-case for /datum/asset/New (which includes
`create_spritesheets()` and `register()`)

Here's a look at the internal costs from rustg - as you can see
`generate_spritesheet()` is very fast:

**Before**

**After**

🆑
fix: Fixed lizard body markings and ethereal feature previews in the
preference menu missing some overlays.
refactor: Optimized spritesheet asset generation greatly using rustg
IconForge, greatly reducing post-initialization lag as well as reducing
init times and saving server computation.
config: Added 'smart' asset caching, for batched rustg IconForge
spritesheets. It is persistent and suitable for use on local, with
automatic invalidation.
add: Added admin verbs - Debug -> Clear Smart/Legacy Asset Cache for
spritesheets.
fix: Fixed R&D console icons breaking on WebView2/516
/🆑
## About The Pull Request
**1. Code Improvements**
- `get_reagent_log_string()` now won't round reagent volumes cause they
are already rounded by `update_total()` so its slightly faster
- `trans_to()` now logs reagents faster as it does it in place without
the overhead of passing the list to `get_external_reagent_log_string()`
which parses our list into another list which is just unessassary
- `trans_to()` is now faster performance wise as it no longer relies on
`remove_reagent()` to remove the reagent
- Merged `multiply_single_reagent()` into a single proc `multiply()`
which does the job for both single & multiple reagents to reduce code.
it now no longer uses proc `remove_reagent()` making it faster when
reducing reagents
- `copy_to()` no longer rounds its return value thus improving
performance & won't return false negatives for values lesser than 0.01
**2. Fixes**
- Fixes `multiply_single_reagent()` multiplying reagent subtypes as well
instead of just the target type as it uses `locate()`
- Fixes `multiply_reagents()` multiplying reagents twice. Notice how it
would call `_multiply_reagent()` & then again do the exact same thing as
that proc in the next line
https://github.com/tgstation/tgstation/blob/dfe9f50ad74507dabf8b9a534f385cad170c53c1/code/modules/reagents/chemistry/holder/holder.dm#L605-L609
- `convert_reagent()` actually uses the weighted ph. I was wrong in what
I assumed `override_base_ph` did
Just lesser & faster code overall
## Changelog
🆑
fix: multiplying reagents in cases like fishing & chem splash will yield
accurate results. New amounts differ from present values
fix: converting reagents actually yields correct ph again
code: improved performance of reagent logging
code: copying reagents won't return false negatives for values lesser
than 0.01
/🆑
## About The Pull Request
Replaces the asset subsystem's spritesheet generator with a rust-based
implementation (https://github.com/tgstation/rust-g/pull/160).
This is a rough port of
https://github.com/BeeStation/BeeStation-Hornet/pull/10404, but it
includes fixes for some cases I didn't catch that apply on TG.
(FWIW we've been using this system on prod for over a year and
encountered no major issues.)
### TG MAINTAINER NOTE

### Batched Spritesheets
`/datum/asset/spritesheet_batched`: A version of the spritesheet system
that collects a list of `/datum/universal_icon`s and sends them off to
rustg asynchronously, and the generation also runs on another thread, so
the game doesn't block during realize_spritesheet. The rust generation
is about 10x faster when it comes to actual icon generation, but the
biggest perk of the batched spritesheets is the caching system.
This PR notably does not convert a few things to the new spritesheet
generator.
- Species and antagonist icons in the preferences view because they use
getFlatIcon ~~which can't be converted to universal icons~~.
- Yes, this is still a *massive* cost to init, unfortunately. On Bee, I
actually enabled the 'legacy' cache on prod and development, which you
can see in my PR. That's why I added the 'clear cache' verb and the
`unregister()` procs, because it can force a regeneration at runtime. I
decided not to port this, since I think it would be detrimental to the
large amount of contributors here.
- It is *technically* possible to port parts of this to the uni_icon
system by making a uni_icon version of getFlatIcon. However, some
overlays use runtime-generated icons which are ~~completely unparseable
to IconForge, since they're stored in the RSC and don't exist as files
anywhere~~. This is most noticeable with things like hair (which blend
additively with the hair mask on the server, thus making them invisible
to `get_flat_uni_icon`). It also doesn't help that species and antag
icons will still need to generate a bunch of dummies and delete them to
even verify cache validity.
- It is actually possible to write the RSC icons to the filesystem
(using fcopy) and reference them in IconForge. However, I'm going to
wait on doing this until I port my GAGS implementation because it
requires GAGS to exist on the filesystem as well.
#### Caching
IconForge generates a cache based on the set of icons used, all
transform operations applied, and the source DMIs of each icon used
within the spritesheet. It can compare the hashes and invalidate the
cache automatically if any of these change. This means we can enable
caching on development, and have absolutely no downsides, because if
anything changes, the cache invalidates itself.
The caching has a mean cost of ~5ms and saves a lot of time compared to
generating the spritesheet, even with rust's faster generation. The main
downside is that the cache still requires building the list of icons and
their transforms, then json encoding it to send to rustg.
Here's an abbreviated example of a cache JSON. All of these need to
match for the cache to be valid. `input_hash` contains the transform
definitions for all the sprites in the spritesheet, so if the input to
iconforge changes, that hash catches it. The `sizes` and `sprites` are
loaded into DM.
```json
{
"input_hash": "99f1bc67d590e000",
"dmi_hashes": {
"icons/ui/achievements/achievements.dmi": "771200c75da11c62"
},
"sizes": [
"76x76"
],
"sprites": {
"achievement-rustascend": {
"size_id": "76x76",
"position": 1
}
},
"rustg_version": "3.6.0",
"dm_version": 1
}
```
### Universal Icons
Universal icons are just a collection of DMI, Icon State, and any icon
transformation procs you apply (blends, crops, scales). They can be
convered to DM icons via `to_icon()`. I've included an implementation of
GAGS that produces universal icons, allowing GAGS items to be converted
into them. IconForge can read universal icons and add them to
spritesheets. It's basically just a wrapper that reimplements BYOND icon
procs.
### Other Stuff
Converts some uses of md5asfile within legacy spritesheets to use
rustg_hash_file instead, improving the performance of their generation.
Fixes lizard body markings not showing in previews, and re-adds eyes to
the ethereal color preview. This is a side effect of IconForge having
*much* better error handling than DM icon procs. Invalid stuff that gets
passed around will error instead of silently doing nothing.
Changes the CSS used in legacy spritesheet generation to split
`background: url(...) no-repeat` into separate props. This is necessary
for WebView2, as IE treats these properties differently - adding
`background-color` to an icon object (as seen in the R&D console) won't
work if you don't split these out.
Deletes unused spritesheets and their associated icons (condiments
spritesheet, old PDA spritesheet)
## Why It's Good For The Game
If you press "Character Setup", the 10-13sec of lag is now approximately
0.5-2 seconds.
Tracy profile showing the time spent on get_asset_datum. I pressed the
preferences button during init on both branches. Do note that this was
ran with a smart cache HIT, so no generation occurred.

Much lower worst-case for /datum/asset/New (which includes
`create_spritesheets()` and `register()`)

Here's a look at the internal costs from rustg - as you can see
`generate_spritesheet()` is very fast:

### Comparison for a single spritesheet - chat spritesheet:
**Before**

**After**

## Changelog
🆑
fix: Fixed lizard body markings and ethereal feature previews in the
preference menu missing some overlays.
refactor: Optimized spritesheet asset generation greatly using rustg
IconForge, greatly reducing post-initialization lag as well as reducing
init times and saving server computation.
config: Added 'smart' asset caching, for batched rustg IconForge
spritesheets. It is persistent and suitable for use on local, with
automatic invalidation.
add: Added admin verbs - Debug -> Clear Smart/Legacy Asset Cache for
spritesheets.
fix: Fixed R&D console icons breaking on WebView2/516
/🆑
## About The Pull Request
**1. Code Improvements**
- `get_reagent_log_string()` now won't round reagent volumes cause they
are already rounded by `update_total()` so its slightly faster
- `trans_to()` now logs reagents faster as it does it in place without
the overhead of passing the list to `get_external_reagent_log_string()`
which parses our list into another list which is just unessassary
- `trans_to()` is now faster performance wise as it no longer relies on
`remove_reagent()` to remove the reagent
- Merged `multiply_single_reagent()` into a single proc `multiply()`
which does the job for both single & multiple reagents to reduce code.
it now no longer uses proc `remove_reagent()` making it faster when
reducing reagents
- `copy_to()` no longer rounds its return value thus improving
performance & won't return false negatives for values lesser than 0.01
**2. Fixes**
- Fixes `multiply_single_reagent()` multiplying reagent subtypes as well
instead of just the target type as it uses `locate()`
- Fixes `multiply_reagents()` multiplying reagents twice. Notice how it
would call `_multiply_reagent()` & then again do the exact same thing as
that proc in the next line
https://github.com/tgstation/tgstation/blob/dfe9f50ad74507dabf8b9a534f385cad170c53c1/code/modules/reagents/chemistry/holder/holder.dm#L605-L609
- `convert_reagent()` actually uses the weighted ph. I was wrong in what
I assumed `override_base_ph` did
Just lesser & faster code overall
## Changelog
🆑
fix: multiplying reagents in cases like fishing & chem splash will yield
accurate results. New amounts differ from present values
fix: converting reagents actually yields correct ph again
code: improved performance of reagent logging
code: copying reagents won't return false negatives for values lesser
than 0.01
/🆑
## About The Pull Request
Commit messages should be descriptive of all changes.
The "incorrect `\The` macro capitalization" was intentional when it was
added, but as far as I know TG says "the supermatter" rather than "The
Supermatter," so it's incorrect now.
This is completely untested. I don't even know how you'd go about
testing this, it's just a fuckton of strings.
Someday I want to extract them and run NLP on it to catch grammar
problems...
## Why It's Good For The Game
Basic grammar pass for name strings. Should make `\the` work better and
avoid cases like `the John Smith`.
## About The Pull Request
- removed manual rounding of the reagent holder's `total_volume` from
wherever this var was used. It's already done by `update_total()` so
this makes that code slightly faster
- `add_reagent()` now won't return a false positive when adding reagent
amounts less than 0.01 if that reagent was being added for the first
time as it would get deleted immediately
- `remove_reagent()` & `get_reagent_amount()` now also don't round their
return value so you can work with more accurate values
- `trans_to()` won't return a false negative when transferring amounts
less than 0.01 even when the operation was successful. This also makes
it slightly faster cause we no longer round the return value
## Changelog
🆑
fix: adding/transferring reagent amounts less than 0.01 now won't return
false results
code: removed excessive rounding of reagent volumes thus slightly
improving performance
/🆑
## About The Pull Request
Refactors the way we listen for reagent changes. The changes made can be
listed as points
**1. Removes `COMSIG_REAGENTS_PRE_ADD_REAGENT`**
Used to stop new reagents from being added to the holder, its only
application is with the BRPED to stop inserting reagents into
beakers/cells stored inside it.
Rather than using this signal a cleaner solution is to simply remove the
component part's reagent holders' flags which allow us to insert
reagents into it(i.e. `REFILABLE`, `INJECTIBLE`, `DRAINABLE`) and
restore them back when that part is removed thus achieving the same
results.
Thus `add_reagent()` is now slightly faster because it no longer uses
this signal
**2. Removes every other signal used by the reagent holder**
Removes pretty much every other signal used by `holder.dm` which are
`COMSIG_REAGENTS_[NEW_REAGENT, ADD_REAGENT,
DEL_REAGENT, REM_REAGENT, CLEAR_REAGENTS]`
While yes, it is true that all these signals are unique & serve a
specific purpose the problem is no object in code respects their
uniqueness & instead clumps them up all together & hooks them onto one
proc to listen for "reagent changes". You see this code pattern repeated
in so many places
https://github.com/tgstation/tgstation/blob/9277364ef6449262e2c693ff6817925e074c47ce/code/modules/power/power_store.dm#L105
Not only does this look ugly but it also has a memory overhead (4 to 5
signal slots all performing the same action which is a lot compared to
the solution i implemented below). Bonus is that "none" of the
parameters passed to this proc are used so they go to waste as well.
So after removing a ton of code we need something that can still make
the code function which brings us to point 3
**3. Adds a new signal `COMSIG_REAGENTS_HOLDER_UPDATED` to rule them
all**
So if all objects in game are listening for "reagent
changes"[adding/removing, reagents] then we need to look at the proc
that is always called during these changes & that is none other than
`update_total()` so we let that send out a signal and cause all objects
to hook onto this 1 signal instead of 4 to 5 signals as explained in
point 2
## Why It's Good For The Game
This section isn't necessary but i want us to better appreciate both the
code & performance benifits of this PR.
1. First of all its waaaay less code and signals to worry about. Just
look at the number of lines of code removed compared to added. Nothing
more to say
2. Overhead of `RegisterSignal` compared to `RegisterSignals` is less
for obvious reasons
3. `remove_all` is significantly faster as it no longer calls
`remove_reagent()`[which in turn calls `update_total()` &
`handle_reactions()` per call & uses a for loop so its a nested for loop
of doom] for every reagent it removes, instead it does the work by
itself & calls the above 2 procs just once
4. Usually when a reagent is deleted it calls
`COMSIG_REAGENTS_REM_REAGENT` & `COMSIG_REAGENTS_DEL_REAGENT`. So if you
have a holder with like 3 reagents upon transferring/deleting them you
get a total of 6 signal calls!!. Now it's just 3(when using `trans_to`)
and just 1 when using `remove_all/clear_reagents`. Need i say more no
## Changelog
🆑
fix: hydrophonics circuit component actually sets output level when
reagents are changed in the tray
refactor: refactors how code listens for reagent changes. Report bugs on
github
/🆑
## About The Pull Request
- Catalysts would be stored in both `required_reagents` & `catalysts`
lists so it would occupy memory twice. This ensures they are stored in
their own respective lists thus saving memory
- Removes redundant `return FALSE` statements inside `ui_act()`. The
parent return value is already `FALSE` so we can just allow that to
return instead of explicitly specifying it when a certain condition
fails
## Changelog
🆑
code: improved ui data code for plumbing reaction chamber
/🆑
## About The Pull Request
Plumbing components waste extra ticks in requesting reagents if those
requested reagents are stored in a reaction chamber & they are catalysts
which cannot be sent out. That is because the reaction chamber lies &
tells the pipeline it can give them inside it's
`/datum/component/plumbing/reaction_chamber/can_give()` proc but won't
actually transfer them if it has no excess to spare.
This doesn't cause errors because those components will eventually get
their requested values from other supplies but it takes extra ticks to
do so
This ensures the reaction chamber won't volunteer itself as a supplier
if it can't give out those catalysts thus enabling the pipeline to
request more accurate values by excluding that reaction chamber from its
list suppliers
## Changelog
🆑
code: plumbing reaction chamber won't waste extra ticks for the pipeline
when sending out catalysts
/🆑
---------
Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
## About The Pull Request
see title
also see video
https://github.com/user-attachments/assets/23e2d128-1175-4779-87cf-74a4d4e6e1c1
## Why It's Good For The Game
doing in 1 machine what was once done by 3-4 is nicer for the chemist.
less materials wasted and more space available to play around in. also
has the side effect of making the output slightly higher since time
spent transferring catalysts can now be spent on transferring reagents
that are consumed instead
## Changelog
🆑
add: catalyst function for plumbing reaction chambers
/🆑
---------
Co-authored-by: SyncIt21 <VLord3D@gmail.com>
## About The Pull Request
https://github.com/user-attachments/assets/173c1753-3da4-4180-80ea-eb49d19e7b2f
Purely visual. Pulling someone from an IV drip is dangerous so it's nice
to make it more clear than the current very small appearance change that
doesn't give you any more information than that *someone* is connected.
If you review tell me on Discord bc I don't check GitHub
## Changelog
🆑
qol: IV drips now create a beam from their spout to your body, and will
visually pull you closer.
/🆑
## About The Pull Request
- Fixes#88001. Pllumbing pill press now reads the maximum volume of the
selected product instead of showing a constant of 50u. Patches have a
maximum volume of 40u so we send that to the UI
- Plumbing pill press now validates the selected container to see if
it's a valid printable option to prevent href exploits. It has the same
issue as #87779 but now that's fixed
- Plumbing pill press checks to see if the input volume is a number and
returns false to stop the UI from updating if not
## Changelog
🆑
fix: plumbing pill press advertises the correct maximum volume of your
selected product instead of always 50u on the UI
code: plumbing pill press validates selected container to prevent href
exploits
code: plumbing pill press validates input volume to see if it's a number
/🆑
## About The Pull Request
- Grinding & juicing are now recursive operations (grind the item & all
its contents) not just for reagent grinder but also for mortar pedestal
& plumbing grinder so you can get all them juices
- Fixes#87719. Plumbing grinder won't destroy slime extracts after
grinding
- Mortar pedestal now grinds & juices more items since it correctly
checks if that object has more reagents to offer
- Reagent grinder, plumbing grinder & mortar pedestal now respect
`blend_requirements()` so you get consistent behaviour across them
## Changelog
🆑
fix: mortar pedestal now grinds & juices items that previously could not
be processed
fix: plumbing grinder won't destroy slime extracts after grinding
refactor: grinding & juicing code has been refactored overall. Please
report bugs on github
/🆑
3591 individual conflicts
Update build.js
Update install_node.sh
Update byond.js
oh my fucking god
hat
slow
huh
holy shit
we all fall down
2 more I missed
2900 individual conflicts
2700 Individual conflicts
replaces yarn file with tg version, bumping us down to 2200-ish
Down to 2000 individual conflicts
140 down
mmm
aaaaaaaaaaaaaaaaaaa
not yt
575
soon
900 individual conflicts
600 individual conflicts, 121 file conflicts
im not okay
160 across 19 files
29 in 4 files
0 conflicts, compiletime fix time
some minor incap stuff
missed ticks
weird dupe definition stuff
missed ticks 2
incap fixes
undefs and pie fix
Radio update and some extra minor stuff
returns a single override
no more dupe definitions, 175 compiletime errors
Unticked file fix
sound and emote stuff
honk and more radio stuff
## About The Pull Request
<details>
- renamed ai folder to announcer
-- announcer --
- moved vox_fem to announcer
- moved approachingTG to announcer
- separated the ambience folder into ambience and instrumental
-- ambience --
- created holy folder moved all related sounds there
- created engineering folder and moved all related sounds there
- created security folder and moved ambidet there
- created general folder and moved ambigen there
- created icemoon folder and moved all icebox-related ambience there
- created medical folder and moved all medbay-related ambi there
- created ruin folder and moves all ruins ambi there
- created beach folder and moved seag and shore there
- created lavaland folder and moved related ambi there
- created aurora_caelus folder and placed its ambi there
- created misc folder and moved the rest of the files that don't have a
specific category into it
-- instrumental --
- moved traitor folder here
- created lobby_music folder and placed our songs there (title0 not used
anywhere? - server-side modification?)
-- items --
- moved secdeath to hailer
- moved surgery to handling
-- effects --
- moved chemistry into effects
- moved hallucinations into effects
- moved health into effects
- moved magic into effects
-- vehicles --
- moved mecha into vehicles
created mobs folder
-- mobs --
- moved creatures folder into mobs
- moved voice into mobs
renamed creatures to non-humanoids
renamed voice to humanoids
-- non-humanoids--
created cyborg folder
created hiss folder
moved harmalarm.ogg to cyborg
-- humanoids --
-- misc --
moved ghostwhisper to misc
moved insane_low_laugh to misc
I give up trying to document this.
</details>
- [X] ambience
- [x] announcer
- [x] effects
- [X] instrumental
- [x] items
- [x] machines
- [x] misc
- [X] mobs
- [X] runtime
- [X] vehicles
- [ ] attributions
## Why It's Good For The Game
This folder is so disorganized that it's vomit inducing, will make it
easier to find and add new sounds, providng a minor structure to the
sound folder.
## Changelog
🆑 grungussuss
refactor: the sound folder in the source code has been reorganized,
please report any oddities with sounds playing or not playing
server: lobby music has been repathed to sound/music/lobby_music
/🆑