# 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.