mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-24 17:10:03 +00:00
Fix docs titles
This commit is contained in:
parent
9af08c0553
commit
1067a17101
5 changed files with 360 additions and 354 deletions
|
@ -9,6 +9,9 @@ The format is based on [Keep a Changelog][kac], and this project adheres to
|
|||
[semver]: https://semver.org/spec/v2.0.0.html
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.2.10] - 2024-09-07
|
||||
|
||||
- `[world]`:
|
||||
- Improved performance for hooks
|
||||
- Changed `world:set` to be idempotent when setting tags
|
||||
|
@ -29,6 +32,7 @@ The format is based on [Keep a Changelog][kac], and this project adheres to
|
|||
- Changed `world:contains()` to return a `boolean` instead of an entity which may or may not exist
|
||||
- Fixed `world:has()` to take the correct parameters
|
||||
|
||||
|
||||
## [0.2.2] - 2024-07-07
|
||||
|
||||
### Added
|
||||
|
|
|
@ -2,40 +2,40 @@
|
|||
|
||||
Jecs. Just an Entity Component System.
|
||||
|
||||
## Properties
|
||||
# Properties
|
||||
|
||||
### World
|
||||
## World
|
||||
```luau
|
||||
jecs.World: World
|
||||
```
|
||||
A world is a container of all ECS data. Games can have multiple worlds but component IDs may conflict between worlds. Ensure to register the same component IDs in the same order for each world.
|
||||
|
||||
### Wildcard
|
||||
## Wildcard
|
||||
```luau
|
||||
jecs.Wildcard: Entity
|
||||
```
|
||||
Builtin component type. This ID is used for wildcard queries.
|
||||
|
||||
### Component
|
||||
## Component
|
||||
```luau
|
||||
jecs.Component: Entity
|
||||
```
|
||||
Builtin component type. Every ID created with [world:component()](world.md#component()) has this type added to it. This is meant for querying every component ID.
|
||||
|
||||
### ChildOf
|
||||
## ChildOf
|
||||
```luau
|
||||
jecs.ChildOf: Entity
|
||||
```
|
||||
Builtin component type. This ID is for creating parent-child hierarchies.
|
||||
|
||||
### Rest
|
||||
## Rest
|
||||
```luau
|
||||
jecs.Rest: Entity
|
||||
```
|
||||
|
||||
## Functions
|
||||
# Functions
|
||||
|
||||
### pair()
|
||||
## pair()
|
||||
```luau
|
||||
function jecs.pair(
|
||||
first: Entity, -- The first element of the pair, referred to as the relationship of the relationship pair.
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
|
||||
A World contains entities which have components. The World is queryable and can be used to get entities with a specific set of components.
|
||||
|
||||
## Functions
|
||||
# Functions
|
||||
|
||||
### drain()
|
||||
## drain()
|
||||
```luau
|
||||
function query:drain(): Query
|
||||
```
|
||||
This function will impede it from being reset when the query is being iterated.
|
||||
|
||||
### next()
|
||||
## next()
|
||||
```luau
|
||||
function query:next(): Query
|
||||
```
|
||||
Get the next result in the query. Drain must have been called beforehand or otherwise it will error.
|
||||
|
||||
### with()
|
||||
## with()
|
||||
```luau
|
||||
function query:with(
|
||||
...: Entity -- The IDs to query with
|
||||
|
@ -45,7 +45,7 @@ for (const [id, position] of world.query(Position).with(Velocity)) {
|
|||
Put the IDs inside of `world:query()` instead if you need the data.
|
||||
:::
|
||||
|
||||
### without()
|
||||
## without()
|
||||
|
||||
```luau
|
||||
function query:without(
|
||||
|
@ -71,7 +71,7 @@ for (const _ of world.query(Position).without(Velocity)) {
|
|||
|
||||
:::
|
||||
|
||||
### replace()
|
||||
## replace()
|
||||
|
||||
```luau
|
||||
function query:replace(
|
||||
|
@ -99,7 +99,7 @@ world
|
|||
:::
|
||||
|
||||
|
||||
### archetypes()
|
||||
## archetypes()
|
||||
```luau
|
||||
function query.archetypes(): { Archetype }
|
||||
```
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
A World contains entities which have components. The World is queryable and can be used to get entities with a specific set of components.
|
||||
|
||||
## Functions
|
||||
# Functions
|
||||
|
||||
### new()
|
||||
## new()
|
||||
```luau
|
||||
function World.new(): World
|
||||
```
|
||||
|
@ -44,7 +44,7 @@ const entity = world.entity();
|
|||
|
||||
:::
|
||||
|
||||
### component()
|
||||
## component()
|
||||
```luau
|
||||
function World:component<T>(): Entity<T> -- The new componen.
|
||||
```
|
||||
|
@ -68,7 +68,7 @@ You should use this when creating components.
|
|||
For example, a Health type should be created using this.
|
||||
:::
|
||||
|
||||
### get()
|
||||
## get()
|
||||
```luau
|
||||
function World:get<T>(
|
||||
entity: Entity, -- The entity
|
||||
|
@ -77,7 +77,7 @@ function World:get<T>(
|
|||
```
|
||||
Returns the data for the component data the corresponding entity, nil if entity does not have the ID or was a tag.
|
||||
|
||||
### has()
|
||||
## has()
|
||||
```luau
|
||||
function World:has(
|
||||
entity: Entity, -- The entity
|
||||
|
@ -88,7 +88,7 @@ Returns whether the entity has the ID.
|
|||
|
||||
:::
|
||||
|
||||
### add()
|
||||
## add()
|
||||
```luau
|
||||
function World:add(
|
||||
entity: Entity, -- The entity
|
||||
|
@ -104,7 +104,7 @@ This function is idempotent, meaning if the entity already has the id, this oper
|
|||
:::
|
||||
|
||||
|
||||
### set()
|
||||
## set()
|
||||
```luau
|
||||
function World:set(
|
||||
entity: Entity, -- The entity
|
||||
|
@ -114,7 +114,7 @@ function World:set(
|
|||
```
|
||||
Adds or changes the entity's component.
|
||||
|
||||
### query()
|
||||
## query()
|
||||
```luau
|
||||
function World:query(
|
||||
...: Entity -- The IDs to query with
|
||||
|
@ -143,7 +143,7 @@ for (const [id, position, velocity] of world.query(Position, Velocity) {
|
|||
Queries are uncached by default, this is generally very cheap unless you have high fragmentation from e.g. relationships.
|
||||
|
||||
:::
|
||||
### target()
|
||||
## target()
|
||||
```luau
|
||||
function World:target(
|
||||
entity: Entity, -- The entity
|
||||
|
@ -157,7 +157,7 @@ This will return a target (second element of a pair) of the entity for the speci
|
|||
|
||||
If there is no pair with specified relationship, it will return nil.
|
||||
|
||||
### parent()
|
||||
## parent()
|
||||
```luau
|
||||
function World:parent(
|
||||
child: Entity -- The child ID to find the parent of
|
||||
|
|
|
@ -1520,8 +1520,10 @@ export type World = {
|
|||
& (<A, B, C>(self: World, id: Entity, Id<A>, Id<B>, Id<C>) -> (A?, B?, C?))
|
||||
& <A, B, C, D>(self: World, id: Entity, Id<A>, Id<B>, Id<C>, Id<D>) -> (A?, B?, C?, D?),
|
||||
|
||||
--- Returns whether the entity has the ID.
|
||||
has: (self: World, entity: Entity, ...Id) -> boolean,
|
||||
|
||||
--- Get parent (target of ChildOf relationship) for entity. If there is no ChildOf relationship pair, it will return nil.
|
||||
parent: (self: World, entity: Entity) -> Entity,
|
||||
|
||||
--- Checks if the world contains the given entity
|
||||
|
|
Loading…
Reference in a new issue