Skip to content

Commit

Permalink
fix flayers inability to deploy swarmprod
Browse files Browse the repository at this point in the history
  • Loading branch information
warriorstar-orion committed Dec 30, 2024
1 parent 84cb022 commit 28da5ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
15 changes: 14 additions & 1 deletion code/modules/mob/inventory_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -179,13 +188,17 @@

/**
* 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)

/**
* 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.
Expand Down

0 comments on commit 28da5ab

Please sign in to comment.