[MIRROR] limb disabled refactor (#757)

* limb disabled refactor (#53374)

    Fixes #53219
    Nukes is_disabled()
    Turns several variable value changes into events.
    bodypart_disabled turned into a boolean value.
    BODYPART_DISABLED_WOUND turned into TRAIT_DISABLED_BY_WOUND. Not the cleanest thing out there, but it works.
    Cleans some code and reduces number of updates, as only the extremities have a disabled effect.

* limb disabled refactor

Co-authored-by: Rohesie <rohesie@gmail.com>
This commit is contained in:
SkyratBot
2020-09-11 23:21:46 +02:00
committed by GitHub
co-authored by Rohesie
parent 47be9246e6
commit 7c4b7cdb9a
14 changed files with 485 additions and 177 deletions
+1 -5
View File
@@ -967,7 +967,7 @@
var/r_arm_index_next = 0
for(var/bodypart_path in bodyparts)
var/obj/item/bodypart/bodypart_instance = new bodypart_path()
bodypart_instance.owner = src
bodypart_instance.set_owner(src)
bodyparts.Remove(bodypart_path)
add_bodypart(bodypart_instance)
switch(bodypart_instance.body_part)
@@ -1016,10 +1016,6 @@
var/obj/item/organ/I = X
I.Insert(src)
/mob/living/carbon/proc/update_disabled_bodyparts()
for(var/B in bodyparts)
var/obj/item/bodypart/BP = B
BP.update_disabled()
/mob/living/carbon/vv_get_dropdown()
. = ..()
@@ -157,12 +157,13 @@
for(var/X in disabled)
var/obj/item/bodypart/body_part = X
var/damage_text
if(body_part.is_disabled() != BODYPART_DISABLED_WOUND) // skip if it's disabled by a wound (cuz we'll be able to see the bone sticking out!)
if(!(body_part.get_damage(include_stamina = FALSE) >= body_part.max_damage)) //we don't care if it's stamcritted
damage_text = "limp and lifeless"
else
damage_text = (body_part.brute_dam >= body_part.burn_dam) ? body_part.heavy_brute_msg : body_part.heavy_burn_msg
msg += "<B>[capitalize(t_his)] [body_part.name] is [damage_text]!</B>\n"
if(HAS_TRAIT(body_part, TRAIT_DISABLED_BY_WOUND))
continue // skip if it's disabled by a wound (cuz we'll be able to see the bone sticking out!)
if(!(body_part.get_damage(include_stamina = FALSE) >= body_part.max_damage)) //we don't care if it's stamcritted
damage_text = "limp and lifeless"
else
damage_text = (body_part.brute_dam >= body_part.burn_dam) ? body_part.heavy_brute_msg : body_part.heavy_burn_msg
msg += "<B>[capitalize(t_his)] [body_part.name] is [damage_text]!</B>\n"
//stores missing limbs
var/l_limbs_missing = 0
@@ -717,7 +717,7 @@
if(status == "OK" || status == "no damage")
no_damage = TRUE
var/isdisabled = ""
if(LB.is_disabled())
if(LB.bodypart_disabled)
isdisabled = " is disabled"
if(no_damage)
isdisabled += " but otherwise"