[MIRROR] /datum/element/skill_reward attempting to drop "itself" fix (#27214)

* `/datum/element/skill_reward` attempting to drop "itself" fix (#82489)

## About The Pull Request

`src` vs `source` moment.

Plus some minor code cleaup.

## Changelog

🆑 Melbert
fix: Skill rewards should properly be dropped out of unworthy player's
hands
/🆑

* `/datum/element/skill_reward` attempting to drop "itself" fix

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-04-16 12:46:02 +02:00
committed by GitHub
co-authored by MrMelbert
parent e7178a1789
commit 4f50d64667
+4 -3
View File
@@ -24,14 +24,15 @@
if(!LAZYACCESS(modifiers, CTRL_CLICK) && !check_equippable(user)) //Allows other players to drag it around at least.
to_chat(user, span_warning("You feel completely and utterly unworthy to even touch \the [source]."))
return COMPONENT_CANCEL_ATTACK_CHAIN
return NONE
///We check if the item can be equipped, otherwise we drop it.
/datum/element/skill_reward/proc/drop_if_unworthy(datum/source, mob/living/user)
SIGNAL_HANDLER
if(check_equippable(user) | !(source in user.get_equipped_items(include_pockets = TRUE, include_accessories = TRUE)))
return
if(check_equippable(user) || !(source in user.get_equipped_items(include_pockets = TRUE, include_accessories = TRUE)))
return NONE
to_chat(user, span_warning("You feel completely and utterly unworthy to even touch \the [source]."))
user.dropItemToGround(src, TRUE)
user.dropItemToGround(source, TRUE)
return COMPONENT_EQUIPPED_FAILED
/datum/element/skill_reward/proc/check_equippable(mob/living/user)