From cfa8bf43a8cf22f15f2d6a9e0c0d5deb3bf0e6e1 Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:19:50 +0200 Subject: [PATCH] Being abducted by a contractor no longer recursively dumps contents of all of your boxes and belts, nor does it break your UI anymore (#86657) ## About The Pull Request Contractor abductions no longer recursively dump all of your items on the ground, instead only doing a single depth loop. Also fixed storage UI getting broken after being kidnapped due to using a wrong proc ## Why It's Good For The Game There's zero reason as for why it should behave like that other than just making recovery far more annoying. ## Changelog :cl: fix: Your UI no longer breaks after being kidnapped by a contractor qol: Being kidnapped by a contractor no longer dumps all of your boxes and belts /:cl: --- .../traitor/contractor/syndicate_contract.dm | 7 +++++-- .../antagonists/traitor/objectives/kidnapping.dm | 5 +++-- code/modules/mob/inventory.dm | 10 +++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/code/modules/antagonists/traitor/contractor/syndicate_contract.dm b/code/modules/antagonists/traitor/contractor/syndicate_contract.dm index 2c9d45e382d..71ae454df72 100644 --- a/code/modules/antagonists/traitor/contractor/syndicate_contract.dm +++ b/code/modules/antagonists/traitor/contractor/syndicate_contract.dm @@ -102,14 +102,17 @@ if(traitor_data.uplink_handler.contractor_hub.current_contract == src) traitor_data.uplink_handler.contractor_hub.current_contract = null - for(var/obj/item/person_contents as anything in person_sent.gather_belongings()) + for(var/obj/item/person_contents as anything in person_sent.gather_belongings(FALSE, FALSE)) if(ishuman(person_sent)) var/mob/living/carbon/human/human_sent = person_sent if(person_contents == human_sent.w_uniform) continue //So all they're left with are shoes and uniform. if(person_contents == human_sent.shoes) continue - person_sent.transferItemToLoc(person_contents) + var/unequipped = person_sent.temporarilyRemoveItemFromInventory(person_contents) + if (!unequipped) + continue + person_contents.moveToNullspace() victim_belongings.Add(WEAKREF(person_contents)) var/obj/structure/closet/supplypod/extractionpod/pod = source diff --git a/code/modules/antagonists/traitor/objectives/kidnapping.dm b/code/modules/antagonists/traitor/objectives/kidnapping.dm index ea7fef9b4b6..0d4ff5cfd99 100644 --- a/code/modules/antagonists/traitor/objectives/kidnapping.dm +++ b/code/modules/antagonists/traitor/objectives/kidnapping.dm @@ -228,13 +228,14 @@ var/mob/living/carbon/human/sent_mob = entered_atom - for(var/obj/item/belonging in sent_mob.gather_belongings()) + for(var/obj/item/belonging in sent_mob.gather_belongings(FALSE, FALSE)) if(belonging == sent_mob.get_item_by_slot(ITEM_SLOT_ICLOTHING) || belonging == sent_mob.get_item_by_slot(ITEM_SLOT_FEET)) continue - var/unequipped = sent_mob.transferItemToLoc(belonging) + var/unequipped = sent_mob.temporarilyRemoveItemFromInventory(belonging) if (!unequipped) continue + belonging.moveToNullspace() target_belongings.Add(WEAKREF(belonging)) var/datum/market_item/hostage/market_item = sent_mob.process_capture(rand(1000, 3000)) diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 2d22c11ee71..708d8bbdd07 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -586,19 +586,19 @@ hud_used.build_hand_slots() //GetAllContents that is reasonable and not stupid -/mob/living/proc/get_all_gear() - var/list/processing_list = get_equipped_items(INCLUDE_POCKETS | INCLUDE_ACCESSORIES | INCLUDE_HELD) +/mob/living/proc/get_all_gear(accessories = TRUE, recursive = TRUE) + var/list/processing_list = get_equipped_items(INCLUDE_POCKETS | INCLUDE_HELD | (accessories ? INCLUDE_ACCESSORIES : NONE)) list_clear_nulls(processing_list) // handles empty hands var/i = 0 while(i < length(processing_list)) var/atom/A = processing_list[++i] - if(A.atom_storage) + if(A.atom_storage && recursive) processing_list += A.atom_storage.return_inv() return processing_list /// Returns a list of things that the provided mob has, including any storage-capable implants. -/mob/living/proc/gather_belongings() - var/list/belongings = get_all_gear() +/mob/living/proc/gather_belongings(accessories = TRUE, recursive = TRUE) + var/list/belongings = get_all_gear(accessories, recursive) for (var/obj/item/implant/storage/internal_bag in implants) belongings += internal_bag.contents return belongings