Files
Bubberstation/code/modules/surgery/organs/helpers.dm
Zephyr ecbcef778d Refactors Regenerate Organs, and a few organ helpers (#74219)
## About The Pull Request

Refactors regenerate organs to be slightly more intelligent in handling
organ changes and replacements.
Noteably:
- We don't remove organs that were modified by the owner; such as
changing out your heart for a cybernetic
- We early break out of the for loop if they aren't supposed to have an
organ there and remove it
- We check for the organ already being correct, and just healing it and
continuing if it is

Also changes the names of some of the organ helpers into snake_case
### Mapping March
Ckey to receive rewards: N/A

## Why It's Good For The Game
## Changelog

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
2023-03-26 17:54:36 +01:00

45 lines
1.1 KiB
Plaintext

/**
* Get the organ object from the mob matching the passed in typepath
*
* Arguments:
* * typepath The typepath of the organ to get
*/
/mob/proc/get_organ_by_type(typepath)
return
/**
* Get organ objects by zone
*
* This will return a list of all the organs that are relevant to the zone that is passedin
*
* Arguments:
* * zone [a BODY_ZONE_X define](https://github.com/tgstation/tgstation/blob/master/code/__DEFINES/combat.dm#L187-L200)
*/
/mob/proc/get_organs_for_zone(zone)
return
/**
* Returns a list of all organs in specified slot
*
* Arguments:
* * slot Slot to get the organs from
*/
/mob/proc/get_organ_slot(slot)
return
/mob/living/carbon/get_organ_by_type(typepath)
return (locate(typepath) in organs)
/mob/living/carbon/get_organs_for_zone(zone, include_children = FALSE)
var/valid_organs = list()
for(var/obj/item/organ/organ as anything in organs)
if(zone == organ.zone)
valid_organs += organ
else if(include_children && zone == deprecise_zone(organ.zone))
valid_organs += organ
return valid_organs
/mob/living/carbon/get_organ_slot(slot)
. = organs_slot[slot]