feat: implement relationship system
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// ── Relationship ─────────────────────────────────────
|
||||
/**
|
||||
* A relationship definition — like a component, but represents a directed
|
||||
* link between two entities.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const ChildOf = defineRelationship();
|
||||
* world.relate(child, ChildOf, parent);
|
||||
* ```
|
||||
*/
|
||||
export interface RelationshipDef {
|
||||
/** Unique symbol used as the storage key. */
|
||||
readonly _key: symbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a named relationship between entities.
|
||||
*/
|
||||
export function defineRelationship(): RelationshipDef {
|
||||
return { _key: Symbol() };
|
||||
}
|
||||
Reference in New Issue
Block a user