summary refs log tree commit diff stats
path: root/src/systems/scripting.h
blob: b119c3f314f1f2488eac594cbca1b6e155b3b195 (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
34
#ifndef AUTOMATING_H_E6E5D76E
#define AUTOMATING_H_E6E5D76E

#include "system.h"
#include <sol.hpp>

class ScriptingSystem : public System {
public:

  ScriptingSystem(Game& game);

  void tick(double dt);

  void killScript(id_type entity);

  void startBehavior(id_type entity);

  void stopBehavior(id_type entity);

  void onTouch(id_type entity, id_type player);

private:

  template <typename... Args>
  sol::optional<id_type> runScript(
    std::string table,
    std::string event,
    id_type entity,
    Args&&... args);

  sol::state engine_;
};

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