New game works almost as intended, quest system
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "SlotsModule.h"
|
||||
#include "world-build.h"
|
||||
#include "PlayerActionModule.h"
|
||||
#include "QuestModule.h"
|
||||
#include "LuaData.h"
|
||||
#include "lua.hpp"
|
||||
extern "C" {
|
||||
@@ -123,7 +124,7 @@ int LuaData::call_handler(const Ogre::String &event)
|
||||
lua_pushstring(L, event.c_str());
|
||||
lua_pushinteger(L, -1);
|
||||
lua_pushinteger(L, -1);
|
||||
if (lua_pcall(L, 3, 0, 0)) {
|
||||
if (lua_pcall(L, 3, 0, 0) != LUA_OK) {
|
||||
Ogre::LogManager::getSingleton().stream()
|
||||
<< lua_tostring(L, -1);
|
||||
OgreAssert(false, "Lua error");
|
||||
@@ -141,7 +142,7 @@ int LuaData::call_handler(const Ogre::String &event, flecs::entity e,
|
||||
lua_pushstring(L, event.c_str());
|
||||
lua_pushinteger(L, idmap.add_entity(e));
|
||||
lua_pushinteger(L, idmap.add_entity(o));
|
||||
if (lua_pcall(L, 3, 0, 0)) {
|
||||
if (lua_pcall(L, 3, 0, 0) != LUA_OK) {
|
||||
Ogre::LogManager::getSingleton().stream()
|
||||
<< lua_tostring(L, -1);
|
||||
OgreAssert(false, "Lua error");
|
||||
@@ -315,6 +316,14 @@ LuaData::LuaData()
|
||||
return 0;
|
||||
});
|
||||
lua_setglobal(L, "setup_action_handler");
|
||||
lua_pushcfunction(L, [](lua_State *L) -> int {
|
||||
luaL_checktype(L, 1, LUA_TSTRING);
|
||||
luaL_checktype(L, 2, LUA_TTABLE);
|
||||
ECS::get_mut<QuestModule>().addLuaQuest(L);
|
||||
ECS::modified<QuestModule>();
|
||||
return 0;
|
||||
});
|
||||
lua_setglobal(L, "add_quest");
|
||||
lua_pushcfunction(L, [](lua_State *L) -> int {
|
||||
// FIXME
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user