Replace event derives with message derives

This commit is contained in:
2025-10-03 12:39:29 -05:00
parent cfe35c61ed
commit 7bd88c702f

View File

@@ -6,15 +6,15 @@ use crate::objects::AsteroidSize;
///
/// Produced by the [`fn collision_listener(...)`](`crate::physics::collision_listener`)
/// system when the player collides with an asteroid. They are consumed by [`fn ship_impact_listener(...)`](`crate::objects::ship_impact_listener`).
#[derive(Event)]
#[derive(Message)]
pub(crate) struct ShipDestroy;
/// Signals that a particular asteroid has been destroyed.
///
/// Produced by the [`fn collision_listener(...)`](`crate::physics::collision_listener`)
/// system when bullets contact asteroids. It is consumed by [`fn split_asteroid(...)`](`crate::objects::spawn_asteroid`)
/// system, which re-emits [spawn events](`SpawnAsteroid`).
#[derive(Event)]
/// system, which re-emits [spawn messages](`SpawnAsteroid`).
#[derive(Message)]
pub(crate) struct AsteroidDestroy(pub Entity);
/// Signals that an asteroid needs to be spawned and provides the parameters
@@ -22,7 +22,7 @@ pub(crate) struct AsteroidDestroy(pub Entity);
///
/// Produced by the [`tick_asteroid_manager(...)`](`crate::machinery::tick_asteroid_manager`)
/// system and consumed by the [`spawn_asteroid(...)`](`crate::objects::spawn_asteroid`) system.
#[derive(Event)]
#[derive(Message)]
pub struct SpawnAsteroid {
pub pos: Vec2,
pub vel: Vec2,
@@ -32,5 +32,5 @@ pub struct SpawnAsteroid {
/// Signals that a particular bullet has been destroyed (after it strikes an Asteroid).
///
/// TODO: Maybe use it for lifetime expiration (which is also a TODO item).
#[derive(Event)]
#[derive(Message)]
pub(crate) struct BulletDestroy(pub Entity);