diff --git a/src/init.luau b/src/init.luau index fa19c8c..bbb3393 100644 --- a/src/init.luau +++ b/src/init.luau @@ -1479,6 +1479,8 @@ function World.new() return self end +export type Id = Entity | Pair + export type Pair = number type Item = (self: Query) -> (Entity, T...) @@ -1521,67 +1523,67 @@ export type World = { delete: (self: World, id: Entity) -> (), --- Adds a component to the entity with no value - add: (self: World, id: Entity, component: Entity) -> (), + add: (self: World, id: Entity, component: Id) -> (), --- Assigns a value to a component on the given entity - set: (self: World, id: Entity, component: Entity, data: T) -> (), + set: (self: World, id: Entity, component: Id, data: T) -> (), -- Clears an entity from the world clear: (self: World, id: Entity) -> (), --- Removes a component from the given entity - remove: (self: World, id: Entity, component: Entity) -> (), + remove: (self: World, id: Entity, component: Id) -> (), --- Retrieves the value of up to 4 components. These values may be nil. - get: ((self: World, id: any, Entity) -> A) - & ((self: World, id: Entity, Entity, Entity) -> (A, B)) - & ((self: World, id: Entity, Entity, Entity, Entity) -> (A, B, C)) - & (self: World, id: Entity, Entity, Entity, Entity, Entity) -> (A, B, C, D), + get: ((self: World, id: any, Id) -> A?) + & ((self: World, id: Entity, Id, Id) -> (A?, B?)) + & ((self: World, id: Entity, Id, Id, Id) -> (A?, B?, C?)) + & (self: World, id: Entity, Id, Id, Id, Id) -> (A?, B?, C?, D?), - has: (self: World, ...Entity) -> boolean, + has: (self: World, ...Id) -> boolean, parent: (self: World, entity: Entity) -> Entity, --- Searches the world for entities that match a given query - query: ((self: World, Entity) -> Query) - & ((self: World, Entity, Entity) -> Query) - & ((self: World, Entity, Entity, Entity) -> Query) - & ((self: World, Entity, Entity, Entity, Entity) -> Query) + query: ((self: World, Id) -> Query) + & ((self: World, Id, Id) -> Query) + & ((self: World, Id, Id, Id) -> Query) + & ((self: World, Id, Id, Id, Id) -> Query) & (( self: World, - Entity, - Entity, - Entity, - Entity, - Entity + Id, + Id, + Id, + Id, + Id ) -> Query) & (( self: World, - Entity, - Entity, - Entity, - Entity, - Entity, - Entity + Id, + Id, + Id, + Id, + Id, + Id ) -> Query) & (( self: World, - Entity, - Entity, - Entity, - Entity, - Entity, - Entity, - Entity + Id, + Id, + Id, + Id, + Id, + Id, + Id ) -> Query) & (( self: World, - Entity, - Entity, - Entity, - Entity, - Entity, - Entity, - Entity, - Entity, - ...Entity + Id, + Id, + Id, + Id, + Id, + Id, + Id, + Id, + ...Id ) -> Query), }