feat: add support for data-carrying relationships
Introduce the ability to attach optional data payloads to relationships. This includes: - Updating `defineRelationship` to accept default values. - Adding `getRelData` and `setRelData` to the `World` class. - Allowing `relate` to accept an optional data override. - Updating serialization to include relationship data in snapshots. - Implementing lazy storage for relationship data using `SparseSet`.
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
export interface WorldSnapshot {
|
||||
/** Entity stable ID → component map (component name → data). */
|
||||
entities: Record<string, Record<string, unknown>>;
|
||||
/** Relationship name → (source ID → target ID). */
|
||||
relationships: Record<string, Record<string, string>>;
|
||||
/** Relationship name → (source ID → target ID or edge object). */
|
||||
relationships: Record<
|
||||
string,
|
||||
Record<string, string | { target: string; data: unknown }>
|
||||
>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user