This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add strong entity typings, add missing types to ECS queries
- Loading branch information
Showing
23 changed files
with
554 additions
and
476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,18 @@ | ||
import { OpaqueType } from '@etherealengine/common/src/interfaces/OpaqueType' | ||
|
||
export type Entity = OpaqueType<'entity'> & number | ||
type FilterComponents<T> = T //extends {isComponent:true} ? T : never | ||
|
||
/** | ||
* Entity or Entity<[]> means an entity that can NOT be used with any component without type errors | ||
* Entity<[Component1, Component2]> means an entity that is typed to ONLY have Component1 and Component2 | ||
*/ | ||
export type Entity<C extends readonly any[] = []> = OpaqueType<'entity'> & | ||
number & { | ||
__components: { | ||
[key in FilterComponents<C>[number]['name']]: true | ||
} & { | ||
[key: string]: true | ||
} | ||
} | ||
|
||
export const UndefinedEntity = 0 as Entity |
Oops, something went wrong.