Skip to content

Commit

Permalink
refactor: Body Zones And Internal Organs Refactor (ss220-space#3960)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gottfrei authored Dec 5, 2023
1 parent 54f02e1 commit 71b723a
Show file tree
Hide file tree
Showing 300 changed files with 4,509 additions and 3,791 deletions.
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/pipes/simple/pipe_simple_he.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
if(pipe_air.temperature > heat_limit + 1)
for(var/m in buckled_mobs)
var/mob/living/buckled_mob = m
buckled_mob.apply_damage(4 * log(pipe_air.temperature - heat_limit), BURN, "chest")
buckled_mob.apply_damage(4 * log(pipe_air.temperature - heat_limit), BURN, BODY_ZONE_CHEST)


/obj/machinery/atmospherics/pipe/simple/heat_exchanging/New()
Expand Down
3 changes: 2 additions & 1 deletion code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
#define EMBEDDED_UNSAFE_REMOVAL_PAIN_MULTIPLIER 8 //Coefficient of multiplication for the damage the item does when removed without a surgery (this*item.w_class)
#define EMBEDDED_UNSAFE_REMOVAL_TIME 30 //A Time in ticks, total removal time = (this*item.w_class)

// Body Parts
// Body Part Zones
#define BODY_ZONE_HEAD "head"
#define BODY_ZONE_CHEST "chest"
#define BODY_ZONE_L_ARM "l_arm"
Expand All @@ -114,6 +114,7 @@
#define BODY_ZONE_PRECISE_L_FOOT "l_foot"
#define BODY_ZONE_PRECISE_R_FOOT "r_foot"


//We will round to this value in damage calculations.
#define DAMAGE_PRECISION 0.1

Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@

///from base of mob/key_down(): (_key, client/user)
#define COMSIG_MOB_KEY_DROP_ITEM_DOWN "mob_key_drop_item_down"
#define COMPONENT_CANCEL_DROP (1<<0)

///from base of obj/allowed(mob/M): (/obj) returns bool, if TRUE the mob has id access to the obj
#define COMSIG_MOB_ALLOWED "mob_allowed"
Expand Down
14 changes: 8 additions & 6 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
///////////////////ORGAN DEFINES///////////////////

// Organ defines.
#define ORGAN_BROKEN 1
#define ORGAN_ROBOT 2
#define ORGAN_SPLINTED 4
#define ORGAN_DEAD 8
#define ORGAN_MUTATED 16
#define ORGAN_BROKEN 1
#define ORGAN_ROBOT 2
#define ORGAN_SPLINTED 4
#define ORGAN_DEAD 8
#define ORGAN_MUTATED 16
#define ORGAN_INT_BLEED 32

#define PROCESS_ACCURACY 10

Expand Down Expand Up @@ -271,7 +272,8 @@

#define isnewplayer(A) (istype((A), /mob/new_player))

#define isorgan(A) (istype((A), /obj/item/organ/external))
#define isexternalorgan(A) (istype((A), /obj/item/organ/external))

#define hasorgans(A) (ishuman(A))

#define is_admin(user) (check_rights(R_ADMIN, 0, (user)) != 0)
Expand Down
56 changes: 56 additions & 0 deletions code/__DEFINES/organ_defines.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Internal organs

#define INTERNAL_ORGAN_HEART "heart"
#define INTERNAL_ORGAN_LUNGS "lungs"
#define INTERNAL_ORGAN_LIVER "liver"
#define INTERNAL_ORGAN_KIDNEYS "kidneys"
#define INTERNAL_ORGAN_APPENDIX "appendix"
#define INTERNAL_ORGAN_EYES "eyes"
#define INTERNAL_ORGAN_EARS "ears"
#define INTERNAL_ORGAN_BRAIN "brain"

#define INTERNAL_ORGAN_RESONANT_CRYSTAL "resonant_crystal"
#define INTERNAL_ORGAN_STRANGE_CRYSTAL "strange_crystal"
#define INTERNAL_ORGAN_WAX_GLANDS "wax_glands"
#define INTERNAL_ORGAN_HEADPOCKET "headpocket"
#define INTERNAL_ORGAN_LANTERN "lantern"
#define INTERNAL_ORGAN_RESONATOR "adamantine_resonator"

#define INTERNAL_ORGAN_PLASMAVESSEL "plasmavessel"
#define INTERNAL_ORGAN_ACIDGLAND "acidgland"
#define INTERNAL_ORGAN_HIVENODE "hivenode"
#define INTERNAL_ORGAN_NEUROTOXIN_GLAND "neurotoxin_gland"
#define INTERNAL_ORGAN_RESIN_SPINNER "resin_spinner"
#define INTERNAL_ORGAN_EGGSAC "eggsac"

#define INTERNAL_ORGAN_L_ARM_DEVICE "l_arm_device"
#define INTERNAL_ORGAN_R_ARM_DEVICE "r_arm_device"
#define INTERNAL_ORGAN_L_LEG_DEVICE "l_leg_device"
#define INTERNAL_ORGAN_R_LEG_DEVICE "r_leg_device"
#define INTERNAL_ORGAN_EYE_SIGHT_DEVICE "eye_sight"
#define INTERNAL_ORGAN_EYE_HUD_DEVICE "eye_hud"
#define INTERNAL_ORGAN_EYE_SHIELD_DEVICE "eye_shield"
#define INTERNAL_ORGAN_EYE_LING "eye_ling"
#define INTERNAL_ORGAN_BREATHING_TUBE "breathing_tube"
#define INTERNAL_ORGAN_STOMACH "stomach"
#define INTERNAL_ORGAN_HEART_DRIVE "heartdrive"
#define INTERNAL_ORGAN_BRAIN_ANTIDROP "brain_antidrop"
#define INTERNAL_ORGAN_BRAIN_ANTISTUN "brain_antistun"
#define INTERNAL_ORGAN_BRAIN_ANTISLEEP "brain_antisleep"
#define INTERNAL_ORGAN_BRAIN_CLOWNVOICE "brain_clownvoice"
#define INTERNAL_ORGAN_BRAIN_SPEECHTRANSLATOR "brain_speechtranslator"

#define INTERNAL_ORGAN_VOCALCORDS "vocal_cords"
#define INTERNAL_ORGAN_HIVECORE "hivecore"
#define INTERNAL_ORGAN_PARASITE_EGG "parasite_egg"

#define INTERNAL_ORGAN_HAIR "hair_organ" // yeah thats a thing
#define INTERNAL_ORGAN_HONK_BLADDER "honk_bladder"
#define INTERNAL_ORGAN_BRAIN_TUMOR "brain_tumor"


// insert/remove organ special defines
#define ORGAN_MANIPULATION_DEFAULT 0
#define ORGAN_MANIPULATION_NOEFFECT 1
#define ORGAN_MANIPULATION_ABDUCTOR 2

2 changes: 1 addition & 1 deletion code/__HELPERS/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
var/datum/robolimb/R = new limb_type()
GLOB.all_robolimbs[R.company] = R
if(!R.unavailable_at_chargen)
if(R != "head" && R != "chest" && R != "groin" ) //Part of the method that ensures only IPCs can access head, chest and groin prosthetics.
if(R != BODY_ZONE_HEAD && R != BODY_ZONE_CHEST && R != BODY_ZONE_PRECISE_GROIN ) //Part of the method that ensures only IPCs can access head, chest and groin prosthetics.
if(R.has_subtypes) //Ensures solos get added to the list as well be incorporating has_subtypes == 1 and has_subtypes == 2.
GLOB.chargen_robolimbs[R.company] = R //List only main brands and solo parts.
if(R.selectable)
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/pronouns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/**
* Replaces the `%(SINGLE,PLURAL)%` or `%(MALE,FEMALE,NEUTER,PLURAL)%` message piece accordingly to user gender.
* Use `*` to deliberatly skip one genderize word.
* Use `*` to deliberatly skip one genderize word: `%(*,FEMALE,*,PLURAL)%`.
*
* Arguments:
* * user - Person which pronouns will be used.
Expand Down
101 changes: 61 additions & 40 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -959,19 +959,40 @@ Returns 1 if the chain up to the area contains the given typepath


/proc/parse_zone(zone)
if(zone == "r_hand") return "right hand"
else if(zone == "l_hand") return "left hand"
else if(zone == "l_arm") return "left arm"
else if(zone == "r_arm") return "right arm"
else if(zone == "l_leg") return "left leg"
else if(zone == "r_leg") return "right leg"
else if(zone == "l_foot") return "left foot"
else if(zone == "r_foot") return "right foot"
else if(zone == "l_hand") return "left hand"
else if(zone == "r_hand") return "right hand"
else if(zone == "l_foot") return "left foot"
else if(zone == "r_foot") return "right foot"
else return zone
switch(zone)
if(BODY_ZONE_HEAD)
return "head"
if(BODY_ZONE_CHEST)
return "chest"
if(BODY_ZONE_L_ARM)
return "left arm"
if(BODY_ZONE_R_ARM)
return "right arm"
if(BODY_ZONE_L_LEG)
return "left leg"
if(BODY_ZONE_R_LEG)
return "right leg"
if(BODY_ZONE_TAIL)
return "tail"
if(BODY_ZONE_WING)
return "wings"
if(BODY_ZONE_PRECISE_EYES)
return "eyes"
if(BODY_ZONE_PRECISE_MOUTH)
return "mouth"
if(BODY_ZONE_PRECISE_GROIN)
return "groin"
if(BODY_ZONE_PRECISE_L_HAND)
return "left hand"
if(BODY_ZONE_PRECISE_R_HAND)
return "right hand"
if(BODY_ZONE_PRECISE_L_FOOT)
return "left foot"
if(BODY_ZONE_PRECISE_R_FOOT)
return "right foot"
else
stack_trace("Wrong zone input.")


/*
Expand Down Expand Up @@ -1216,47 +1237,47 @@ Standard way to write links -Sayu
// HIDEGLASSES(formerly known as HIDEEYES) flag was made, ironically, to check if it hides our GLASSES
// not to check if it makes using the fucking mouth/eyes impossible!!!
switch(location)
if("head")
if(BODY_ZONE_HEAD)
if(covered_locations & HEAD)
return 0
if("eyes")
return FALSE
if(BODY_ZONE_PRECISE_EYES)
if(eyesmouth_covered & MASKCOVERSEYES || eyesmouth_covered & GLASSESCOVERSEYES || eyesmouth_covered & HEADCOVERSEYES)
return 0
if("mouth")
return FALSE
if(BODY_ZONE_PRECISE_MOUTH)
if(eyesmouth_covered & HEADCOVERSMOUTH || eyesmouth_covered & MASKCOVERSMOUTH)
return 0
if("chest")
return FALSE
if(BODY_ZONE_CHEST)
if(covered_locations & UPPER_TORSO)
return 0
if("groin")
return FALSE
if(BODY_ZONE_PRECISE_GROIN)
if(covered_locations & LOWER_TORSO)
return 0
if("l_arm")
return FALSE
if(BODY_ZONE_L_ARM)
if(covered_locations & ARM_LEFT)
return 0
if("r_arm")
return FALSE
if(BODY_ZONE_R_ARM)
if(covered_locations & ARM_RIGHT)
return 0
if("l_leg")
return FALSE
if(BODY_ZONE_L_LEG)
if(covered_locations & LEG_LEFT)
return 0
if("r_leg")
return FALSE
if(BODY_ZONE_R_LEG)
if(covered_locations & LEG_RIGHT)
return 0
if("l_hand")
return FALSE
if(BODY_ZONE_PRECISE_L_HAND)
if(covered_locations & HAND_LEFT)
return 0
if("r_hand")
return FALSE
if(BODY_ZONE_PRECISE_R_HAND)
if(covered_locations & HAND_RIGHT)
return 0
if("l_foot")
return FALSE
if(BODY_ZONE_PRECISE_L_FOOT)
if(covered_locations & FOOT_LEFT)
return 0
if("r_foot")
return FALSE
if(BODY_ZONE_PRECISE_R_FOOT)
if(covered_locations & FOOT_RIGHT)
return 0
return FALSE

return 1
return TRUE

/proc/check_target_facings(mob/living/initator, mob/living/target)
/*This can be used to add additional effects on interactions between mobs depending on how the mobs are facing each other, such as adding a crit damage to blows to the back of a guy's head.
Expand Down
40 changes: 20 additions & 20 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
name = "damage zone"
icon_state = "zone_sel"
screen_loc = ui_zonesel
var/selecting = "chest"
var/selecting = BODY_ZONE_CHEST
var/static/list/hover_overlays_cache = list()
var/hovering

Expand Down Expand Up @@ -302,54 +302,54 @@
if(1 to 3) //Feet
switch(icon_x)
if(10 to 15)
return "r_foot"
return BODY_ZONE_PRECISE_R_FOOT
if(17 to 22)
return "l_foot"
return BODY_ZONE_PRECISE_L_FOOT
if(4 to 9) //Legs
switch(icon_x)
if(10 to 15)
return "r_leg"
return BODY_ZONE_R_LEG
if(17 to 22)
return "l_leg"
return BODY_ZONE_L_LEG
if(24 to 29)
return "tail"
return BODY_ZONE_TAIL
if(10 to 13) //Hands,groin and wings
switch(icon_x)
if(8 to 11)
return "r_hand"
return BODY_ZONE_PRECISE_R_HAND
if(12 to 20)
return "groin"
return BODY_ZONE_PRECISE_GROIN
if(21 to 24)
return "l_hand"
return BODY_ZONE_PRECISE_L_HAND
if(3 to 7)
return "wing"
return BODY_ZONE_WING
if(25 to 28)
return "wing"
return BODY_ZONE_WING
if(14 to 22) //Chest and arms to shoulders and wings
switch(icon_x)
if (3 to 7)
return "wing"
return BODY_ZONE_WING
if(8 to 11)
return "r_arm"
return BODY_ZONE_R_ARM
if(12 to 20)
return "chest"
return BODY_ZONE_CHEST
if(21 to 24)
return "l_arm"
return BODY_ZONE_L_ARM
if(24 to 28)
return "wing"
return BODY_ZONE_WING
if(23 to 30) //Head, but we need to check for eye or mouth
if(icon_x in 12 to 20)
switch(icon_y)
if(23 to 24)
if(icon_x in 15 to 17)
return "mouth"
return BODY_ZONE_PRECISE_MOUTH
if(26) //Eyeline, eyes are on 15 and 17
if(icon_x in 14 to 18)
return "eyes"
return BODY_ZONE_PRECISE_EYES
if(25 to 27)
if(icon_x in 15 to 17)
return "eyes"
return "head"
return BODY_ZONE_PRECISE_EYES
return BODY_ZONE_HEAD

/obj/screen/zone_sel/proc/set_selected_zone(choice, mob/user)
if(isobserver(user))
Expand Down
8 changes: 4 additions & 4 deletions code/_onclick/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@

A.attack_hand(src)


/mob/living/carbon/human/beforeAdjacentClick(atom/A, params)
if(prob(dna.species.fragile_bones_chance * 3))
var/zone = "[hand ? "l" : "r"]_[pick("hand", "arm")]"
var/obj/item/organ/external/active_hand = get_organ(zone)
if(!(active_hand.status & ORGAN_BROKEN))
if(!active_hand.has_fracture())
var/used_item_name = get_active_hand()
var/message = "[used_item_name? "You try to use [used_item_name], but y": "Y"]our [active_hand] don't withstand the load!"
to_chat(src, "<span class='danger'>[message]</span>")
to_chat(src, span_danger("[used_item_name? "You try to use [used_item_name], but y": "Y"]our [active_hand] don't withstand the load!"))
active_hand.fracture()
return


/atom/proc/attack_hand(mob/user)
SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_HAND, user)
Expand Down
Loading

0 comments on commit 71b723a

Please sign in to comment.