Files
Bubberstation/code/modules/plumbing
SyncIt21 7a100e498a Plumbing chemical chamber UI and operation improvements (#78619)
## About The Pull Request
1. Fixes #58119

The word "Fixes" actually means the reaction chamber does it's job but
"**does not guarantee**" the ph & temperature of the final solution is
exactly within the ranges you specify especially for instantaneous
reactions. There were 2 problems with the reaction chamber.

a) **The ph chemistry of the reaction chamber was completely flipped
upside down.**
      Let's look at the code

cfe1301520/code/modules/plumbing/plumbers/reaction_chamber.dm (L152-L155)

This was adding basic buffer when the solution was getting to basic &
acid buffer when the solution was getting too acidic

      The correct mode of operation is as follows
- If the ph is getting way too **acidic** i.e. it's ph **decreases** and
becomes **lower** than the acidic limit then we need to add some **base
buffer** so as to **increase** it's value and bring it back **above**
the acidic limit
- If the ph is getting way to **basic** i.e. it's ph **increases** and
becomes **higher** than the alkaline limit then we need to add some
**acidic buffer** so as to **decrease** it's value and bring it back
**below** the alkaline limit

    b) **The reaction chamber did it's work only half of the time**
   Looking at the code

cfe1301520/code/modules/plumbing/plumbers/reaction_chamber.dm (L152)

The reaction chamber would only balance the ph of the solution **ONLY**
when an reaction was taking place i.e. only when `reagents.is_reacting`
is true. It would not attempt to balance the ph of the reagents as and
when they were coming in i.e when `emptying` is FALSE. This means if an
reaction took only like 0.5 to 1 second to occur the ph would be
balanced only during that very short interval of time and so it would
not make much of difference.

So the 2 problems were the chamber was doing its job wrong and would do
it only half the time. Again re-emphasizing even with these patches the
chamber "**does not guarantee**" the final solution ph will be within
those ranges. This is because the nature of reactions is unpredictable.
Some reactions can take place so fast and have huge drastic ph changes
that the reaction chamber would be ineffective regardless of how much
base/acid it used to balance the reaction. The only thing is that it
does it's job correctly and too the best of its ability with no
guarentees.

3. The plumbing mixing chamber(parent type of the plumbing chemical
reaction chamber) which you make via research plumbing RCD, UI now also
uses an TGUI input list to accept chemicals so no more manual typing.

4. Both these types have their UI files converted Typescript cause why
not

## Changelog
🆑
fix: plumbing reaction chamber now balances the ph of it's solution
correctly to the best of it's ability so no guarantees
code: converted plumbing reaction chamber & mixing chamber UI files to
Typescript
refactor: plumbing mixing chamber now also accepts an TGUI input list to
input it's chemicals
/🆑

---------

Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
2023-10-05 21:47:39 +02:00
..