onSignal

fun onSignal(signal: AgentSignal, block: StateAction.() -> Unit)(source)

When signal fires while this state (or any substate) is active, run block. If both this state and one of its substates listen to the same signal, the more-specific (deeper) handler wins — only it runs.