From 9890cbf428b6216b05de02805c77c45d7b0983ab Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 21 Feb 2021 23:46:37 -0500 Subject: Multiple scripts can be run at once And they're all on their own threads again. This is mostly so debug commands can be run during execution of other scripts. But it can also be useful for map init scripts (if we want a script to run whenever a map is loaded, even though map loading is usually done by a script). --- src/script_system.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/script_system.h') diff --git a/src/script_system.h b/src/script_system.h index 2d099e3..18850b3 100644 --- a/src/script_system.h +++ b/src/script_system.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "system.h" @@ -24,9 +25,14 @@ public: private: + struct Script { + std::unique_ptr runner; + std::unique_ptr callable; + }; + Game& game_; sol::state engine_; - std::unique_ptr callable_; + std::list