Adds a screentip to items with the disarm attack element. (#86598)

## About The Pull Request
Added a screentip to the element that shields and pillows use for
shoving mobs.

## Why It's Good For The Game
It helps.

## Changelog

🆑
qol: Add a screentip to shields and pillows' right-click function
(shoving people).
/🆑
This commit is contained in:
Ghom
2024-09-15 13:59:20 +02:00
committed by GitHub
parent 2e44894321
commit dfdc621497
+13 -3
View File
@@ -6,13 +6,23 @@
if(!isitem(target))
return ELEMENT_INCOMPATIBLE
RegisterSignal(target, COMSIG_ITEM_ATTACK_SECONDARY, PROC_REF(secondary_attack))
RegisterSignal(target, COMSIG_ATOM_EXAMINE, PROC_REF(examine))
var/obj/item/item = target
RegisterSignal(item, COMSIG_ITEM_ATTACK_SECONDARY, PROC_REF(secondary_attack))
RegisterSignal(item, COMSIG_ATOM_EXAMINE, PROC_REF(examine))
item.item_flags |= ITEM_HAS_CONTEXTUAL_SCREENTIPS
RegisterSignal(item, COMSIG_ITEM_REQUESTING_CONTEXT_FOR_TARGET, PROC_REF(add_item_context))
/datum/element/disarm_attack/Detach(datum/source)
UnregisterSignal(source, list(COMSIG_ATOM_EXAMINE, COMSIG_ITEM_ATTACK_SECONDARY))
UnregisterSignal(source, list(COMSIG_ATOM_EXAMINE, COMSIG_ITEM_ATTACK_SECONDARY, COMSIG_ITEM_REQUESTING_CONTEXT_FOR_TARGET))
return ..()
/datum/element/disarm_attack/proc/add_item_context(obj/item/source, list/context, atom/target, mob/living/user)
SIGNAL_HANDLER
if(!isliving(target) || !can_disarm_attack(source, target, user, FALSE))
return NONE
context[SCREENTIP_CONTEXT_RMB] = "Shove"
return CONTEXTUAL_SCREENTIP_SET
/datum/element/disarm_attack/proc/secondary_attack(obj/item/source, mob/living/victim, mob/living/user, params)
SIGNAL_HANDLER
if(!user.can_disarm(victim) || !can_disarm_attack(source, victim, user))