Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reworks Limb Gibbing Mechanics #5330

Merged
merged 8 commits into from
Jan 5, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
75 changes: 35 additions & 40 deletions code/modules/organs/organ_external.dm
Original file line number Diff line number Diff line change
Expand Up @@ -292,50 +292,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

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

else
if(W.w_class >= w_class)
edge_eligible = 1
else
var/maim_bonus = 0

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")

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)
Expand All @@ -356,17 +358,10 @@
status &= ~ORGAN_BROKEN
perma_injury = 0

/*if((brute || burn) && children && children.len && (owner.species.flags & REGENERATES_LIMBS))
var/obj/item/organ/external/stump/S = locate() in children
if(S)
world << "Extra healing to go around ([brute+burn]) and [owner] needs a replacement limb."*/

//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.
Expand Down
27 changes: 4 additions & 23 deletions code/modules/projectiles/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,30 +106,11 @@
if(isanimal(target))
return FALSE
var/mob/living/L = target

var/splatter_color = "#A10808"


if (ishuman(target))
var/mob/living/carbon/human/H = target
var/obj/item/organ/external/organ = H.get_organ(def_zone)
var/armor = H.getarmor_organ(organ, check_armour)
if(agony)
agony = max(0, agony - armor)

if (H.species)
splatter_color = H.species.blood_color || "#A10808"

/*
Maim / Maiming check. Disembody a limb depending on several factors.

can_be_maimed and maim_bonus are defined on 'obj/item/organ/external'.
*/
if(organ.can_be_maimed && maiming)
if(prob((maim_rate * (organ.get_damage() * organ.maim_bonus) - (armor/2))))
organ.droplimb(clean_cut,maim_type)

if (damage_type == BRUTE)
var/splatter_color = "#A10808"
var/mob/living/carbon/human/H = target
if (istype(H)&& H.species && H.species.blood_color)
splatter_color = H.species.blood_color
var/splatter_dir = starting ? get_dir(starting, target.loc) : dir
new /obj/effect/temp_visual/dir_setting/bloodsplatter(target.loc, splatter_dir, splatter_color)

Expand Down
38 changes: 38 additions & 0 deletions html/changelogs/burgerbb - maim tweak.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# balance
#################################

# Your name.
author: BurgerBB

# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True

# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- balance: "Limbs cannot be gibbed if the limb's armor value exceeds the damage dealt. Limbs cannot also be gibbed on the first hit. Limb gibbing is no longer determined by RNG."
MarinaGryphon marked this conversation as resolved.
Show resolved Hide resolved