Fixes carbon bodytypes not always being synchronized with bodyparts (#76522)

Fixes https://github.com/tgstation/tgstation/issues/76481
TLDR /mob/living/carbon/human/species subtypes were NOT updating their
bodytypes on spawn due to absurd and wacky carbon bodypart creation code
that meant try_attach_limb() never got called (What the FUCK?)
This commit is contained in:
ChungusGamer666
2023-07-05 13:28:24 -05:00
committed by GitHub
parent 95298fb99d
commit c97f2e73ad
11 changed files with 42 additions and 26 deletions
@@ -133,7 +133,6 @@
organ.transfer_to_limb(src, phantom_owner)
update_icon_dropped()
synchronize_bodytypes(phantom_owner)
phantom_owner.update_health_hud() //update the healthdoll
phantom_owner.update_body()
phantom_owner.update_body_parts()
@@ -359,7 +358,6 @@
// Bodyparts need to be sorted for leg masking to be done properly. It also will allow for some predictable
// behavior within said bodyparts list. We sort it here, as it's the only place we make changes to bodyparts.
new_limb_owner.bodyparts = sort_list(new_limb_owner.bodyparts, GLOBAL_PROC_REF(cmp_bodypart_by_body_part_asc))
synchronize_bodytypes(new_limb_owner)
new_limb_owner.updatehealth()
new_limb_owner.update_body()
new_limb_owner.update_damage_overlays()
@@ -411,16 +409,6 @@
new_head_owner.update_body()
new_head_owner.update_damage_overlays()
///Makes sure that the owner's bodytype flags match the flags of all of it's parts.
/obj/item/bodypart/proc/synchronize_bodytypes(mob/living/carbon/carbon_owner)
var/all_limb_flags
for(var/obj/item/bodypart/limb as anything in carbon_owner.bodyparts)
for(var/obj/item/organ/external/ext_organ as anything in limb.external_organs)
all_limb_flags = all_limb_flags | ext_organ.external_bodytypes
all_limb_flags = all_limb_flags | limb.bodytype
carbon_owner.bodytype = all_limb_flags
/mob/living/carbon/proc/regenerate_limbs(list/excluded_zones = list())
SEND_SIGNAL(src, COMSIG_CARBON_REGENERATE_LIMBS, excluded_zones)
var/list/zone_list = list(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG)
@@ -168,7 +168,15 @@
if(new_bodypart)
new_bodypart.update_limb(is_creating = TRUE)
/// Makes sure that the owner's bodytype flags match the flags of all of it's parts and organs
/mob/living/carbon/proc/synchronize_bodytypes()
var/all_limb_flags = NONE
for(var/obj/item/bodypart/limb as anything in bodyparts)
for(var/obj/item/organ/external/ext_organ as anything in limb.external_organs)
all_limb_flags |= ext_organ.external_bodytypes
all_limb_flags |= limb.bodytype
bodytype = all_limb_flags
/proc/skintone2hex(skin_tone)
. = 0
+1 -2
View File
@@ -326,13 +326,12 @@
max_damage = 100
should_draw_greyscale = FALSE
/// Parent Type for arms, should not appear in game.
/// Parent Type for legs, should not appear in game.
/obj/item/bodypart/leg
name = "leg"
desc = "This item shouldn't exist. Talk about breaking a leg. Badum-Tss!"
attack_verb_continuous = list("kicks", "stomps")
attack_verb_simple = list("kick", "stomp")
bodytype = BODYTYPE_HUMANOID | BODYTYPE_MONKEY | BODYTYPE_ORGANIC
max_damage = 50
body_damage_coeff = 0.75
can_be_disabled = TRUE
+2 -2
View File
@@ -86,7 +86,7 @@
add_to_limb(ownerlimb)
if(external_bodytypes)
limb.synchronize_bodytypes(receiver)
receiver.synchronize_bodytypes()
receiver.update_body_parts()
@@ -123,7 +123,7 @@
ownerlimb.external_organs -= src
ownerlimb.remove_bodypart_overlay(bodypart_overlay)
if(ownerlimb.owner && external_bodytypes)
ownerlimb.synchronize_bodytypes(ownerlimb.owner)
ownerlimb.owner.synchronize_bodytypes()
ownerlimb = null
return ..()