Description
Control Panel is used as an entry point to ECS storages and runner.
API
Commands
Source code in encosy/storage/typings.py
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
__init__(control_panel)
Commands layer to use control panel inside a system
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
control_panel |
required |
Source code in encosy/storage/typings.py
44 45 46 47 48 49 50 51 | |
drop_entities(*components)
Drop entities by components
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*components |
drop entities by components |
()
|
Returns:
| Type | Description |
|---|---|
Commands
|
self |
Source code in encosy/storage/typings.py
67 68 69 70 71 72 73 74 75 76 77 78 79 | |
drop_entities_with_expression(expression)
Drop entities using expression of type (entity: Entity) -> bool
ex
lambda entity: entity[Position].x == 17.0 and entity[Position].y == 21.0 where Position is a component of a given entity
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expression |
Callable[[Any], Any]
|
(Entity) -> True or False |
required |
Returns:
| Type | Description |
|---|---|
Commands
|
self |
Source code in encosy/storage/typings.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
pause_control_panel()
Exits from run at the next tick and prevents tick to be executed until resume_control_panel is called
Returns:
| Type | Description |
|---|---|
Commands
|
self |
Source code in encosy/storage/typings.py
141 142 143 144 145 146 147 148 149 150 151 | |
register_entities(*entities)
Register entities for control panel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*entities |
any entities |
()
|
Returns:
| Type | Description |
|---|---|
Commands
|
self |
Source code in encosy/storage/typings.py
53 54 55 56 57 58 59 60 61 62 63 64 65 | |
resume_control_panel()
Resume run but only after control_panel.run() is called
Returns:
| Type | Description |
|---|---|
Commands
|
self |
Source code in encosy/storage/typings.py
153 154 155 156 157 158 159 160 161 162 | |
schedule_drop_systems(*systems)
Completely remove system, but only after current tick
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*systems |
any callable |
()
|
Returns:
| Type | Description |
|---|---|
Commands
|
self |
Source code in encosy/storage/typings.py
127 128 129 130 131 132 133 134 135 136 137 138 139 | |
start_systems(*systems)
Allows systems to be executed
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*systems |
any callable |
()
|
Returns:
| Type | Description |
|---|---|
Commands
|
self |
Source code in encosy/storage/typings.py
113 114 115 116 117 118 119 120 121 122 123 124 125 | |
stop_systems(*systems)
Prevents systems from executing
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*systems |
any callable |
()
|
Returns:
| Type | Description |
|---|---|
Commands
|
self |
Source code in encosy/storage/typings.py
99 100 101 102 103 104 105 106 107 108 109 110 111 | |
Entities
Bases: list[Entity[T]]
Simple class for typing in systems
def my_system( entities: Entities[Entity[Name]] ): pass
Source code in encosy/storage/typings.py
30 31 32 33 34 35 36 37 38 39 40 | |
Entity
Bases: dict[type, T]
Source code in encosy/storage/typings.py
16 17 18 19 20 21 22 23 24 25 26 27 | |
__init__(*components)
Basic class for storing components by their type
If duplicated types passed no error will be raised instead duplicate value replace existing one
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*components |
Any
|
any items |
()
|
Source code in encosy/storage/typings.py
17 18 19 20 21 22 23 24 25 26 27 | |