From 28da5ab719b0a0ac06f3d7176fe3510f090c36fb Mon Sep 17 00:00:00 2001 From: warriorstar-orion Date: Mon, 30 Dec 2024 15:00:53 -0500 Subject: [PATCH] fix flayers inability to deploy swarmprod --- .../mind_flayer/powers/flayer_weapon_powers.dm | 5 ++--- code/modules/mob/inventory_procs.dm | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/code/modules/antagonists/mind_flayer/powers/flayer_weapon_powers.dm b/code/modules/antagonists/mind_flayer/powers/flayer_weapon_powers.dm index 8095a9799ddf..f7b32b24dba8 100644 --- a/code/modules/antagonists/mind_flayer/powers/flayer_weapon_powers.dm +++ b/code/modules/antagonists/mind_flayer/powers/flayer_weapon_powers.dm @@ -38,7 +38,7 @@ create_new_weapon() weapon_ref.flags |= (ABSTRACT | NODROP) // Just in case the item doesn't start with both of these, or somehow loses them. - if(!user.drop_item() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) + if(HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || (user.get_active_hand() && !user.drop_item())) flayer.send_swarm_message("We cannot manifest [weapon_ref] into our active hand...") return FALSE @@ -53,8 +53,7 @@ SIGNAL_HANDLER // COMSIG_MOB_WILLINGLY_DROP + COMSIG_FLAYER_RETRACT_IMPLANTS if(!any_hand && !istype(owner.get_active_hand(), weapon_type)) return - INVOKE_ASYNC(owner, TYPE_PROC_REF(/mob, drop_item_to_ground), weapon_ref, TRUE) - INVOKE_ASYNC(weapon_ref, TYPE_PROC_REF(/atom/movable, forceMove), owner) // Just kinda shove it into the user + owner.transfer_item_to(weapon_ref, owner, force = TRUE, silent = TRUE) owner.update_inv_l_hand() owner.update_inv_r_hand() playsound(get_turf(owner), 'sound/mecha/mechmove03.ogg', 25, TRUE, ignore_walls = FALSE) diff --git a/code/modules/mob/inventory_procs.dm b/code/modules/mob/inventory_procs.dm index 41c0f3228ba8..6f886977818d 100644 --- a/code/modules/mob/inventory_procs.dm +++ b/code/modules/mob/inventory_procs.dm @@ -164,7 +164,16 @@ /** * Unequip `target` and drop it at our current location. * - * Returns FALSE if the unequip failed, and `target` if it succeeded. + * Returns `FALSE` if the unequip failed, and `target` if it succeeded. Returns + * `FALSE` if there is no target to drop. If the caller cares about handling the + * resultant dropped object, they are responsible for ensuring that the thing + * actually exists. This is to ensure that the return value is meaningful and that + * a nonexistant item being unequipped and returning null is not interpreted as + * a failure. + * + * However, if you don't care about the return value, feel free to pass in possibly + * nonexistant objects, such as when dropping anything in a slot for a spell/virus + * that replaces existing clothing. */ /mob/proc/drop_item_to_ground(obj/item/target, force = FALSE, silent = FALSE, drop_inventory = TRUE) if(isnull(target)) @@ -179,6 +188,8 @@ /** * Unequip `target` and relocate it to `destination`. + * + * Returns `FALSE` if the transfer failed for any reason, and `TRUE` if it succeeded. */ /mob/proc/transfer_item_to(obj/item/target, atom/destination, force = FALSE, silent = TRUE) return unequip_to(target, destination, force, silent, no_move = FALSE) @@ -186,6 +197,8 @@ /** * Unequip `target` without relocating it. * + * Returns `FALSE` if the transfer failed for any reason, and `TRUE` if it succeeded. + * * A destination cannot be specified; you must either `forceMove` or `qdel` it. * If you intend to `qdel` it immediately, it is not necessary to call this; * [/obj/item/proc/Destroy] will perform the necessary unequipping.