Skip to content

Commit

Permalink
Fix 0.get_idcard() runtime with holoparasites (#10238)
Browse files Browse the repository at this point in the history
* Fix `0.get_idcard()` runtime with holoparasites

* bleh
  • Loading branch information
Absolucy authored Dec 1, 2023
1 parent e0d1810 commit 25bad50
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions code/modules/holoparasite/_holoparasite.dm
Original file line number Diff line number Diff line change
Expand Up @@ -229,26 +229,28 @@ GLOBAL_LIST_EMPTY_TYPED(holoparasites, /mob/living/simple_animal/hostile/holopar
. += "<span data-component=\"RadarChart\" data-width=\"300\" data-height=\"300\" data-area-color=\"[accent_color]\" data-axes=\"Damage,Defense,Speed,Potential,Range\" data-stages=\"1,2,3,4,5\" data-values=\"[stats.damage],[stats.defense],[stats.speed],[stats.potential],[stats.range]\" />"

/mob/living/simple_animal/hostile/holoparasite/get_idcard(hand_first = TRUE)
//Check hands
// IMPORTANT: don't use ?. for these, because held_item might be 0 for some reason!!
var/obj/item/card/id/id_card
var/obj/item/held_item
held_item = get_active_held_item()
id_card = held_item?.GetID() //Check active hand
if(!id_card) //If there is no id, check the other hand
if(!QDELETED(held_item))
id_card = held_item.GetID() //Check active hand
if(QDELETED(id_card)) //If there is no id, check the other hand
held_item = get_inactive_held_item()
id_card = held_item?.GetID()
if(!QDELETED(held_item))
id_card = held_item.GetID()

if(id_card)
if(!QDELETED(id_card))
if(hand_first)
return id_card
. = id_card

// Check inventory slot
if(istype(stats.weapon, /datum/holoparasite_ability/weapon/dextrous))
var/datum/holoparasite_ability/weapon/dextrous/dextrous_ability = stats.weapon
id_card = dextrous_ability.internal_storage?.GetID()
if(id_card)
return id_card
var/obj/item/internal_item = dextrous_ability.internal_storage
if(!QDELETED(internal_item))
return internal_item.GetID()

/mob/living/simple_animal/hostile/holoparasite/CtrlClickOn(atom/target)
. = ..()
Expand Down

0 comments on commit 25bad50

Please sign in to comment.