Reworks Limb Gibbing Mechanics (#5330)

Overview
Limb gibbing mechanics on Aurora were pretty bad. For melee weapons, it was RNG based and somewhat fair because it was actually based on mechanics. For bullets, it used custom snowflake code that was just absolutely insulting. It didn't really regard armor like most servers, and unlike most servers, if your feet are gibbed you're sideways until it's fixed.
This commit is contained in:
BurgerLUA
2019-01-05 16:50:29 +02:00
committed by Erki
parent e1d2c91472
commit 1b12e26c66
3 changed files with 75 additions and 55 deletions
+33 -32
View File
@@ -296,50 +296,52 @@
if (spillover && owner)
owner.shock_stage += spillover * config.organ_damage_spillover_multiplier
handle_limb_gibbing(used_weapon,brute,burn)
// sync the organ's damage with its wounds
src.update_damages()
update_damages()
if (owner)
owner.updatehealth() //droplimb will call updatehealth() again if it does end up being called
return update_icon()
/obj/item/organ/external/proc/handle_limb_gibbing(var/used_weapon,var/brute,var/burn)
//If limb took enough damage, try to cut or tear it off
if(owner && loc == owner && !is_stump())
if(!cannot_amputate && config.limbs_can_break && (brute_dam + burn_dam) >= (max_damage * config.organ_health_multiplier))
//organs can come off in three cases
//1. If the damage source is edge_eligible and the brute damage dealt exceeds the edge threshold, then the organ is cut off.
//2. If the damage amount dealt exceeds the disintegrate threshold, the organ is completely obliterated.
//3. If the organ has already reached or would be put over it's max damage amount (currently redundant),
// and the brute damage dealt exceeds the tearoff threshold, the organ is torn off.
//Check edge eligibility
var/brute_armor_value = 0
var/burn_armor_value = 0
var/edge_eligible = 0
var/gibs_traditionally = TRUE
if(edge)
if(istype(used_weapon,/obj/item))
var/obj/item/W = used_weapon
var/maim_bonus = 0
if(isprojectile(W)) //Maiming projectiles use a different method to calcualate gibbing.
var/obj/item/projectile/P = used_weapon
if(P.maiming)
gibs_traditionally = FALSE
var/mob/living/carbon/human/H
if(istype(owner,/mob/living/carbon/human))
H = owner
brute_armor_value = H.getarmor_organ(src, "melee")
burn_armor_value = H.getarmor_organ(src, "burn")
else
if(W.w_class >= w_class)
edge_eligible = 1
else
if(istype(used_weapon,/obj/item))
var/obj/item/W = used_weapon
if(isprojectile(W))
var/obj/item/projectile/P = W
brute_armor_value = H.getarmor_organ(src, "bullet")
maim_bonus += P.maim_rate
else if(W.w_class >= w_class && edge)
edge_eligible = 1
else if(edge)
edge_eligible = 1
if(gibs_traditionally)
if(edge_eligible && brute >= max_damage / DROPLIMB_THRESHOLD_EDGE && prob(brute))
droplimb(0, DROPLIMB_EDGE)
else if(burn >= max_damage / DROPLIMB_THRESHOLD_DESTROY && prob(burn/3))
droplimb(0, DROPLIMB_BURN)
else if(brute >= max_damage / DROPLIMB_THRESHOLD_DESTROY && prob(brute))
droplimb(0, DROPLIMB_BLUNT)
else if(brute >= max_damage / DROPLIMB_THRESHOLD_TEAROFF && prob(brute/3))
droplimb(0, DROPLIMB_EDGE)
if(edge_eligible && brute >= max_damage / (DROPLIMB_THRESHOLD_EDGE + maim_bonus) && brute >= brute_armor_value)
droplimb(0, DROPLIMB_EDGE)
else if(burn >= max_damage / (DROPLIMB_THRESHOLD_DESTROY + maim_bonus) && burn >= burn_armor_value)
droplimb(0, DROPLIMB_BURN)
else if(brute >= max_damage / (DROPLIMB_THRESHOLD_DESTROY + maim_bonus) && brute >= brute_armor_value)
droplimb(0, DROPLIMB_BLUNT)
else if(brute >= max_damage / (DROPLIMB_THRESHOLD_TEAROFF + maim_bonus) && brute >= brute_armor_value)
droplimb(0, DROPLIMB_EDGE)
return update_icon()
/obj/item/organ/external/proc/heal_damage(brute, burn, internal = 0, robo_repair = 0)
if(status & ORGAN_ROBOT && !robo_repair)
@@ -361,11 +363,10 @@
perma_injury = 0
//Sync the organ's damage with its wounds
src.update_damages()
update_damages()
owner.updatehealth()
var/result = update_icon()
return result
return update_icon()
/*
This function completely restores a damaged organ to perfect condition.