diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-17 15:55:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-17 15:55:37 -0400 |
commit | 90aadf3844386824140a20d7fbb847bc16009a94 (patch) | |
tree | 6f83fce90e71abb22b1a8f3e09c79963b2a34d5d /src/components/runnable.h | |
parent | bc63fa57ced1c7329f7fdcfd168eaf7e290158bc (diff) | |
parent | 86f0106d0523825549f1e74b835688c78a10cf6c (diff) | |
download | therapy-90aadf3844386824140a20d7fbb847bc16009a94.tar.gz therapy-90aadf3844386824140a20d7fbb847bc16009a94.tar.bz2 therapy-90aadf3844386824140a20d7fbb847bc16009a94.zip |
Merge pull request #7 from hatkirby/es-rewrite
The ECS rewrite exceeds the original branch in functionality, so it is time to merge it in.
Diffstat (limited to 'src/components/runnable.h')
-rw-r--r-- | src/components/runnable.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/components/runnable.h b/src/components/runnable.h new file mode 100644 index 0000000..956bfdc --- /dev/null +++ b/src/components/runnable.h | |||
@@ -0,0 +1,51 @@ | |||
1 | #ifndef AUTOMATABLE_H_3D519131 | ||
2 | #define AUTOMATABLE_H_3D519131 | ||
3 | |||
4 | #include "component.h" | ||
5 | #include <sol.hpp> | ||
6 | #include <memory> | ||
7 | #include "entity_manager.h" | ||
8 | |||
9 | class RunnableComponent : public Component { | ||
10 | public: | ||
11 | |||
12 | using id_type = EntityManager::id_type; | ||
13 | |||
14 | /** | ||
15 | * A Lua stack where the entity's script is running. | ||
16 | * | ||
17 | * NOTE: This object is called a thread, but there is no multi-threading going | ||
18 | * on. | ||
19 | * | ||
20 | * @managed_by ScriptingSystem | ||
21 | */ | ||
22 | std::unique_ptr<sol::thread> runner; | ||
23 | |||
24 | /** | ||
25 | * An entry point to the script running in the runner thread. | ||
26 | * | ||
27 | * @managed_by ScriptingSystem | ||
28 | */ | ||
29 | std::unique_ptr<sol::coroutine> callable; | ||
30 | |||
31 | /** | ||
32 | * Whether or not this entity represents a behavior script. A behavior script | ||
33 | * usually does not terminate on its own, and can be terminated at will by | ||
34 | * another system, usually when the automatable entity leaves the active map. | ||
35 | * | ||
36 | * @managed_by ScriptingSystem | ||
37 | */ | ||
38 | bool behavior = false; | ||
39 | |||
40 | /** | ||
41 | * If this is a behavior script, this is the ID of the automatable entity that | ||
42 | * the behavior belongs to. This is required so that the ScriptingSystem can | ||
43 | * notify the automatable entity if the behavior script terminates by itself, | ||
44 | * and that it shouldn't attempt to terminate it. | ||
45 | * | ||
46 | * @managed_by ScriptingSystem | ||
47 | */ | ||
48 | id_type actor; | ||
49 | }; | ||
50 | |||
51 | #endif /* end of include guard: AUTOMATABLE_H_3D519131 */ | ||