UNPKG

@rbxts/mechanism

Version:

An elegant composable input library for Roblox

35 lines (34 loc) 1.79 kB
import Signal from "@rbxts/lemon-signal"; import { BaseAction } from "./base-action"; import { type RawInput } from "./common"; export declare abstract class BaseStandardAction extends BaseAction { readonly activated: Signal<() => void>; readonly deactivated: Signal<() => void>; readonly isActive: boolean; protected activate(this: Writable<BaseStandardAction>): void; protected deactivate(this: Writable<BaseStandardAction>): void; } export declare abstract class StandardAction extends BaseStandardAction { readonly rawInputs: RawInput[]; readonly inputQueueing: boolean; readonly cooldown: number; private lastPress; private lastRelease; private queuedPresses; private queuedReleases; constructor(...rawInputs: RawInput[]); /** @hidden */ handleInput(input: InputObject, processed: boolean, isPress?: boolean): void; protected supportsInput(input: InputObject): boolean; protected rawInputMatches(rawInput: RawInput, input: InputObject): boolean; } export declare class StandardActionBuilder extends StandardAction { /** Sets the ID of the action */ setID(this: Writable<StandardActionBuilder>, id: string | number): StandardActionBuilder; /** Sets whether the action is activated when gameProcessedEvent is true */ setProcessed(this: Writable<StandardActionBuilder>, processed: boolean): StandardActionBuilder; /** Sets whether inputs pressed while cooldown is active are queued to be activated when the cooldown is over */ setInputQueueing(this: Writable<StandardActionBuilder>, inputQueueing: boolean): StandardActionBuilder; /** Sets a time to wait between each activation of the action */ setCooldown(this: Writable<StandardActionBuilder>, cooldown: number): StandardActionBuilder; }