From e2c5763ce0e28461bf9468cdc4fbce1ae00df3bd Mon Sep 17 00:00:00 2001 From: ArchPigeon Date: Mon, 9 Aug 2021 11:40:03 -0400 Subject: [PATCH] =?UTF-8?q?swap=20bodypart=20species=20checking=20to=20bit?= =?UTF-8?q?map,=20fix=20surgery=20for=20monkey=20body=E2=80=A6=20(#60280)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * swap bodypart species checking to bitmap, fix surgery for monkey bodyparts on monkeys * fix part_origin so it is used correctly * remove tabs, change DEFAULT_BODY to NULL_BODY * add requested documentation Co-authored-by: whitecas18 --- code/__DEFINES/mobs.dm | 8 ++++++++ code/modules/mob/living/carbon/human/species.dm | 7 +++++++ .../mob/living/carbon/human/species_types/monkeys.dm | 2 ++ code/modules/surgery/bodyparts/_bodyparts.dm | 2 ++ code/modules/surgery/bodyparts/parts.dm | 12 ++++++++++++ code/modules/surgery/prosthetic_replacement.dm | 8 ++------ 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index d67a85726a7..616d03f543d 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -60,9 +60,17 @@ #define DEFAULT_BODYPART_ICON_ORGANIC 'icons/mob/human_parts_greyscale.dmi' #define DEFAULT_BODYPART_ICON_ROBOTIC 'icons/mob/augmentation/augments.dmi' + #define MONKEY_BODYPART "monkey" #define ALIEN_BODYPART "alien" #define LARVA_BODYPART "larva" + + +///Body type bitfields for allowed_animal_origin used to check compatible surgery body types (use NONE for no matching body type) +#define HUMAN_BODY (1 << 0) +#define MONKEY_BODY (1 << 1) +#define ALIEN_BODY (1 << 2) +#define LARVA_BODY (1 << 3) /*see __DEFINES/inventory.dm for bodypart bitflag defines*/ // Health/damage defines diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index df455ce0edc..da4e421419f 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -141,6 +141,11 @@ GLOBAL_LIST_EMPTY(roundstart_races) /// The body temperature limit the body can take before it starts taking damage from cold. var/bodytemp_cold_damage_limit = BODYTEMP_COLD_DAMAGE_LIMIT + ///the species that body parts are surgically compatible with (found in _DEFINES/mobs.dm) + ///current acceptable bitfields are HUMAN_BODY, ALIEN_BODY, LARVA_BODY, MONKEY_BODY, or NONE + var/allowed_animal_origin = HUMAN_BODY + + ///Species-only traits. Can be found in [code/__DEFINES/DNA.dm] var/list/species_traits = list() ///Generic traits tied to having the species. @@ -207,6 +212,8 @@ GLOBAL_LIST_EMPTY(roundstart_races) ///List of visual overlays created by handle_body() var/list/body_vis_overlays = list() + + /////////// // PROCS // /////////// diff --git a/code/modules/mob/living/carbon/human/species_types/monkeys.dm b/code/modules/mob/living/carbon/human/species_types/monkeys.dm index f8d9a3f1e9d..9c1aa539833 100644 --- a/code/modules/mob/living/carbon/human/species_types/monkeys.dm +++ b/code/modules/mob/living/carbon/human/species_types/monkeys.dm @@ -10,6 +10,7 @@ mutant_bodyparts = list("tail_monkey" = "Monkey") skinned_type = /obj/item/stack/sheet/animalhide/monkey meat = /obj/item/food/meat/slab/monkey + allowed_animal_origin = MONKEY_BODY knife_butcher_results = list(/obj/item/food/meat/slab/monkey = 5, /obj/item/stack/sheet/animalhide/monkey = 1) species_traits = list(HAS_FLESH,HAS_BONE,NO_UNDERWEAR,LIPS,NOEYESPRITES,NOBLOODOVERLAY,NOTRANSSTING, NOAUGMENTS) inherent_traits = list( @@ -43,6 +44,7 @@ payday_modifier = 1.5 + /datum/species/monkey/random_name(gender,unique,lastname) var/randname = "monkey ([rand(1,999)])" diff --git a/code/modules/surgery/bodyparts/_bodyparts.dm b/code/modules/surgery/bodyparts/_bodyparts.dm index 93a55cc9063..6e799c267c3 100644 --- a/code/modules/surgery/bodyparts/_bodyparts.dm +++ b/code/modules/surgery/bodyparts/_bodyparts.dm @@ -62,6 +62,8 @@ ///for nonhuman bodypart (e.g. monkey) var/animal_origin + //for all bodyparts + var/part_origin = HUMAN_BODY ///whether it can be dismembered with a weapon. var/dismemberable = 1 diff --git a/code/modules/surgery/bodyparts/parts.dm b/code/modules/surgery/bodyparts/parts.dm index ebe8d64dd26..f113f7efa4f 100644 --- a/code/modules/surgery/bodyparts/parts.dm +++ b/code/modules/surgery/bodyparts/parts.dm @@ -33,6 +33,7 @@ icon = 'icons/mob/animal_parts.dmi' icon_state = "default_monkey_chest" animal_origin = MONKEY_BODYPART + part_origin = MONKEY_BODY wound_resistance = -10 /obj/item/bodypart/chest/alien @@ -41,6 +42,7 @@ dismemberable = 0 max_damage = 500 animal_origin = ALIEN_BODYPART + part_origin = ALIEN_BODY /obj/item/bodypart/chest/larva icon = 'icons/mob/animal_parts.dmi' @@ -48,6 +50,7 @@ dismemberable = 0 max_damage = 50 animal_origin = LARVA_BODYPART + part_origin = LARVA_BODY /obj/item/bodypart/l_arm name = "left arm" @@ -132,6 +135,7 @@ icon = 'icons/mob/animal_parts.dmi' icon_state = "default_monkey_l_arm" animal_origin = MONKEY_BODYPART + part_origin = MONKEY_BODY wound_resistance = -10 px_x = -5 px_y = -3 @@ -145,6 +149,7 @@ can_be_disabled = FALSE max_damage = 100 animal_origin = ALIEN_BODYPART + part_origin = ALIEN_BODY /obj/item/bodypart/r_arm name = "right arm" @@ -227,6 +232,7 @@ icon = 'icons/mob/animal_parts.dmi' icon_state = "default_monkey_r_arm" animal_origin = MONKEY_BODYPART + part_origin = MONKEY_BODY wound_resistance = -10 px_x = 5 px_y = -3 @@ -240,6 +246,8 @@ can_be_disabled = FALSE max_damage = 100 animal_origin = ALIEN_BODYPART + part_origin = ALIEN_BODY + /obj/item/bodypart/l_leg name = "left leg" @@ -317,6 +325,7 @@ icon = 'icons/mob/animal_parts.dmi' icon_state = "default_monkey_l_leg" animal_origin = MONKEY_BODYPART + part_origin = MONKEY_BODY wound_resistance = -10 px_y = 4 @@ -329,6 +338,7 @@ can_be_disabled = FALSE max_damage = 100 animal_origin = ALIEN_BODYPART + part_origin = ALIEN_BODY /obj/item/bodypart/r_leg name = "right leg" @@ -408,6 +418,7 @@ icon = 'icons/mob/animal_parts.dmi' icon_state = "default_monkey_r_leg" animal_origin = MONKEY_BODYPART + part_origin = MONKEY_BODY wound_resistance = -10 px_y = 4 @@ -420,3 +431,4 @@ can_be_disabled = FALSE max_damage = 100 animal_origin = ALIEN_BODYPART + part_origin = ALIEN_BODY diff --git a/code/modules/surgery/prosthetic_replacement.dm b/code/modules/surgery/prosthetic_replacement.dm index 8232e34ebe1..2caff80da6a 100644 --- a/code/modules/surgery/prosthetic_replacement.dm +++ b/code/modules/surgery/prosthetic_replacement.dm @@ -42,17 +42,13 @@ tool = organ_storage_contents if(istype(tool, /obj/item/bodypart)) var/obj/item/bodypart/bodypart_to_attach = tool - if(ismonkey(target))// monkey patient only accept organic monkey limbs - if(bodypart_to_attach.status == BODYPART_ROBOTIC || bodypart_to_attach.animal_origin != MONKEY_BODYPART) - to_chat(user, span_warning("[bodypart_to_attach] doesn't match the patient's morphology.")) - return -1 if(bodypart_to_attach.status != BODYPART_ROBOTIC) organ_rejection_dam = 10 if(ishuman(target)) - if(bodypart_to_attach.animal_origin) + var/mob/living/carbon/human/human_target = target + if(!(bodypart_to_attach.part_origin & human_target.dna.species.allowed_animal_origin)) to_chat(user, span_warning("[bodypart_to_attach] doesn't match the patient's morphology.")) return -1 - var/mob/living/carbon/human/human_target = target if(human_target.dna.species.id != bodypart_to_attach.species_id) organ_rejection_dam = 30