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
}
}