swap bodypart species checking to bitmap, fix surgery for monkey body… (#60280)

* 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 <whitecas18@students.ecu.edu>
This commit is contained in:
ArchPigeon
2021-08-09 11:40:03 -04:00
committed by GitHub
co-authored by whitecas18
parent 54a1257f4e
commit e2c5763ce0
6 changed files with 33 additions and 6 deletions
+8
View File
@@ -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
@@ -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 //
///////////
@@ -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)])"
@@ -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
+12
View File
@@ -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
@@ -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