2020-12-18 22:21:10 +00:00
|
|
|
#ifndef MWLUA_LOCALSCRIPTS_H
|
|
|
|
#define MWLUA_LOCALSCRIPTS_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <set>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <components/lua/luastate.hpp>
|
|
|
|
#include <components/lua/scriptscontainer.hpp>
|
|
|
|
|
|
|
|
#include "../mwbase/luamanager.hpp"
|
|
|
|
|
|
|
|
#include "object.hpp"
|
|
|
|
#include "luabindings.hpp"
|
|
|
|
|
|
|
|
namespace MWLua
|
|
|
|
{
|
|
|
|
|
|
|
|
class LocalScripts : public LuaUtil::ScriptsContainer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static std::unique_ptr<LocalScripts> create(LuaUtil::LuaState* lua, const LObject& obj);
|
|
|
|
static void initializeSelfPackage(const Context&);
|
|
|
|
|
2021-04-18 20:09:01 +00:00
|
|
|
MWBase::LuaManager::ActorControls* getActorControls() { return &mData.mControls; }
|
2020-12-18 22:21:10 +00:00
|
|
|
|
|
|
|
struct SelfObject : public LObject
|
|
|
|
{
|
2021-04-13 22:00:51 +00:00
|
|
|
SelfObject(const LObject& obj) : LObject(obj), mIsActive(false) {}
|
2020-12-18 22:21:10 +00:00
|
|
|
MWBase::LuaManager::ActorControls mControls;
|
2021-04-13 22:00:51 +00:00
|
|
|
bool mIsActive;
|
2020-12-18 22:21:10 +00:00
|
|
|
};
|
2021-04-13 22:00:51 +00:00
|
|
|
|
|
|
|
void becomeActive();
|
|
|
|
void becomeInactive();
|
2020-12-18 22:21:10 +00:00
|
|
|
protected:
|
|
|
|
LocalScripts(LuaUtil::LuaState* lua, const LObject& obj);
|
|
|
|
SelfObject mData;
|
2021-04-13 22:00:51 +00:00
|
|
|
private:
|
|
|
|
EngineHandlerList mOnActiveHandlers{"onActive"};
|
|
|
|
EngineHandlerList mOnInactiveHandlers{"onInactive"};
|
2020-12-18 22:21:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // MWLUA_LOCALSCRIPTS_H
|