Files
Bubberstation/code/modules/unit_tests/reagent_transfer.dm
Timberpoes 92396364a0 Adds unit test for reagent transfer and fixes infinite reagent transfer bug. (#69487)
About The Pull Request

Fixes #69483

#69432 broke reagent transfer.

image

As we can see above, we've gone from removing reagents 100% of the time, to removing reagents only when methods is truthy and thus they get added to r_to_send. methods is not always truthy. Infact, more often than not it's NULL.

As a result, common reagent transfer methods just broke, duplicating reagents.

Sometimes this has interesting consequences, like in reagent reactions: https://tgstation13.org/parsed-logs/terry/data/logs/2022/08/26/round-189263/game.txt

image

This is what my search bar looked like highlighting the 1000+ explosions.
image

This adds a unit test to make sure reagent transfer actually works, then fixes the bug by caching reagents to be removed and removing them in a batch later on.
Why It's Good For The Game

Infinitely looping explosions tend to be loud and obnoxious. This kills the player. This also kills the server.
Unit tests are cool because my test is an absolute unit and I'm in awe at the size of that lad.
Changelog

cl
fix: Fixes reagent transfer not properly emptying the source of reagents when transferring to a target.
/cl
2022-08-28 00:22:36 +12:00

2.0 KiB