mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-13 17:14:47 +01:00
df7b3e4c31
## About The Pull Request Fixes #87129 [This change](https://github.com/tgstation/tgstation/pull/87073/files#diff-c8ab5fbc20de60e202b839834b039649cbb69a1c4b99b27a5e467f3889442ccd) added in #87073, passing `invdrop = FALSE` to `doUnEquip`, breaks the behavior of unequipping dropping your items. Because that's what `invdrop` does. If you pass it as `FALSE` it prevents other items from dropping off the mob, intended for like, outfit use / "quick swapping" an item out So I reverted it. Drone tools still seem to work I guess. @SyncIt21 ## Changelog 🆑 Melbert fix: Fixes stuff staying on your body after removing your clothes /🆑
57 lines
1.9 KiB
Plaintext
57 lines
1.9 KiB
Plaintext
/** Holder Loving Component
|
|
*
|
|
* When you drop an object onto a turf it gets moved back into its parent holder
|
|
*
|
|
* Prevents you from force moving the object into any other location that isn't its parent holder
|
|
*/
|
|
/datum/component/holderloving
|
|
/** Item that parent is bound to.
|
|
* We try to keep parent either directly in holder, or in holder's loc if loc is a mob,
|
|
* and warp parent into holder if they go anywhere else.
|
|
*/
|
|
var/atom/holder
|
|
|
|
/datum/component/holderloving/Initialize(holder)
|
|
if(!isitem(parent) || !holder)
|
|
return COMPONENT_INCOMPATIBLE
|
|
src.holder = holder
|
|
|
|
/datum/component/holderloving/RegisterWithParent()
|
|
RegisterSignal(holder, COMSIG_QDELETING, PROC_REF(holder_deleting))
|
|
RegisterSignal(parent, COMSIG_ITEM_DROPPED, PROC_REF(check_my_loc))
|
|
RegisterSignal(parent, COMSIG_ITEM_PRE_UNEQUIP, PROC_REF(can_be_moved))
|
|
|
|
/datum/component/holderloving/UnregisterFromParent()
|
|
UnregisterSignal(holder, list(COMSIG_QDELETING))
|
|
UnregisterSignal(parent, list(COMSIG_ITEM_DROPPED, COMSIG_ITEM_PRE_UNEQUIP))
|
|
|
|
/datum/component/holderloving/proc/holder_deleting(datum/source, force)
|
|
SIGNAL_HANDLER
|
|
|
|
qdel(parent)
|
|
|
|
/datum/component/holderloving/proc/is_valid_location(atom/location)
|
|
SHOULD_BE_PURE(TRUE)
|
|
|
|
if(location == holder || ( location == holder.loc && ismob(holder.loc)))
|
|
return TRUE
|
|
|
|
return FALSE
|
|
|
|
/datum/component/holderloving/proc/check_my_loc(datum/source)
|
|
SIGNAL_HANDLER
|
|
|
|
var/obj/item/item_parent = parent
|
|
if(!is_valid_location(item_parent.loc))
|
|
item_parent.forceMove(holder)
|
|
|
|
/datum/component/holderloving/proc/can_be_moved(obj/item/I, force, atom/newloc, no_move, invdrop, silent)
|
|
SIGNAL_HANDLER
|
|
|
|
//allow the item to be dropped on the turf so it can be later moved back into the holder as a convinience tool
|
|
if(isturf(newloc) || is_valid_location(newloc))
|
|
return NONE
|
|
|
|
//prevent this item from being moved anywhere else
|
|
return COMPONENT_ITEM_BLOCK_UNEQUIP
|