Description
Control Panel is used as an entry point to ECS storages and runner.
API
Meta
Source code in encosy/storage/meta.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
add(entity)
abstractmethod
Add entity by any condition
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity |
any |
required |
Returns:
| Type | Description |
|---|---|
self |
Source code in encosy/storage/meta.py
19 20 21 22 23 24 25 26 27 28 29 30 31 | |
get(*types)
abstractmethod
Get entity by types of components
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*types |
components |
()
|
Returns:
| Type | Description |
|---|---|
entities |
Source code in encosy/storage/meta.py
47 48 49 50 51 52 53 54 55 56 57 58 59 | |
query(*args, **kwargs)
abstractmethod
Query entities by any of given arguments
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args |
positional |
()
|
|
**kwargs |
keywords |
{}
|
Returns:
| Type | Description |
|---|---|
entities |
Source code in encosy/storage/meta.py
5 6 7 8 9 10 11 12 13 14 15 16 17 | |
query_expression(expression)
abstractmethod
Query entities by expression
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expression |
any callable |
required |
Returns:
| Type | Description |
|---|---|
self |
Source code in encosy/storage/meta.py
61 62 63 64 65 66 67 68 69 70 71 72 73 | |
remove(entity)
abstractmethod
Remove entity by any condition
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity |
any |
required |
Returns:
| Type | Description |
|---|---|
self |
Source code in encosy/storage/meta.py
33 34 35 36 37 38 39 40 41 42 43 44 45 | |
EntityStorage
SimpleEntityStorage
Bases: EntityStorageMeta
Source code in encosy/storage/entity_storage.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
add(entity)
Add entity to storage
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity |
Entity
|
Any Entity with Any component |
required |
Returns:
| Type | Description |
|---|---|
SimpleEntityStorage
|
self |
Source code in encosy/storage/entity_storage.py
12 13 14 15 16 17 18 19 20 21 22 23 24 | |
get(*types)
Query entities by component types
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*types |
type
|
types of components |
()
|
Returns:
| Type | Description |
|---|---|
Entities[Any]
|
entities with given components |
Source code in encosy/storage/entity_storage.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
query_expression(expression)
Query entities by expression
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expression |
Callable[[Entity], Any]
|
expression of type (Entity) -> True or False |
required |
Returns:
| Type | Description |
|---|---|
Entities[Any]
|
entities |
Source code in encosy/storage/entity_storage.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
remove(entity)
Remove entity from storage works iteratively
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity |
Entity
|
works by comparison of existing entity and new |
required |
Returns:
| Type | Description |
|---|---|
SimpleEntityStorage
|
self |
Source code in encosy/storage/entity_storage.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |