Files
Bubberstation/code/datums/elements
SkyratBot 8fcac218c1 [MIRROR] Fix: DNA Infuser & Infusions [MDB IGNORE] (#18748)
* Fix: DNA Infuser & Infusions

* Fixes the damn conflict

* Fix: DNA Infuser Organ Filtering (#72745)

## About The Pull Request

My PR #72688 was merged mid-review. This is a followup PR to fix the
buggy code which was introduced by myself in between testing a naive
approach to organ filtering. The code does not work due to my own
oversight, as I was attempting to test buggy code in
`/obj/machinery/dna_infuser/proc/infuse_organ` when the prior PR was
merged.

I took this chance to simplify the code more, and I added an additional
proc to the DNA Infuser to replace inline code, `pick_organ`. The proc
picks a random mutated organ from the infuser entry which is also
compatible with the target mob. If none of the organs are compatible,
then the infusion still pricks you with needles but nearly-silently
fails by omitting the "You feel yourself becoming..." chat message.

`pick_organ` tries to return a valid mutant organ if all of the
following criteria are true:
1. Target must have a pre-existing organ in the same organ slot as the
new organ;
   - Or, the new organ must be external.
2. Target's pre-existing organ must be organic / not robotic.
3. Target must not have the same/identical organ.

## Why It's Good For The Game

The DNA Infuser should filter organs depending on whether or not the
occupant has one already, if it is organic, and if it doesn't exist the
occupant can still get an external organ (such as a cat tail). This PR
introduces algorithmically correct code to filter the organs, and fixes
bugs introduced by my prior PR which caused the proc to throw a runtime.

## Changelog

🆑 A.C.M.O.
fix: Fixed buggy organ filtering code in the DNA Infuser which stopped
it from infusing organs.
/🆑

Co-authored-by: Dani Glore <fantasticdragons@gmail.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
2023-01-23 17:18:50 -05:00
..
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00
2022-11-15 06:59:06 +00:00