ava-cassiopeia / gdscript-signals

Helper class for Godot 4.x which provides common helpers for dealing with multiple signals like Promise.all() or Promise.any() in other languages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GDScript Signals

A Godot 4.x plugin which provides a Signals class which exposes static functions for interacting with lists of Signals, like Promise.all() in JavaScript.

View in Godot Asset Library

Usage

After importing and enabling the plugin, use one of the static methods attached to Signals detailed below.

all(signals_list)->Array

Given a list of Signals, waits until all of the signals complete, then returns an array of the results from the signals, matching the order the signals were passed in.

Example:

var results := await Signals.all([
	weapon.target_was_hit,
	weapon.animation_complete
])

any(signals_list)

Given a list of Signals, waits until at least one of those signals completes, returning the result of that completed signal.

Example:

var result = await Signals.any([
	target.damage_taken,
	bullet.expired
])

Contributing

Feel free to send pull requests or issues. This repository is a complete Godot 4.x project, so it can be imported locally for development.

Note: This repo comes with Gut unit tests, please make sure to add new test coverage and check existing tests when adding or changing code.

About

Helper class for Godot 4.x which provides common helpers for dealing with multiple signals like Promise.all() or Promise.any() in other languages.

License:MIT License


Languages

Language:GDScript 100.0%