summary refs log tree commit diff stats
path: root/src/script_system.h
blob: 2d099e35c847758003aa08dbdfdf632f39b50641 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef SCRIPT_SYSTEM_H_FD8A95B3
#define SCRIPT_SYSTEM_H_FD8A95B3

#include <sol/sol.hpp>
#include <memory>
#include <set>
#include <string>
#include "system.h"

class Game;

class ScriptSystem : public System {
public:

  static constexpr SystemKey Key = SystemKey::Script;

  explicit ScriptSystem(Game& game);

  void tick(double dt) override;

  void runScript(std::string mapName, std::string scriptName);

  void runDebugScript(std::string script);

private:

  Game& game_;
  sol::state engine_;
  std::unique_ptr<sol::coroutine> callable_;
  std::set<std::string> loadedScripts_;
};

#endif /* end of include guard: SCRIPT_SYSTEM_H_FD8A95B3 */