byond - Modules - TypesVar Details - Proc Details

limb

Vars

body_sizebody size of the owner, used for limb appearance, set in [/obj/limb/proc/update_limb()]
body_typebody muscularity of the owner, used for limb appearance, set in [/obj/limb/proc/update_limb()]
cavityName of internal cavity.
encasedName of bones encasing the limb.
hiddenSurgically implanted item.
implantsEmbedded or implanter implanted items.
limb_genderdefines which sprite the limb should use if dimorphic, set in [/obj/limb/proc/update_limb()]
skin_colorskin color of the owner, used for limb appearance, set in [/obj/limb/proc/update_limb()]
speciesspecies of the owner, used for limb appearance, set in [/obj/limb/proc/update_limb()]

Procs

add_bleedingAdds bleeding to the limb. Damage_amount lets you apply an amount worth of bleeding, otherwise it uses the given wound's damage.
bandagebandages brute wounds and removes bleeding. Returns WOUNDS_BANDAGED if at least one wound was bandaged. Returns WOUNDS_ALREADY_TREATED if a relevant wound exists but none were treated. Skips wounds that are already bandaged. treat_sutured var tells it to apply to sutured but unbandaged wounds, for trauma kits that heal damage directly.
get_active_limb_surgeriesReturns a description of active surgeries.
get_damageReturns total damage, or, if broken, the minimum fracture threshold, whichever is higher.
get_incision_depthReturns a description of opened incisions.
get_limb_icongenerates a list of overlays that should be applied to the owner
get_limb_icon_keygenerates a key for the purpose of caching the icon to avoid duplicate generations
is_bandagedChecks for bandageable wounds (type = CUT or type = BRUISE). Returns TRUE if all are bandaged, FALSE if not.
is_salvedChecks for salveable wounds (type = BURN). Returns TRUE if all are salved, FALSE if not.
limb_delimbSpecial delimbs for different limbs
remove_wound_bleedingChecks if there's any external limb wounds, removes bleeding if there isn't.
reset_limb_surgeriescalled when limb is removed or robotized, any ongoing surgery and related vars are reset unless set otherwise.
salvesalves burn wounds. Returns WOUNDS_BANDAGED if at least one wound was salved. Returns WOUNDS_ALREADY_TREATED if a relevant wound exists but none were treated. Skips wounds that are already salved. treat_grafted var tells it to apply to grafted but unsalved wounds, for burn kits that heal damage directly.
take_damageDescribes how limbs (body parts) of human mobs get damage applied.
update_limbupdates the various internal variables of the limb from the owner

Var Details

body_size

body size of the owner, used for limb appearance, set in [/obj/limb/proc/update_limb()]

body_type

body muscularity of the owner, used for limb appearance, set in [/obj/limb/proc/update_limb()]

cavity

Name of internal cavity.

encased

Name of bones encasing the limb.

hidden

Surgically implanted item.

implants

Embedded or implanter implanted items.

limb_gender

defines which sprite the limb should use if dimorphic, set in [/obj/limb/proc/update_limb()]

skin_color

skin color of the owner, used for limb appearance, set in [/obj/limb/proc/update_limb()]

species

species of the owner, used for limb appearance, set in [/obj/limb/proc/update_limb()]

Proc Details

add_bleeding

Adds bleeding to the limb. Damage_amount lets you apply an amount worth of bleeding, otherwise it uses the given wound's damage.

bandage

bandages brute wounds and removes bleeding. Returns WOUNDS_BANDAGED if at least one wound was bandaged. Returns WOUNDS_ALREADY_TREATED if a relevant wound exists but none were treated. Skips wounds that are already bandaged. treat_sutured var tells it to apply to sutured but unbandaged wounds, for trauma kits that heal damage directly.

get_active_limb_surgeries

Returns a description of active surgeries.

get_damage

Returns total damage, or, if broken, the minimum fracture threshold, whichever is higher.

get_incision_depth

Returns a description of opened incisions.

get_limb_icon

generates a list of overlays that should be applied to the owner

get_limb_icon_key

generates a key for the purpose of caching the icon to avoid duplicate generations

is_bandaged

Checks for bandageable wounds (type = CUT or type = BRUISE). Returns TRUE if all are bandaged, FALSE if not.

is_salved

Checks for salveable wounds (type = BURN). Returns TRUE if all are salved, FALSE if not.

limb_delimb

Special delimbs for different limbs

remove_wound_bleeding

Checks if there's any external limb wounds, removes bleeding if there isn't.

reset_limb_surgeries

called when limb is removed or robotized, any ongoing surgery and related vars are reset unless set otherwise.

salve

salves burn wounds. Returns WOUNDS_BANDAGED if at least one wound was salved. Returns WOUNDS_ALREADY_TREATED if a relevant wound exists but none were treated. Skips wounds that are already salved. treat_grafted var tells it to apply to grafted but unsalved wounds, for burn kits that heal damage directly.

take_damage

Describes how limbs (body parts) of human mobs get damage applied.

Any damage past the limb maximum health is transfered onto the next limb up the line, by calling this proc recursively. When a hand is too damaged it is passed to the arm, then to the chest and so on.

Since parent limbs usually have more armor than their children, just passing the damage directly would allow the attacker to effectively bypass all of that armor. A lurker with 35 slash damage repeatedly slashing a hand protected by marine combat gloves (20 armor) would do 20 damage to the hand, then would start doing the same 20 to the arm, and then the chest. But if the lurker slashes the arm direclty it would only do 16 damage, assuming the marine is wearing medium armor which has armor value of 30.

Thus we have to apply armor damage reduction on each limb to which the damage is transfered. When this proc is called recursively for the first damage transfer to the parent, we set reduced_by variables to be the armor of the original limb hit. Then we compare the parent limb armor with the applicable reduced_by and if it's higher we reduce the damage by the difference between the two. Then we set reduced_by to the current(parent) limb armor value.

This generally works ok because our armor calculations are mostly distributive in practice: reducing the damage by 20 and then by 10 would generally give the same result as reducing by 30. But this is not strictly true, the lower the damage is, the more it gets reduced. As an extreme example, a lurker doing his first 35 damage slash on a combat gloves covered marine hand would do 30 damage to the hand, transfer 5 to the arm and those 5 would get mitigated to 0 by the marine medium armor.

One problem that still exists here, is that we currently don't have any code that allows us to increase the damage when the parent limb armor is lower than the initial child limb armor. One practical example where this would happen is when a human is wearing a set of armor that does not protect legs, like the UPP officer. If a xeno keeps slashing his foot, the damage would eventually get transfered to the leg, which has 0 armor. But this damage has been already reduced by the boot armor even before this proc got first called. So, assuming 35 damage slash, the leg would only be damaged by 21 even though it has 0 armor. Fixing this would require a new proc that would be able to unapply armor from the damage.

Organ damage and bone break have their own armor damage reduction calculations. Since armor is already applied at least once outside of this proc, this means that damage is always reduced twice, hence the formulas for those looks so weird.

Currently all brute damage is reduced by ARMOR_MELEE and GLOB.marine_melee, while burn damage is reduced by ARMOR_BIO and GLOB.marine_fire, which may not be correct for all cases.

update_limb

updates the various internal variables of the limb from the owner