Yogstation 13 - Modules - TypesVar Details - Proc Details

/datum/action/cooldown/spell/touch

Touch Spell

Touch spells are spells which function through the power of an item attack.

Instead of the spell triggering when the caster presses the button, pressing the button will give them a hand object. The spell's effects are cast when the hand object makes contact with something.

To implement a touch spell, all you need is to implement:

However, for added complexity, you can optionally implement:

It is not necessarily to touch any of the core functions, and is (generally) inadvisable unless you know what you're doing

Vars

attached_handRef to the hand we currently have deployed.
can_cast_on_selfIf TRUE, the caster can willingly hit themselves with the hand
draw_messageThe message displayed to the person upon creating the touch hand
drop_messageThe message displayed upon willingly dropping / deleting / cancelling the touch hand before using it
hand_pathTypepath of what hand we create on initial cast.

Procs

can_hit_with_handSignal proc for COMSIG_ITEM_AFTERATTACK_SECONDARY from our attached hand.
cast_on_hand_hitCalls do_secondary_hand_hit() from the caster onto the victim.
create_handCreates a new hand_path hand and equips it to the caster.
do_hand_hitCalls cast_on_hand_hit() from the caster onto the victim. It's worth noting that victim will be guaranteed to be whatever checks are implemented in is_valid_target by this point.
on_antimagic_triggeredCalled whenever our spell is cast, but blocked by antimagic.
on_hand_deletedFor any special casting effects done if the user right-clicks on touch spell instead of left-clicking
on_hand_droppedSignal proc for COMSIG_ITEM_DROPPED from our attached hand.
on_hand_hitSignal proc for COMSIG_ITEM_AFTERATTACK from our attached hand.
on_hand_takenSignal proc for COMSIG_ITEM_OFFER_TAKEN from our attached hand.
register_hand_signalsRegisters all signal procs for the hand.
remove_handUnregisters any signals and deletes the hand currently summoned by the spell.
unregister_hand_signalsUnregisters all signal procs for the hand.

Var Details

attached_hand

Ref to the hand we currently have deployed.

can_cast_on_self

If TRUE, the caster can willingly hit themselves with the hand

draw_message

The message displayed to the person upon creating the touch hand

drop_message

The message displayed upon willingly dropping / deleting / cancelling the touch hand before using it

hand_path

Typepath of what hand we create on initial cast.

Proc Details

can_hit_with_hand

Signal proc for COMSIG_ITEM_AFTERATTACK_SECONDARY from our attached hand.

Same as on_hand_hit, but for if right-click was used on hit. Checks if the passed victim can be cast on by the caster.

cast_on_hand_hit

Calls do_secondary_hand_hit() from the caster onto the victim.

The actual process of casting the spell on the victim from the caster.

Override / extend this to implement casting effects. Return TRUE on a successful cast to use up the hand (delete it) Return FALSE to do nothing and let them keep the hand in hand

create_hand

Creates a new hand_path hand and equips it to the caster.

If the equipping action fails, reverts the cooldown and returns FALSE. Otherwise, registers signals and returns TRUE.

do_hand_hit

Calls cast_on_hand_hit() from the caster onto the victim. It's worth noting that victim will be guaranteed to be whatever checks are implemented in is_valid_target by this point.

Implements checks for antimagic.

on_antimagic_triggered

Called whenever our spell is cast, but blocked by antimagic.

on_hand_deleted

For any special casting effects done if the user right-clicks on touch spell instead of left-clicking

Return SECONDARY_ATTACK_CALL_NORMAL to call the normal cast_on_hand_hit Return SECONDARY_ATTACK_CONTINUE_CHAIN to prevent the normal cast_on_hand_hit from calling, but still use up the hand Return SECONDARY_ATTACK_CANCEL_CHAIN to prevent the spell from being used

Signal proc for [COMSIG_QDELETING] from our attached hand.

If our hand is deleted for a reason unrelated to our spell, unlink it (clear refs) and revert the cooldown

on_hand_dropped

Signal proc for COMSIG_ITEM_DROPPED from our attached hand.

If our caster drops the hand, remove the hand / revert the cast Basically gives them an easy hotkey to lose their hand without needing to click the button

on_hand_hit

Signal proc for COMSIG_ITEM_AFTERATTACK from our attached hand.

When our hand hits an atom, we can cast do_hand_hit() on them.

on_hand_taken

Signal proc for COMSIG_ITEM_OFFER_TAKEN from our attached hand.

Giving a high five with our hand makes it cast

register_hand_signals

Registers all signal procs for the hand.

remove_hand

Unregisters any signals and deletes the hand currently summoned by the spell.

If reset_cooldown_after is TRUE, we will additionally refund the cooldown of the spell. If reset_cooldown_after is FALSE, we will instead just start the spell's cooldown

unregister_hand_signals

Unregisters all signal procs for the hand.