🛠️ Moonshine Utilities
Collection of utilities for Bevy.
Features
Expect<T>
A decorator for QueryData which panics if it doesn't match.
This helps avoid silent failures in systems due to missing components:
use *;
use Expect;
;
;
HierarchyQuery
A convenient SystemParam for traversing and querying entity hierarchies:
use *;
use HierarchyQuery;
;
;
Some useful functions include:
fn parent(&self, Entity) -> Option<Entity>fn has_parent(&self, Entity) -> boolfn children(&self, Entity) -> Iterator<Item = Entity>fn has_children(&self, Entity) -> boolfn root(&self, Entity) -> Entityfn is_root(&self, Entity) -> boolfn ancestors(&self, Entity) -> Iterator<Item = Entity>fn descendants(&self, Entity) -> Iterator<Item = Entity>fn is_ancestor_of(&self, Entity, Entity) -> boolfn is_descendant_of(&self, Entity, Entity) -> boolfn find_ancestor<T, F>(&self, Entity, &Query<T, F>) -> Option<QueryItem<T>>fn find_descendant<T, F>(&self, Entity, &Query<T, F>) -> Option<QueryItem<T>>
See code documentation for complete details.
RunSystemLoop
A trait similar to RunSystemOnce which allows you to run a system loop for testing purposes:
use *;
use RunSystemLoop;
let mut world = new;
let outputs = world.run_system_loop;
assert_eq!;
assert!;
assert!;
Utility Systems
A collection of simple and generic systems useful for constructing larger system pipelines:
has_event<T: Event>() -> boolhas_resource<T: Resource>() -> boolremove_resource<T: Resource>(Commands)remove_resource_immediate<T: Resource>(&mut World)
See code documentation for usage examples.
Support
Please post an issue for any bugs, questions, or suggestions.
You may also contact me on the official Bevy Discord server as @Zeenobit.