mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 17:52:36 +00:00
* Refactors most spans into span procs * AA * a * AAAAAAAAAAAAAAAAAAAAAA * Update species.dm Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Gandalf <jzo123@hotmail.com>
36 lines
1.2 KiB
Plaintext
36 lines
1.2 KiB
Plaintext
/// You can only hold whitelisted items
|
|
/datum/component/itempicky
|
|
can_transfer = TRUE
|
|
/// Typecache of items you can hold
|
|
var/whitelist
|
|
/// Message shown if you try to pick up an item not in the whitelist
|
|
var/message = "You don't like %TARGET, why would you hold it?"
|
|
|
|
/datum/component/itempicky/Initialize(whitelist, message)
|
|
if(!ismob(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
src.whitelist = whitelist
|
|
if(message)
|
|
src.message = message
|
|
|
|
/datum/component/itempicky/RegisterWithParent()
|
|
RegisterSignal(parent, COMSIG_LIVING_TRY_PUT_IN_HAND, .proc/particularly)
|
|
|
|
/datum/component/itempicky/UnregisterFromParent()
|
|
UnregisterSignal(parent, COMSIG_LIVING_TRY_PUT_IN_HAND)
|
|
|
|
/datum/component/itempicky/PostTransfer()
|
|
if(!ismob(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
/datum/component/itempicky/InheritComponent(datum/component/itempicky/friend, i_am_original, list/arguments)
|
|
if(i_am_original)
|
|
whitelist = friend.whitelist
|
|
message = friend.message
|
|
|
|
/datum/component/itempicky/proc/particularly(datum/source, obj/item/pickingup)
|
|
SIGNAL_HANDLER
|
|
if(!is_type_in_typecache(pickingup, whitelist))
|
|
to_chat(source, span_warning("[replacetext(message, "%TARGET", pickingup)]"))
|
|
return COMPONENT_LIVING_CANT_PUT_IN_HAND
|