Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[All] Feat: Delegates listeners #57

Copy link
Copy link
@emyfops

Description

@emyfops
Issue body actions

Feature

Delegates on listeners allow for single self-destroyable listeners to exist.
The following code will return the closest entity to the player once the back input key is pressed.

val closestEntity by receiveNext<MovementEvent.InputUpdate, Entity>(
    transform = { getClosestEntity<Entity>(player.eyePos, 7.0) },
) { it.input.pressingBack }

It also allows to listen incoming events in an unorthodox way.
There are no practical uses outside of unsynchronized multi-threading where value loss is acceptable.

val events by listener<TickEvent.Pre>()

Additional Information

No response

Pull Request

  • I will be submitting a pull request

Code of Conduct

  • I agree to follow this project's Code of Conduct
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

featureSuggests or adds a new featureSuggests or adds a new feature

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.