Skip to content

Commit

Permalink
[MIRROR] Fix organs being replaced when not needed (#1074)
Browse files Browse the repository at this point in the history
* Fix organs being replaced when not needed (#81575)

## About The Pull Request

So it seems `regenerate_organs` on species was actually replacing organs
not belonging to the species regardless, which was making it so the
`HEAL_ORGANS` flag which is supposed to heal your organs and supposedly
replace missing ones too.
However, this made it so anything using that would also remove and
replace all organs not native to your species, including prosthetic
organs, cybernetic organs, organs alien to your species, and the
nightmare heart itself when you're not a nightmare and it tries to
revive and convert you.

This just makes it mimic its behaviour when used to convert from one
species to another, which is to not replace organs alien to your
previous species, and making it also not replace those when
`replace_current = FALSE`.
## Why It's Good For The Game

Fixes #81546.
Fixes ethereal reviving eating your prosthetics.
## Changelog
:cl:
fix: Ethereal heart revive doesn't delete organs alien to your species,
like prosthetics, cybernetics, and possibly itself.
fix: Nightmare heart revive doesn't delete organs alien to your species,
like itself, upon which it would stop the conversion to shadowperson.
/:cl:

* Fix organs being replaced when not needed

---------

Co-authored-by: _0Steven <[email protected]>
  • Loading branch information
2 people authored and StealsThePRs committed Feb 20, 2024
1 parent dd57037 commit dce51fd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions code/modules/mob/living/carbon/human/_species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,12 @@ GLOBAL_LIST_EMPTY(features_by_species)
qdel(existing_organ)
continue

if(!isnull(old_species) && !isnull(existing_organ))
if(existing_organ.type != old_species.get_mutant_organ_type_for_slot(slot))
continue // we don't want to remove organs that are not the default for this species
// we don't want to remove organs that are not the default for this species
if(!isnull(existing_organ))
if(!isnull(old_species) && existing_organ.type != old_species.get_mutant_organ_type_for_slot(slot))
continue
else if(!replace_current && existing_organ.type != get_mutant_organ_type_for_slot(slot))
continue

// at this point we already know new_organ is not null
if(existing_organ?.type == new_organ)
Expand Down

0 comments on commit dce51fd

Please sign in to comment.