tinyecs-compsys-base 0.0.1__tar.gz → 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinyecs-compsys-base
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Foundational component and system library for tinyecs
5
5
  Author-email: Michael Lamertz <michael.lamertz@gmail.com>
6
6
  License-Expression: MIT
@@ -15,36 +15,46 @@ License-File: LICENSE
15
15
  Requires-Dist: aenum
16
16
  Requires-Dist: pgcooldown
17
17
  Requires-Dist: tinyecs>=0.5.0
18
+ Requires-Dist: tinyecs-compsys
19
+ Requires-Dist: tinyecs-compsys-base
18
20
  Dynamic: license-file
19
21
 
20
22
  tinyecs-compsys-base
21
23
  ====================
22
24
 
23
- Thise are some very basic and framework independent components.
25
+ These are some very basic and framework independent components.
26
+
27
+ ``tinyecs.compsys.base`` provides a set of components and systems that are
28
+ independent from any graphics framework or backend. These components and
29
+ systems are mostly about entity management. See the API docs for a list.
24
30
 
25
31
  Synopsis
26
32
  --------
27
33
 
28
- .. code:: python
34
+ While this package can be imported directly, the more flexible approach is to
35
+ have ``tinyecs.compsys`` find it and import it with all other ``compsys``
36
+ packages under a common namespace.
29
37
 
30
- from tinyecs.compsys.base import ...
38
+ .. code:: python
31
39
 
32
- Usage
33
- -----
40
+ import tinyecs.compsys as cs
34
41
 
35
- This package has no direct functionality, but all sub modules will register
36
- their component IDs in the ``tinyecs.compsys.Comp`` enum.
42
+ cs.register()
37
43
 
38
44
  Installation
39
45
  ------------
40
46
 
41
- Installation instructions + requirements (should come automagically with
42
- pyproject.toml)
47
+ It's up to you, if you install the currently provided `compsys` packages from
48
+ `tinyecs` by using
43
49
 
44
50
  .. code:: console
45
51
 
46
52
  pip install tinyecs[base]
47
- # or
53
+
54
+ or include them by adding specific dependencies:
55
+
56
+ .. code:: console
57
+
48
58
  pip install tinyecs
49
59
  pip install tinyecs-compsys
50
60
  pip install tinyecs-compsys-base
@@ -54,7 +64,7 @@ Support / Contributing
54
64
 
55
65
  Issues can be opened on `github issues`_
56
66
 
57
- .. _github issues: https://forgejo.indieandmore.photography/dickerdackel/tinyecs-compsys/issues
67
+ .. _github issues: https://github.com/dickerdackel/tinyecs-compsys-base/issues
58
68
 
59
69
 
60
70
  License
@@ -0,0 +1,54 @@
1
+ tinyecs-compsys-base
2
+ ====================
3
+
4
+ These are some very basic and framework independent components.
5
+
6
+ ``tinyecs.compsys.base`` provides a set of components and systems that are
7
+ independent from any graphics framework or backend. These components and
8
+ systems are mostly about entity management. See the API docs for a list.
9
+
10
+ Synopsis
11
+ --------
12
+
13
+ While this package can be imported directly, the more flexible approach is to
14
+ have ``tinyecs.compsys`` find it and import it with all other ``compsys``
15
+ packages under a common namespace.
16
+
17
+ .. code:: python
18
+
19
+ import tinyecs.compsys as cs
20
+
21
+ cs.register()
22
+
23
+ Installation
24
+ ------------
25
+
26
+ It's up to you, if you install the currently provided `compsys` packages from
27
+ `tinyecs` by using
28
+
29
+ .. code:: console
30
+
31
+ pip install tinyecs[base]
32
+
33
+ or include them by adding specific dependencies:
34
+
35
+ .. code:: console
36
+
37
+ pip install tinyecs
38
+ pip install tinyecs-compsys
39
+ pip install tinyecs-compsys-base
40
+
41
+ Support / Contributing
42
+ ----------------------
43
+
44
+ Issues can be opened on `github issues`_
45
+
46
+ .. _github issues: https://github.com/dickerdackel/tinyecs-compsys-base/issues
47
+
48
+
49
+ License
50
+ -------
51
+
52
+ This software is provided under the MIT license.
53
+
54
+ See LICENSE file for details.
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "tinyecs-compsys-base"
3
3
  description = "Foundational component and system library for tinyecs"
4
- version = "0.0.1"
4
+ version = "0.0.2"
5
5
  readme = "README.rst"
6
6
 
7
7
  authors = [
@@ -22,6 +22,8 @@ dependencies = [
22
22
  'aenum',
23
23
  'pgcooldown',
24
24
  'tinyecs >= 0.5.0',
25
+ 'tinyecs-compsys',
26
+ 'tinyecs-compsys-base',
25
27
  ]
26
28
 
27
29
  [project.urls]
@@ -13,6 +13,7 @@ extend_enum(Comp, 'CROND')
13
13
  extend_enum(Comp, 'FOLLOWUP')
14
14
  extend_enum(Comp, 'IS_KILLED')
15
15
  extend_enum(Comp, 'KILL_WITH_PARENT')
16
+ extend_enum(Comp, 'LIFETIME')
16
17
  extend_enum(Comp, 'TIMER')
17
18
 
18
19
 
@@ -20,20 +21,21 @@ extend_enum(Comp, 'TIMER')
20
21
  class Timer:
21
22
  """An optionally repeating timer component.
22
23
 
23
- :param cooldown: The actual timer object
24
+ :param cooldown: Either a pgcooldown.Cooldown object or a number of seconds
24
25
  :param callback: The function to run when the timer fires
25
26
  :param repeat: Decides if the timer is reoccurring
26
27
 
27
28
  The prototype of the callback function is::
28
29
 
29
- def callback()
30
+ def callback() -> None:
31
+ ...
30
32
 
31
33
  .. note:: If ``repeat`` is false, when using :func:`sys_timer`, the
32
34
  component will be removed after it fired.
33
35
  """
34
36
 
35
37
  cooldown: InitVar[float | Cooldown]
36
- callback: Callable[None, []]
38
+ callback: Callable[[], None]
37
39
  repeat: bool = False
38
40
 
39
41
  def __post_init__(self, cooldown: Cooldown | float) -> None:
@@ -54,18 +56,20 @@ def sys_crond(eid: EntityID, crond: CronD) -> None:
54
56
  crond.update()
55
57
 
56
58
 
57
- def sys_followup(eid: EntityID, is_killed: bool, followup: Callable[[], None]) -> None:
59
+ def sys_followup(eid: EntityID, is_killed: bool, followup: Callable[[EntityID], None]) -> None:
58
60
  """Run a followup function after an entity is marked as dead.
59
61
 
60
62
  :param eid: The entity ID
61
- :param is_killed: The boolean flag component to mark this as killed
63
+ :param is_killed: The marker component that indicates that this entity is killed
64
+ The existence of this component alone is sufficient, its value is ignored
62
65
  :param followup: A callback to run
63
66
 
64
67
  The prototype for the callback is::
65
68
 
66
- def callback() -> None
69
+ def callback(eid: EntityID) -> None:
70
+ ...
67
71
 
68
- Once the followup has fired, its component is removed.
72
+ The followup component is removed before the callback is called.
69
73
  """
70
74
 
71
75
  ecs.remove_component(eid, Comp.FOLLOWUP)
@@ -73,7 +77,7 @@ def sys_followup(eid: EntityID, is_killed: bool, followup: Callable[[], None]) -
73
77
 
74
78
 
75
79
  def sys_kill_with_parent(eid: EntityID, parent: EntityID):
76
- """Mark this entity as "killed" if its parent is killed as well.
80
+ """Mark this entity as "killed" if its parent is marked as killed as well.
77
81
 
78
82
  :param eid: The entity ID
79
83
  :param parent: The parent entity to watch
@@ -86,7 +90,7 @@ def sys_kill_with_parent(eid: EntityID, parent: EntityID):
86
90
 
87
91
 
88
92
  def sys_lifetime(eid: EntityID, lifetime: Cooldown) -> None:
89
- """Update position based on a LerpPosition object.
93
+ """Mark the entity as killed if its lifetime has run out.
90
94
 
91
95
  :param eid: The entity ID
92
96
  :param lifetime: A `pgcooldown.Cooldown` instance
@@ -102,14 +106,15 @@ def sys_reap(eid: EntityID, is_killed: bool) -> None:
102
106
  """Remove entities that have a Comp.IS_KILLED component.
103
107
 
104
108
  :param eid: The entity ID
105
- :param is_killed: Exactly that
109
+ :param is_killed: The marker component that indicates that this entity is killed
110
+ The existence of this component alone is sufficient, its value is ignored
106
111
 
107
112
  """
108
113
 
109
114
  ecs.remove_entity(eid)
110
115
 
111
116
 
112
- def sys_timer(eid: EntityID, timer: Cooldown) -> None:
117
+ def sys_timer(eid: EntityID, timer: Timer) -> None:
113
118
  """Run a callback function after a timer runs out.
114
119
 
115
120
  :param eid: The entity ID
@@ -120,7 +125,9 @@ def sys_timer(eid: EntityID, timer: Cooldown) -> None:
120
125
 
121
126
  The prototype for the callback is::
122
127
 
123
- def callback() -> None
128
+ def callback() -> None:
129
+ ...
130
+
124
131
  """
125
132
 
126
133
  if timer.cooldown.cold():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinyecs-compsys-base
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Foundational component and system library for tinyecs
5
5
  Author-email: Michael Lamertz <michael.lamertz@gmail.com>
6
6
  License-Expression: MIT
@@ -15,36 +15,46 @@ License-File: LICENSE
15
15
  Requires-Dist: aenum
16
16
  Requires-Dist: pgcooldown
17
17
  Requires-Dist: tinyecs>=0.5.0
18
+ Requires-Dist: tinyecs-compsys
19
+ Requires-Dist: tinyecs-compsys-base
18
20
  Dynamic: license-file
19
21
 
20
22
  tinyecs-compsys-base
21
23
  ====================
22
24
 
23
- Thise are some very basic and framework independent components.
25
+ These are some very basic and framework independent components.
26
+
27
+ ``tinyecs.compsys.base`` provides a set of components and systems that are
28
+ independent from any graphics framework or backend. These components and
29
+ systems are mostly about entity management. See the API docs for a list.
24
30
 
25
31
  Synopsis
26
32
  --------
27
33
 
28
- .. code:: python
34
+ While this package can be imported directly, the more flexible approach is to
35
+ have ``tinyecs.compsys`` find it and import it with all other ``compsys``
36
+ packages under a common namespace.
29
37
 
30
- from tinyecs.compsys.base import ...
38
+ .. code:: python
31
39
 
32
- Usage
33
- -----
40
+ import tinyecs.compsys as cs
34
41
 
35
- This package has no direct functionality, but all sub modules will register
36
- their component IDs in the ``tinyecs.compsys.Comp`` enum.
42
+ cs.register()
37
43
 
38
44
  Installation
39
45
  ------------
40
46
 
41
- Installation instructions + requirements (should come automagically with
42
- pyproject.toml)
47
+ It's up to you, if you install the currently provided `compsys` packages from
48
+ `tinyecs` by using
43
49
 
44
50
  .. code:: console
45
51
 
46
52
  pip install tinyecs[base]
47
- # or
53
+
54
+ or include them by adding specific dependencies:
55
+
56
+ .. code:: console
57
+
48
58
  pip install tinyecs
49
59
  pip install tinyecs-compsys
50
60
  pip install tinyecs-compsys-base
@@ -54,7 +64,7 @@ Support / Contributing
54
64
 
55
65
  Issues can be opened on `github issues`_
56
66
 
57
- .. _github issues: https://forgejo.indieandmore.photography/dickerdackel/tinyecs-compsys/issues
67
+ .. _github issues: https://github.com/dickerdackel/tinyecs-compsys-base/issues
58
68
 
59
69
 
60
70
  License
@@ -7,5 +7,4 @@ src/tinyecs_compsys_base.egg-info/PKG-INFO
7
7
  src/tinyecs_compsys_base.egg-info/SOURCES.txt
8
8
  src/tinyecs_compsys_base.egg-info/dependency_links.txt
9
9
  src/tinyecs_compsys_base.egg-info/requires.txt
10
- src/tinyecs_compsys_base.egg-info/top_level.txt
11
- tests/test_FIXME.py
10
+ src/tinyecs_compsys_base.egg-info/top_level.txt
@@ -0,0 +1,5 @@
1
+ aenum
2
+ pgcooldown
3
+ tinyecs>=0.5.0
4
+ tinyecs-compsys
5
+ tinyecs-compsys-base
@@ -1,46 +0,0 @@
1
- tinyecs-compsys-base
2
- ====================
3
-
4
- Thise are some very basic and framework independent components.
5
-
6
- Synopsis
7
- --------
8
-
9
- .. code:: python
10
-
11
- from tinyecs.compsys.base import ...
12
-
13
- Usage
14
- -----
15
-
16
- This package has no direct functionality, but all sub modules will register
17
- their component IDs in the ``tinyecs.compsys.Comp`` enum.
18
-
19
- Installation
20
- ------------
21
-
22
- Installation instructions + requirements (should come automagically with
23
- pyproject.toml)
24
-
25
- .. code:: console
26
-
27
- pip install tinyecs[base]
28
- # or
29
- pip install tinyecs
30
- pip install tinyecs-compsys
31
- pip install tinyecs-compsys-base
32
-
33
- Support / Contributing
34
- ----------------------
35
-
36
- Issues can be opened on `github issues`_
37
-
38
- .. _github issues: https://forgejo.indieandmore.photography/dickerdackel/tinyecs-compsys/issues
39
-
40
-
41
- License
42
- -------
43
-
44
- This software is provided under the MIT license.
45
-
46
- See LICENSE file for details.
@@ -1,3 +0,0 @@
1
- aenum
2
- pgcooldown
3
- tinyecs>=0.5.0
@@ -1,12 +0,0 @@
1
- import pytest
2
-
3
- from contextlib import nullcontext as does_not_raise
4
-
5
-
6
- def test_FIXME():
7
- assert True is True
8
- ...
9
-
10
- with pytest.raises(FIXME_ExpectedException_FIXME) as e: # noqa
11
- FIXME_function_expected_to_raise_exception() # noqa
12
- assert 'FIXME_string_expected_in_exception' in str(e.value)