From 1cda7cedc67b67b1fd562ce78533beef143fe49c Mon Sep 17 00:00:00 2001 From: necromanceranne <40847847+necromanceranne@users.noreply.github.com> Date: Thu, 4 Dec 2025 12:04:46 +1100 Subject: [PATCH] [NO GBP] Fixes a runtime in sleeping carp's dodge code (#94124) ## About The Pull Request fixes https://github.com/tgstation/tgstation/issues/94123 ## Why It's Good For The Game AAAAAAH --- code/datums/martial/sleeping_carp.dm | 38 +++++++++++++--------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/code/datums/martial/sleeping_carp.dm b/code/datums/martial/sleeping_carp.dm index a7978c40d57..bd33e55c170 100644 --- a/code/datums/martial/sleeping_carp.dm +++ b/code/datums/martial/sleeping_carp.dm @@ -326,20 +326,22 @@ var/obj/item/bodypart/potential_chest = human_carp_user.get_bodypart(BODY_ZONE_CHEST) var/obj/item/clothing/is_it_the_shoes = human_carp_user.get_item_by_slot(ITEM_SLOT_FEET) - // The presence of armor is a style malus - var/oh_no_armor = 0 + // The presence of armor and heavy objects is a style malus + var/style_factor_malus = 0 // Lets look to see if any relevant headwear is armored or on theme - for(var/obj/item/clothing/possible_headbands in human_carp_user.get_clothing_on_part(potential_head)) - if(possible_headbands.clothing_flags & CARP_STYLE_FACTOR) - style_factor_points += 20 // Basically, you only need one chest level item to contribute - oh_no_armor += human_carp_user.run_armor_check(potential_head, MELEE) + if(potential_head) + for(var/obj/item/clothing/possible_headbands in human_carp_user.get_clothing_on_part(potential_head)) + if(possible_headbands.clothing_flags & CARP_STYLE_FACTOR) + style_factor_points += 20 // Basically, you only need one chest level item to contribute + style_factor_malus += human_carp_user.run_armor_check(potential_head, MELEE) // Then let's look for any chest clothing that is either armored or on theme - for(var/obj/item/clothing/possible_gi in human_carp_user.get_clothing_on_part(potential_chest)) - if(possible_gi.clothing_flags & CARP_STYLE_FACTOR) - style_factor_points += 20 // Only need one head level item to contribute - oh_no_armor += human_carp_user.run_armor_check(potential_chest, MELEE) + if(potential_chest) + for(var/obj/item/clothing/possible_gi in human_carp_user.get_clothing_on_part(potential_chest)) + if(possible_gi.clothing_flags & CARP_STYLE_FACTOR) + style_factor_points += 20 // Only need one head level item to contribute + style_factor_malus += human_carp_user.run_armor_check(potential_chest, MELEE) // We also consider whether our footwear is appropriate if(istype(is_it_the_shoes) && is_it_the_shoes.clothing_flags & CARP_STYLE_FACTOR) @@ -349,12 +351,8 @@ if(human_carp_user.has_status_effect(/datum/status_effect/organ_set_bonus/carp)) style_factor_points += 20 - var/list/our_held_items = list() - our_held_items += human_carp_user.get_active_held_item() - our_held_items += human_carp_user.get_inactive_held_item() - - // We check for wielded objects. If they're not abstract items or exempt items, we - for(var/obj/item/possibly_a_held_object as anything in our_held_items) + // We check for wielded objects. If they're not abstract items or exempt items, we add their weight as a penalty. And their block chance. + for(var/obj/item/possibly_a_held_object in human_carp_user.held_items) if(possibly_a_held_object.item_flags & (ABSTRACT|HAND_ITEM) && !possibly_a_held_object.block_chance) continue @@ -364,13 +362,13 @@ if(possibly_a_held_object.w_class <= WEIGHT_CLASS_SMALL && !possibly_a_held_object.block_chance) continue - oh_no_armor += possibly_a_held_object.block_chance - oh_no_armor += possibly_a_held_object.w_class * 10 * (HAS_TRAIT(possibly_a_held_object, TRAIT_WIELDED) ? 2 : 1) + style_factor_malus += possibly_a_held_object.block_chance + style_factor_malus += possibly_a_held_object.w_class * 10 * (HAS_TRAIT(possibly_a_held_object, TRAIT_WIELDED) ? 2 : 1) - if(human_carp_user.body_position != STANDING_UP) // YARR, MAN OVERBOARD + if(human_carp_user.body_position != STANDING_UP) // this ain't monkey style style_factor_points -= 30 - style_factor_points -= oh_no_armor + style_factor_points -= style_factor_malus return style_factor_points