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

Fixes bad istype() in hand slot code. #4789

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1401,8 +1401,8 @@

/// THIS DOES NOT RELATE TO HELD ITEM SLOTS. It is very specifically a functional BP_L_HAND or BP_R_HAND organ, not necessarily a gripper.
/mob/proc/get_usable_hand_slot_organ()
var/obj/item/organ/external/paw = GET_EXTERNAL_ORGAN(src, BP_L_HAND)
if(!istype(paw) && !paw.is_usable())
paw = GET_EXTERNAL_ORGAN(src, BP_R_HAND)
if(istype(paw) && paw.is_usable())
return paw
var/static/list/hand_slots = list(BP_L_HAND, BP_R_HAND)
for(var/slot in shuffle(hand_slots))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc shuffling is actually relatively expensive, i feel a little uncomfortable about this, but it's probably fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't hot code, it's used only by a couple of specific interactions (there is also a use in get_quick_interaction_handler() but that is an error and is removed in the holsters PR).

var/obj/item/organ/external/hand = GET_EXTERNAL_ORGAN(src, slot)
if(istype(hand) && hand.is_usable())
return hand