summary refs log tree commit diff stats
path: root/src/components/realizable.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-05-10 19:27:59 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-05-17 15:39:39 -0400
commit4bbfeae42a1245b1b84e8847787d7643e6a6f2cf (patch)
tree8dd65d9ab0cfffd0e79f670c94b035c5eebfa934 /src/components/realizable.h
parent67b24a8ddd89371cfb944c5b441c852f0edc23b1 (diff)
downloadtherapy-4bbfeae42a1245b1b84e8847787d7643e6a6f2cf.tar.gz
therapy-4bbfeae42a1245b1b84e8847787d7643e6a6f2cf.tar.bz2
therapy-4bbfeae42a1245b1b84e8847787d7643e6a6f2cf.zip
Started integrating Lua as a scripting engine
Currently moving platforms are able to have their movement controlled by a script rather than by XML, which is probably a better implementation and scales better to other things. The scripts, instead of using the components as state, use the stack as state. In this way, they pretend to be multithreaded. For instance, the moving platform calls moveRight and then moveLeft. Both of those functions internally make calls that say to wait until the next tick. When the AutomatingSystem ticks, it continues execution of all scripts (sequentially, of course) until they ask for the next tick again. This is implemented using coroutines.
Diffstat (limited to 'src/components/realizable.h')
-rw-r--r--src/components/realizable.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/components/realizable.h b/src/components/realizable.h index b749aeb..bc834a2 100644 --- a/src/components/realizable.h +++ b/src/components/realizable.h
@@ -4,6 +4,7 @@
4#include "component.h" 4#include "component.h"
5#include <set> 5#include <set>
6#include <map> 6#include <map>
7#include <sol.hpp>
7#include "entity_manager.h" 8#include "entity_manager.h"
8#include "vector.h" 9#include "vector.h"
9 10
@@ -69,6 +70,8 @@ public:
69 * The entity ID of the currently active player. 70 * The entity ID of the currently active player.
70 */ 71 */
71 id_type activePlayer; 72 id_type activePlayer;
73
74 sol::state scriptEngine;
72}; 75};
73 76
74#endif /* end of include guard: REALIZABLE_H_36D8D71E */ 77#endif /* end of include guard: REALIZABLE_H_36D8D71E */