Skip to main content

paiagram_core/
vehicle.rs

1//! A [`Vehicle`] is the executor of a [`crate::trip::Trip`]. Each Trip should be executed by a
2//! vehicle. Vehicles contain multiple trips, just like how trips contain multiple entries.
3
4use bevy::ecs::query::QueryData;
5use bevy::prelude::*;
6use moonshine_core::prelude::{MapEntities, ReflectMapEntities};
7
8/// Definition of the Vehicle.
9#[derive(Default, Reflect, Component, MapEntities)]
10#[reflect(Component, MapEntities)]
11#[require(Name)]
12pub struct Vehicle {
13    /// What trips does the vehicle contain
14    #[entities]
15    pub trips: Vec<Entity>,
16}
17
18#[derive(QueryData)]
19pub struct VehicleQuery {
20    name: &'static Name,
21    vehicle: &'static Vehicle,
22}