Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event source location tracking #16778

Merged

Conversation

SpecificProtagonist
Copy link
Contributor

@SpecificProtagonist SpecificProtagonist commented Dec 12, 2024

Objective

Fixes #16776

Solution

  • reflect &'static Location as an opaque type
    • I've added this to impls/std.rs because other core types are there too. Maybe they should be split out into a core.rs in another PR.
  • add source location to EventId (behind the tracking_change_detection feature flag)

Testing


Showcase

fn apply_damage_to_health(
    mut dmg_events: EventReader<DealDamage>,
) {
    for (event, event_id) in dmg_events.read_with_id() {
        info!(
            "Applying {} damage, triggered by {}",
            event.amount, event_id.caller
        );
2024-12-12T01:21:50.126827Z  INFO event: Applying 9 damage, triggered by examples/ecs/event.rs:47:16

Migration Guide

  • If you manually construct a SendEvent, use SendEvent::new()

}
}

impl PartialReflect for &'static Location<'static> {
Copy link
Member

Choose a reason for hiding this comment

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

Oooh, nice.

@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 M-Needs-Release-Note Work that should be called out in the blog due to impact labels Dec 12, 2024
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.

Delightful. I hope we can get all of these shipped for 0.16 :D

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it A-Diagnostics Logging, crash handling, error reporting and performance analysis labels Dec 12, 2024
@NthTensor NthTensor added this to the 0.16 milestone Dec 12, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Dec 12, 2024
Merged via the queue into bevyengine:main with commit b2d3371 Dec 12, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Diagnostics Logging, crash handling, error reporting and performance analysis A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Needs-Release-Note Work that should be called out in the blog due to impact S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Event Source Tracking
4 participants