Open MaxCWhitehead opened 2 days ago
Seems to fix if change Resources::contains
to do:
pub fn contains<T: HasSchema>(&self) -> bool {
self.untyped.contains(T::schema().id())
}
instead of:
pub fn contains<T: HasSchema>(&self) -> bool {
self.untyped.resources.contains_key(&T::schema().id())
}
world.get_resource
does this:self.untyped.get()
This inserts the the schema id intoOnceMap
, with contents being empty.init_resource
does:and
contains
only checks if ID is contained - not if resource has a value. This skips the init branch, and only callsself.resource_mut
which panics on missing resource value.This is the only place in bones that
contains
is used, I think we should update this to check if the resource has a value, and not just ID entry in map. This is what I would expect when using the function as well.