Bodypart code cleanup, robotic limbs can actually be disabled through damage again. (#71739)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

Cleans up various variables and code comments in bodypart code so that
it is easier to understand (hopefully) what the fuck is happening there.

Fixes a hilarious oversight. For what may have been an entire 2 year
span, robotic limbs were unable to be disabled whatsoever. Good stuff.

## Why It's Good For The Game

Lost all your limbs and now have only surplus prosthetics?
Congratulations! You're now more durable than even someone with proper
robotic limbs, as your arms do not contribute anything more than 10
damage (or 15 stamina) to your overall damage taken. Furthermore, taking
the maximum amount of damage is actually entirely meaningless to you.

Laugh as someone attempting to shoot your arms does almost no meaningful
damage once you hit the cap! It's all sunk cost! You can't have it blown
off anyway, because dismembering surplus limbs is gone!

Who knew getting into a horrible bluespace/goliath accident could have
such an impact on your combat prowess. Thanks Nanotrasen!

Anyway, these vars are ugly.

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

🆑
code: Makes a lot of the bodypart variables clearer as to what they do.
Includes more detailed code comments.
fix: Robotic limbs are no longer immune to being disabled through
reaching maximum damage.
/🆑

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
This commit is contained in:
necromanceranne
2022-12-11 12:31:09 +00:00
committed by GitHub
parent acf97f1a68
commit a3e7c70f6d
4 changed files with 32 additions and 18 deletions
+22 -13
View File
@@ -55,27 +55,35 @@
/// For limbs that don't really exist, eg chainsaws
var/is_pseudopart = FALSE
///If disabled, limb is as good as missing.
// Limb disabling variables
///Controls if the limb is disabled. TRUE means it is disabled (similar to being removed, but still present for the sake of targeted interactions).
var/bodypart_disabled = FALSE
///Multiplied by max_damage it returns the threshold which defines a limb being disabled or not. From 0 to 1. 0 means no disable thru damage
var/disable_threshold = 0
///Controls whether bodypart_disabled makes sense or not for this limb.
var/can_be_disabled = FALSE
///Multiplier of the limb's damage that gets applied to the mob
///Handles limb disabling by damage. If 0 (0%), a limb can't be disabled via damage. If 1 (100%), it is disabled at max limb damage. Anything between is the percentage of damage against maximum limb damage needed to disable the limb.
var/disabling_threshold_percentage = 0
///Whether it is possible for the limb to be disabled whatsoever. TRUE means that it is possible.
var/can_be_disabled = FALSE //Defaults to FALSE, as only human limbs can be disabled, and only the appendages.
// Damage state variables
///A mutiplication of the burn and brute damage that the limb's stored damage contributes to its attached mob's overall wellbeing.
var/body_damage_coeff = 1
///Used in determining overlays for limb damage states. As the mob receives more burn/brute damage, their limbs update to reflect.
var/brutestate = 0
var/burnstate = 0
///The current amount of brute damage the limb has
var/brute_dam = 0
///The current amount of burn damage the limb has
var/burn_dam = 0
///The maximum "physical" damage a bodypart can take. Set by children
///The maximum brute OR burn damage a bodypart can take. Once we hit this cap, no more damage of either type!
var/max_damage = 0
///Gradually increases while burning when at full damage, destroys the limb when at 100
var/cremation_progress = 0
///Subtracted to brute damage taken
// Damage reduction variables for damage handled on the limb level. Handled after worn armor.
///Amount subtracted from brute damage inflicted on the limb.
var/brute_reduction = 0
///Subtracted to burn damage taken
///Amount subtracted from burn damage inflicted on the limb.
var/burn_reduction = 0
//Coloring and proper item icon update
@@ -86,8 +94,8 @@
///An "override" color that can be applied to ANY limb, greyscale or not.
var/variable_color = ""
///whether it can be dismembered with a weapon.
var/dismemberable = 1
///whether the limb can be mutilated, including dismemberment for appendages and heads, and disembowelment for chests. TRUE means it can be subjected to these effects.
var/dismemberable = TRUE
var/px_x = 0
var/px_y = 0
@@ -112,6 +120,7 @@
var/brute_damage_desc = DEFAULT_BRUTE_EXAMINE_TEXT
var/burn_damage_desc = DEFAULT_BURN_EXAMINE_TEXT
// Wounds related variables
/// The wounds currently afflicting this body part
var/list/wounds
@@ -545,7 +554,7 @@
var/total_damage = brute_dam + burn_dam
// this block of checks is for limbs that can be disabled, but not through pure damage (AKA limbs that suffer wounds, human/monkey parts and such)
if(!disable_threshold)
if(!disabling_threshold_percentage)
if(total_damage < max_damage)
last_maxed = FALSE
else
@@ -556,7 +565,7 @@
return
// we're now dealing solely with limbs that can be disabled through pure damage, AKA robot parts
if(total_damage >= max_damage * disable_threshold)
if(total_damage >= max_damage * disabling_threshold_percentage)
if(!last_maxed)
if(owner.stat < UNCONSCIOUS)
INVOKE_ASYNC(owner, TYPE_PROC_REF(/mob, emote), "scream")
+2 -2
View File
@@ -335,7 +335,7 @@
should_draw_greyscale = FALSE
px_x = 0
px_y = 0
dismemberable = 0
dismemberable = FALSE
max_damage = 500
bodytype = BODYTYPE_HUMANOID | BODYTYPE_ALIEN | BODYTYPE_ORGANIC
@@ -348,6 +348,6 @@
should_draw_greyscale = FALSE
px_x = 0
px_y = 0
dismemberable = 0
dismemberable = FALSE
max_damage = 50
bodytype = BODYTYPE_LARVA_PLACEHOLDER | BODYTYPE_ORGANIC
+2 -2
View File
@@ -53,7 +53,7 @@
bodytype = BODYTYPE_HUMANOID | BODYTYPE_ALIEN | BODYTYPE_ORGANIC
is_dimorphic = FALSE
should_draw_greyscale = FALSE
dismemberable = 0
dismemberable = FALSE
max_damage = 500
acceptable_bodytype = BODYTYPE_HUMANOID
@@ -64,7 +64,7 @@
limb_id = BODYPART_ID_LARVA
is_dimorphic = FALSE
should_draw_greyscale = FALSE
dismemberable = 0
dismemberable = FALSE
max_damage = 50
bodytype = BODYTYPE_LARVA_PLACEHOLDER | BODYTYPE_ORGANIC
acceptable_bodytype = BODYTYPE_LARVA_PLACEHOLDER
@@ -39,6 +39,7 @@
brute_damage_desc = ROBOTIC_BRUTE_EXAMINE_TEXT
burn_damage_desc = ROBOTIC_BURN_EXAMINE_TEXT
disabling_threshold_percentage = 1
/obj/item/bodypart/arm/right/robot
name = "cyborg right arm"
@@ -58,6 +59,7 @@
brute_reduction = 5
burn_reduction = 4
disabling_threshold_percentage = 1
light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
@@ -67,6 +69,7 @@
medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG
/obj/item/bodypart/leg/left/robot
name = "cyborg left leg"
desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
@@ -85,6 +88,7 @@
brute_reduction = 5
burn_reduction = 4
disabling_threshold_percentage = 1
light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
@@ -94,6 +98,7 @@
medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG
/obj/item/bodypart/leg/right/robot
name = "cyborg right leg"
desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
@@ -112,6 +117,7 @@
brute_reduction = 5
burn_reduction = 4
disabling_threshold_percentage = 1
light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
@@ -371,7 +377,6 @@
burn_reduction = 0
max_damage = 20
#undef ROBOTIC_LIGHT_BRUTE_MSG
#undef ROBOTIC_MEDIUM_BRUTE_MSG
#undef ROBOTIC_HEAVY_BRUTE_MSG