fix: finally removed the storage.rsin the comet_ecs

This commit is contained in:
lisk77 2025-03-05 08:39:57 +01:00
parent 7b6ccbe72c
commit cae678747f
8 changed files with 45 additions and 10 deletions

View file

@ -1,5 +1,5 @@
use std::collections::HashMap;
use crate::ComponentSet;
use comet_structs::ComponentSet;
#[derive(Debug, Clone)]
pub struct Archetypes {

View file

@ -1,4 +1,3 @@
pub use storage::*;
pub use entity::*;
pub use component::*;
pub use world::*;
@ -6,7 +5,6 @@ pub use id::*;
pub use component_derive::*;
pub use comet_math as math;
mod storage;
mod entity;
mod component;
mod world;

View file

@ -6,11 +6,10 @@ use crate::{
Transform2D,
Transform3D,
IdQueue,
Archetypes,
ComponentSet
};
use comet_log::*;
use comet_structs::*;
use crate::archetypes::Archetypes;
#[derive(Clone)]
pub struct World {
@ -206,10 +205,10 @@ impl World {
/// Returns a list of entities that have the given components.
pub fn get_entities_with(&self, components: ComponentSet) -> Vec<u32> {
error!("The given components {:?} are not registered in the world!", components);
if self.archetypes.contains_archetype(&components) {
return self.archetypes.get_archetype(&components).unwrap().clone();
}
error!("The given components {:?} are not registered in the world!", components);
Vec::new()
}
}