Skip to content

Commit

Permalink
[MIRROR] /datum/element/skill_reward attempting to drop "itself" fix (
Browse files Browse the repository at this point in the history
#2766)

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

## About The Pull Request

`src` vs `source` moment. 

Plus some minor code cleaup. 

## Changelog

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

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

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: MrMelbert <[email protected]>
  • Loading branch information
3 people authored Apr 7, 2024
1 parent c37d0a6 commit ed471ad
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions code/datums/elements/skill_reward.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ed471ad

Please sign in to comment.