annotation OnSignal

Overview

Declaratively binds a method inside a node or gmodule block as a compile-time typed Proc listener in Lapis::Core::StaticSignalTable.

node Player < CharacterBody3D do
  signal health_changed(new_health : Int32, max_health : Int32)
  signal died

  @[OnSignal(:health_changed)]
  def on_health_changed(hp : Int32, max : Int32) : Void
  end

  @[OnSignal(:died, once: true)]
  def on_died : Void
  end
end

Defined in:

libgodot/macros/annotations.cr