UiSpellOverlay
The UiSpellOverlay class manages the spell casting preview. When a spell is being cast, it renders a SpellIndicatorModel (circular range indicator) that follows the mouse cursor, and handles the actual spell casting via RPC.
UiSpellOverlay private
Extends UiComponent.
Properties
| Name | Type | Description |
|---|---|---|
ui | Ui | Current Ui instance. Inherited from UiComponent. |
spellId | string \| null | The ID of the spell currently being cast, or null. |
spellIndicatorModel | SpellIndicatorModel \| null | The circular range indicator entity. |
Methods
constructor()
function constructor(ui: Ui): voidInitializes the spell overlay and registers a cameraUpdate listener.
isActive()
function isActive(): booleanReturns true if a spell is currently being cast.
getSpellId()
function getSpellId(): string | nullReturns the ID of the spell being cast.
update()
function update(): voidRepositions the spell indicator to follow the mouse cursor (screen → world → UI coordinates).
startCasting()
function startCasting(spellId: string): voidBegins the casting flow: cancels any existing cast, loads the spell schema, creates a SpellIndicatorModel with the spell's range radius, adds it to the renderer UI layer, and calls update().
castSpell()
function castSpell(): booleanSends a CastSpell RPC with the spell ID, world-space mouse position, and tier 1. Calls cancelCasting() and returns true on success. Returns false if no local player exists.
cancelCasting()
function cancelCasting(): voidRemoves the spell indicator from the renderer and resets internal state.
onCameraUpdate()
function onCameraUpdate(): voidCalls update().