mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-10 20:46:47 +03:00
Added code (to finish) for executing LUA triggers
This commit is contained in:
parent
0caaab8c52
commit
f0698a3c80
3 changed files with 16 additions and 3 deletions
|
@ -948,12 +948,12 @@ void TestTriggers(short *data, int heavy, int HeavyFlags)
|
|||
if (volume->status == TriggerStatus::TS_OUTSIDE)
|
||||
{
|
||||
volume->status = TriggerStatus::TS_ENTERING;
|
||||
//g_GameScript->ExecuteScript();
|
||||
g_GameScript->ExecuteFunction(volume->onEnter);
|
||||
}
|
||||
else
|
||||
{
|
||||
volume->status = TriggerStatus::TS_INSIDE;
|
||||
//g_GameScript->ExecuteScript();
|
||||
g_GameScript->ExecuteFunction(volume->onInside);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -963,7 +963,7 @@ void TestTriggers(short *data, int heavy, int HeavyFlags)
|
|||
if (volume->status == TriggerStatus::TS_INSIDE)
|
||||
{
|
||||
volume->status = TriggerStatus::TS_LEAVING;
|
||||
//g_GameScript->ExecuteScript();
|
||||
g_GameScript->ExecuteFunction(volume->onLeave);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -427,6 +427,18 @@ void LuaVariables::SetVariable(std::string key, sol::object value)
|
|||
}
|
||||
}
|
||||
|
||||
void GameScript::ExecuteFunction(std::string name)
|
||||
{
|
||||
/*sol::protected_function func = (*m_lua)[name.c_str()];
|
||||
auto r = func();
|
||||
if (WarningsAsErrors && !r.valid())
|
||||
{
|
||||
sol::error err = r;
|
||||
std::cerr << "An error occurred: " << err.what() << "\n";
|
||||
throw std::runtime_error(err.what());
|
||||
}*/
|
||||
}
|
||||
|
||||
static void doCallback(sol::protected_function const & func) {
|
||||
auto r = func();
|
||||
if (WarningsAsErrors && !r.valid())
|
||||
|
|
|
@ -69,6 +69,7 @@ public:
|
|||
|
||||
|
||||
bool ExecuteTrigger(short index);
|
||||
void ExecuteFunction(std::string name);
|
||||
void MakeItemInvisible(short id);
|
||||
std::unique_ptr<GameScriptItemInfo> GetItemById(int id);
|
||||
std::unique_ptr<GameScriptItemInfo> GetItemByName(std::string name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue