Skip to content

Add EventProcessor SystemParam that gives mutable access to events#8051

Closed
tim-blackbird wants to merge 3 commits intobevyengine:mainfrom
tim-blackbird:event-processing
Closed

Add EventProcessor SystemParam that gives mutable access to events#8051
tim-blackbird wants to merge 3 commits intobevyengine:mainfrom
tim-blackbird:event-processing

Conversation

@tim-blackbird
Copy link
Contributor

Objective

Allow events to be modified 'in-flight'.

Solution

Add a new EventProcessor SystemParam that contains ResMut<Events<E>> that gives an iterator over mutable references to the events.

New code is 95% identical to the existing immutable code, but I'm not sure if a macro is warranted to reduce code duplication.

Changelog

  • Added EventProcessor
  • Added iter_mut and iter_mut_with_id to ManualEventReader

@tim-blackbird tim-blackbird changed the title Add EventProcessor SystemParam for modifying events Add EventProcessor SystemParam that gives mutable access to events Mar 18, 2023
@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Sep 29, 2023
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it! I think we should link to this (and its siblings) from the Events docs somehow, but I won't block on it.

@ItsDoot
Copy link
Contributor

ItsDoot commented Dec 12, 2024

This is available as EventMutator since #13818.

@ItsDoot ItsDoot closed this Dec 12, 2024
@tim-blackbird tim-blackbird deleted the event-processing branch December 12, 2024 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants