Skip to main content

Spell Container

The spell_container scene consists of a node of type Node, and is used as a parent node for all individual spell scenes that a unit or interactable has available. The spell_container script contains a few functions.

spell_entrypoint is the function that receives the request that a spell is to be triggered. It then checks whether the spell is known to the unit or interactable, and triggers the spell if it is known.

send_gcd emits a signal that all child nodes listen to, if they are affected by the gcd. This signal causes these child nodes to start the gcd timer.

set_queue disconnects the cd_timer timeout signal to the cast_queued function if it is connected. It then sets the current queued spell ID, and connects the timeout signal of that spells cd_timer to the cast_queued function. This causes the spell queue to be handled when the cd of the queued spell expires, i.e. when it can be cast.

cast_queued attempts to cast queued spells when the current cast finishes, or when the cooldown of the queued spell expires.

This script may be expanded in the future to handle changes made to spells, and handle role swaps.