Lightyear setup (#55)

This commit is contained in:
extrawurst
2025-07-10 23:21:11 +02:00
committed by GitHub
parent 691b9eed33
commit 78b09b33d6
26 changed files with 2515 additions and 242 deletions

View File

@@ -0,0 +1,21 @@
use bevy::ecs::{
bundle::Bundle, resource::Resource, system::EntityCommands, world::EntityWorldMut,
};
#[derive(Default, Resource)]
pub struct IsServer;
pub trait CommandExt {
fn insert_server(&mut self, bundle: impl Bundle) -> &mut Self;
}
impl<'w> CommandExt for EntityCommands<'w> {
fn insert_server(&mut self, bundle: impl Bundle) -> &mut Self {
self.queue(|mut entity: EntityWorldMut| {
if entity.world().contains_resource::<IsServer>() {
entity.insert(bundle);
}
});
self
}
}

View File

@@ -1,9 +1,15 @@
pub mod auto_rotate;
pub mod billboards;
pub mod commands;
pub mod explosions;
pub mod observers;
pub mod sprite_3d_animation;
pub mod squish_animation;
pub mod trail;
use bevy::prelude::*;
pub(crate) use observers::global_observer;
pub fn plugin(app: &mut App) {
app.add_plugins(observers::plugin);
}