Interface Chip

In Booyah, the game is structured as a tree of chips. This is the interface for all chips. When creating a new chip, you most likely want to extend ChipBase or Composite, which implement this interface and do the busywork for you.

Events:

  • activated()
  • terminated()
interface Chip {
    children: Record<string, Chip>;
    outputSignal: Signal;
    state: ChipState;
    activate(tickInfo, chipContext, inputSignal, reloadMemento?): void;
    emit(type, ...args): void;
    makeReloadMemento(): ReloadMemento;
    off(type, listener): void;
    on(type, listener): void;
    once(type, listener): void;
    pause(tickInfo): void;
    resume(tickInfo): void;
    terminate(outputSignal?): void;
    tick(tickInfo): void;
}

Hierarchy (view full)

Implemented by

Properties

children: Record<string, Chip>

Children of this chip, if any

outputSignal: Signal

Once the chip is terminated, contains the signal

state: ChipState

Current state of the chip

Methods

  • Activate the chip, with a provided context and input signal. Should only be called from an inactive state

    Parameters

    Returns void

  • Parameters

    • type: string
    • listener: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • type: string
    • listener: (() => void)
        • (): void
        • Returns void

    Returns void

  • Pause the chip, informing it that it won't receive ticks for a while

    Parameters

    Returns void

  • Resumes the chip after it was paused

    Parameters

    Returns void

  • Terminate the chip. Should only be called from an active or paused state

    Parameters

    Returns void

  • Update the chip, provided a new time

    Parameters

    Returns void

Generated using TypeDoc