[MIRROR] Fixes disabled limbs from compound fractures, only robotic limbs can be disabled by pure damage now (#1709)

* Fixes disabled limbs from compound fractures, only robotic limbs can be disabled by pure damage now (#54922)

* Fixes disabled limbs from compound fractures, only robotic limbs can be disabled by pure damage now

Co-authored-by: Ryll Ryll <3589655+Ryll-Ryll@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-11-17 00:50:36 +01:00
committed by GitHub
parent 9ed66a2511
commit 964adb7828
16 changed files with 75 additions and 80 deletions
@@ -6,7 +6,7 @@
meat = /obj/item/stack/sheet/mineral/plasma
species_traits = list(NOBLOOD,NOTRANSSTING, HAS_BONE)
// plasmemes get hard to wound since they only need a severe bone wound to dismember, but unlike skellies, they can't pop their bones back into place
inherent_traits = list(TRAIT_RESISTCOLD,TRAIT_RADIMMUNE,TRAIT_GENELESS,TRAIT_NOHUNGER,TRAIT_ALWAYS_CLEAN, TRAIT_HARDLIMBWOUND)
inherent_traits = list(TRAIT_RESISTCOLD,TRAIT_RADIMMUNE,TRAIT_GENELESS,TRAIT_NOHUNGER,TRAIT_ALWAYS_CLEAN, TRAIT_HARDLY_WOUNDED)
inherent_biotypes = MOB_HUMANOID|MOB_MINERAL
mutantlungs = /obj/item/organ/lungs/plasmaman
mutanttongue = /obj/item/organ/tongue/bone/plasmaman
@@ -8,7 +8,7 @@
sexes = 0
meat = /obj/item/food/meat/slab/human/mutant/zombie
species_traits = list(NOBLOOD,NOZOMBIE,NOTRANSSTING, HAS_FLESH, HAS_BONE)
inherent_traits = list(TRAIT_NOMETABOLISM,TRAIT_TOXIMMUNE,TRAIT_RESISTCOLD,TRAIT_RESISTHIGHPRESSURE,TRAIT_RESISTLOWPRESSURE,TRAIT_RADIMMUNE,TRAIT_EASYDISMEMBER,TRAIT_EASYLIMBWOUND,TRAIT_LIMBATTACHMENT,TRAIT_NOBREATH,TRAIT_NODEATH,TRAIT_FAKEDEATH,TRAIT_NOCLONELOSS)
inherent_traits = list(TRAIT_NOMETABOLISM,TRAIT_TOXIMMUNE,TRAIT_RESISTCOLD,TRAIT_RESISTHIGHPRESSURE,TRAIT_RESISTLOWPRESSURE,TRAIT_RADIMMUNE,TRAIT_EASYDISMEMBER,TRAIT_EASILY_WOUNDED,TRAIT_LIMBATTACHMENT,TRAIT_NOBREATH,TRAIT_NODEATH,TRAIT_FAKEDEATH,TRAIT_NOCLONELOSS)
inherent_biotypes = MOB_UNDEAD|MOB_HUMANOID
mutanttongue = /obj/item/organ/tongue/zombie
var/static/list/spooks = list('sound/hallucinations/growl1.ogg','sound/hallucinations/growl2.ogg','sound/hallucinations/growl3.ogg','sound/hallucinations/veryfar_noise.ogg','sound/hallucinations/wail.ogg')
@@ -100,6 +100,6 @@
mutanttongue = /obj/item/organ/tongue/zombie
changesource_flags = MIRROR_BADMIN | WABBAJACK | ERT_SPAWN
species_traits = list(HAS_FLESH, HAS_BONE)
inherent_traits = list(TRAIT_EASYLIMBWOUND)
inherent_traits = list(TRAIT_EASILY_WOUNDED)
#undef REGENERATION_DELAY
@@ -565,7 +565,7 @@
/datum/reagent/drug/maint/sludge/on_mob_metabolize(mob/living/L)
. = ..()
ADD_TRAIT(L,TRAIT_HARDLIMBWOUND,type)
ADD_TRAIT(L,TRAIT_HARDLY_WOUNDED,type)
/datum/reagent/drug/maint/sludge/on_mob_life(mob/living/carbon/M)
. = ..()
@@ -573,7 +573,7 @@
/datum/reagent/drug/maint/sludge/on_mob_end_metabolize(mob/living/M)
. = ..()
REMOVE_TRAIT(M,TRAIT_HARDLIMBWOUND,type)
REMOVE_TRAIT(M,TRAIT_HARDLY_WOUNDED,type)
/datum/reagent/drug/maint/sludge/overdose_process(mob/living/M)
. = ..()
@@ -37,9 +37,9 @@
/datum/bioware/reinforced_ligaments/on_gain()
..()
ADD_TRAIT(owner, TRAIT_NODISMEMBER, "reinforced_ligaments")
ADD_TRAIT(owner, TRAIT_EASYLIMBWOUND, "reinforced_ligaments")
ADD_TRAIT(owner, TRAIT_EASILY_WOUNDED, "reinforced_ligaments")
/datum/bioware/reinforced_ligaments/on_lose()
..()
REMOVE_TRAIT(owner, TRAIT_NODISMEMBER, "reinforced_ligaments")
REMOVE_TRAIT(owner, TRAIT_EASYLIMBWOUND, "reinforced_ligaments")
REMOVE_TRAIT(owner, TRAIT_EASILY_WOUNDED, "reinforced_ligaments")
+27 -47
View File
@@ -24,8 +24,8 @@
///If disabled, limb is as good as missing.
var/bodypart_disabled = FALSE
///Multiplied by max_damage it returns the threshold which defines a limb being disabled or not. From 0 to 1.
var/disable_threshold = 1
///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
var/body_damage_coeff = 1 //Multiplier of the limb's damage that gets applied to the mob
@@ -181,8 +181,7 @@
var/turf/T = get_turf(src)
if(status != BODYPART_ROBOTIC)
playsound(T, 'sound/misc/splort.ogg', 50, TRUE, -1)
if(current_gauze)
QDEL_NULL(current_gauze)
seep_gauze(9999) // destroy any existing gauze if any exists
for(var/obj/item/organ/drop_organ in get_organs())
drop_organ.transfer_to_limb(src, owner)
for(var/obj/item/I in src)
@@ -377,12 +376,12 @@
*/
/obj/item/bodypart/proc/check_wounding(woundtype, damage, wound_bonus, bare_wound_bonus)
// note that these are fed into an exponent, so these are magnified
if(HAS_TRAIT(owner, TRAIT_EASYLIMBWOUND))
if(HAS_TRAIT(owner, TRAIT_EASILY_WOUNDED))
damage *= 1.5
else
damage = min(damage, WOUND_MAX_CONSIDERED_DAMAGE)
if(HAS_TRAIT(owner,TRAIT_HARDLIMBWOUND))
if(HAS_TRAIT(owner,TRAIT_HARDLY_WOUNDED))
damage *= 0.85
if(HAS_TRAIT(owner, TRAIT_EASYDISMEMBER))
@@ -570,7 +569,19 @@
var/total_damage = max(brute_dam + burn_dam, stamina_dam)
if(total_damage >= max_damage * disable_threshold) //Easy limb disable disables the limb at 40% health instead of 0%
// 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(total_damage < max_damage)
last_maxed = FALSE
else
if(!last_maxed && owner.stat < UNCONSCIOUS)
INVOKE_ASYNC(owner, /mob.proc/emote, "scream")
last_maxed = TRUE
set_disabled(FALSE) // we only care about the paralysis trait
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(!last_maxed)
if(owner.stat < UNCONSCIOUS)
INVOKE_ASYNC(owner, /mob.proc/emote, "scream")
@@ -578,7 +589,7 @@
set_disabled(TRUE)
return
if(bodypart_disabled && total_damage <= max_damage * 0.8) // reenabled at 80% now instead of 50% as of wounds update
if(bodypart_disabled && total_damage <= max_damage * 0.5) // reenable the limb at 50% health
last_maxed = FALSE
set_disabled(FALSE)
@@ -605,14 +616,6 @@
var/needs_update_disabled = FALSE //Only really relevant if there's an owner
if(.)
var/mob/living/carbon/old_owner = .
if(can_be_disabled)
if(HAS_TRAIT(old_owner, TRAIT_EASYLIMBWOUND))
disable_threshold = initial(disable_threshold)
needs_update_disabled = TRUE
UnregisterSignal(old_owner, list(
SIGNAL_REMOVETRAIT(TRAIT_EASYLIMBWOUND),
SIGNAL_ADDTRAIT(TRAIT_EASYLIMBWOUND),
))
if(initial(can_be_disabled))
if(HAS_TRAIT(old_owner, TRAIT_NOLIMBDISABLE))
if(!owner || !HAS_TRAIT(owner, TRAIT_NOLIMBDISABLE))
@@ -623,12 +626,6 @@
SIGNAL_ADDTRAIT(TRAIT_NOLIMBDISABLE),
))
if(owner)
if(can_be_disabled)
if(HAS_TRAIT(owner, TRAIT_EASYLIMBWOUND))
disable_threshold = 0.6
needs_update_disabled = TRUE
RegisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_EASYLIMBWOUND), .proc/on_owner_easylimbwound_trait_loss)
RegisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_EASYLIMBWOUND), .proc/on_owner_easylimbwound_trait_gain)
if(initial(can_be_disabled))
if(HAS_TRAIT(owner, TRAIT_NOLIMBDISABLE))
set_can_be_disabled(FALSE)
@@ -651,18 +648,12 @@
CRASH("set_can_be_disabled to TRUE with for limb whose owner has TRAIT_NOLIMBDISABLE")
RegisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS), .proc/on_paralysis_trait_gain)
RegisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS), .proc/on_paralysis_trait_loss)
if(HAS_TRAIT(owner, TRAIT_EASYLIMBWOUND))
disable_threshold = 0.6
RegisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_EASYLIMBWOUND), .proc/on_owner_easylimbwound_trait_loss)
RegisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_EASYLIMBWOUND), .proc/on_owner_easylimbwound_trait_gain)
update_disabled()
else if(.)
if(owner)
UnregisterSignal(owner, list(
SIGNAL_ADDTRAIT(TRAIT_PARALYSIS),
SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS),
SIGNAL_REMOVETRAIT(TRAIT_EASYLIMBWOUND),
SIGNAL_ADDTRAIT(TRAIT_EASYLIMBWOUND),
))
set_disabled(FALSE)
@@ -692,23 +683,6 @@
SIGNAL_HANDLER
set_can_be_disabled(initial(can_be_disabled))
///Called when TRAIT_EASYLIMBWOUND is added to the owner.
/obj/item/bodypart/proc/on_owner_easylimbwound_trait_gain(mob/living/carbon/source)
SIGNAL_HANDLER
disable_threshold = 0.6
if(can_be_disabled)
update_disabled()
///Called when TRAIT_EASYLIMBWOUND is removed from the owner.
/obj/item/bodypart/proc/on_owner_easylimbwound_trait_loss(mob/living/carbon/source)
SIGNAL_HANDLER
disable_threshold = initial(disable_threshold)
if(can_be_disabled)
update_disabled()
//Updates an organ's brute/burn states for use by update_damage_overlays()
//Returns 1 if we need to update overlays. 0 otherwise.
/obj/item/bodypart/proc/update_bodypart_damage_state()
@@ -933,7 +907,7 @@
var/datum/wound/iter_wound = i
dam_mul *= iter_wound.damage_mulitplier_penalty
if(!LAZYLEN(wounds) && current_gauze && !replaced)
if(!LAZYLEN(wounds) && current_gauze && !replaced) // no more wounds = no need for the gauze anymore
owner.visible_message("<span class='notice'>\The [current_gauze] on [owner]'s [name] fall away.</span>", "<span class='notice'>The [current_gauze] on your [name] fall away.</span>")
QDEL_NULL(current_gauze)
@@ -983,9 +957,14 @@
/obj/item/bodypart/proc/apply_gauze(obj/item/stack/gauze)
if(!istype(gauze) || !gauze.absorption_capacity)
return
var/newly_gauzed = FALSE
if(!current_gauze)
newly_gauzed = TRUE
QDEL_NULL(current_gauze)
current_gauze = new gauze.type(src, 1)
gauze.use(1)
if(newly_gauzed)
SEND_SIGNAL(src, COMSIG_BODYPART_GAUZED, gauze)
/**
* seep_gauze() is for when a gauze wrapping absorbs blood or pus from wounds, lowering its absorption capacity.
@@ -999,6 +978,7 @@
if(!current_gauze)
return
current_gauze.absorption_capacity -= seep_amt
if(current_gauze.absorption_capacity < 0)
if(current_gauze.absorption_capacity <= 0)
owner.visible_message("<span class='danger'>\The [current_gauze] on [owner]'s [name] fall away in rags.</span>", "<span class='warning'>\The [current_gauze] on your [name] fall away in rags.</span>", vision_distance=COMBAT_MESSAGE_RANGE)
QDEL_NULL(current_gauze)
SEND_SIGNAL(src, COMSIG_BODYPART_GAUZE_DESTROYED)
@@ -20,6 +20,7 @@
flags_1 = CONDUCT_1
icon_state = "borg_l_arm"
status = BODYPART_ROBOTIC
disable_threshold = 1
brute_reduction = 5
burn_reduction = 4
@@ -42,6 +43,7 @@
flags_1 = CONDUCT_1
icon_state = "borg_r_arm"
status = BODYPART_ROBOTIC
disable_threshold = 1
brute_reduction = 5
burn_reduction = 4
@@ -64,6 +66,7 @@
flags_1 = CONDUCT_1
icon_state = "borg_l_leg"
status = BODYPART_ROBOTIC
disable_threshold = 1
brute_reduction = 5
burn_reduction = 4
@@ -86,6 +89,7 @@
flags_1 = CONDUCT_1
icon_state = "borg_r_leg"
status = BODYPART_ROBOTIC
disable_threshold = 1
brute_reduction = 5
burn_reduction = 4