Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ScriptableController_HS17/src/orxonox/scriptablecontroller/scriptable_controller.h @ 11549

Last change on this file since 11549 was 11549, checked in by kohlia, 6 years ago

Not working yet

File size: 1.2 KB
Line 
1#ifndef SCRIPTABLE_CONTROLLER_H
2#define SCRIPTABLE_CONTROLLER_H
3
4#include <lua.hpp>
5#include <string>
6#include <list>
7#include <map>
8#include <memory>
9#include "scriptable_controller_api.h"
10#include "core/CoreIncludes.h"
11#include "worldentities/WorldEntity.h"
12#include "worldentities/ControllableEntity.h"
13
14struct lua_State;
15
16namespace orxonox
17{
18
19class ScriptableController : public BaseObject, public Tickable
20{
21public:
22    explicit ScriptableController(Context *context);
23
24    int runScript(const std::string &file_path);
25
26    void registerWorldEntity(int id, WorldEntity *obj);
27    void registerControllableEntity(int id, ControllableEntity *obj);
28
29    WorldEntity *getWorldEntityByID(int id) const;
30    ControllableEntity *getControllableEntityByID(int id) const;
31
32    void registerTimeout(std::function<void (void)> callback, double timeout);
33
34    virtual void tick(float dt) override;
35
36private:
37    std::list<std::unique_ptr<ScriptableControllerAPI> > apis_;
38    ControllableEntity *player_; // TODO
39    std::map<int, WorldEntity*> worldEntities_;
40    std::map<int, ControllableEntity*> controllabelEntities_;
41    std::list<std::pair<std::function<void (void)>, float> > timeouts;
42
43    void printLuaError(lua_State *lua);
44};
45
46}
47
48#endif // SCRIPTABLE_CONTROLLER_H
Note: See TracBrowser for help on using the repository browser.