From dd030fa8920d8cf9c863d2ffdcd791edc1749172 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 19 Aug 2013 09:28:22 +0200 Subject: Implemented the OnWorldTick hook. Triggerred for each world every time it ticks, parameters are the cWorld and the previous tick length (a_Dt) --- source/PluginLua.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/PluginLua.cpp') diff --git a/source/PluginLua.cpp b/source/PluginLua.cpp index 62911a31c..5ceae29f9 100644 --- a/source/PluginLua.cpp +++ b/source/PluginLua.cpp @@ -734,6 +734,17 @@ bool cPlugin_NewLua::OnWeatherChanging(cWorld & a_World, eWeather & a_NewWeather +bool cPlugin_NewLua::OnWorldTick(cWorld & a_World, float a_Dt) +{ + cCSLock Lock(m_CriticalSection); + m_LuaState.Call(GetHookFnName(cPluginManager::HOOK_WORLD_TICK), &a_World, a_Dt); + return false; +} + + + + + bool cPlugin_NewLua::HandleCommand(const AStringVector & a_Split, cPlayer * a_Player) { ASSERT(!a_Split.empty()); @@ -908,6 +919,7 @@ const char * cPlugin_NewLua::GetHookFnName(cPluginManager::PluginHook a_Hook) case cPluginManager::HOOK_UPDATING_SIGN: return "OnUpdatingSign"; case cPluginManager::HOOK_WEATHER_CHANGED: return "OnWeatherChanged"; case cPluginManager::HOOK_WEATHER_CHANGING: return "OnWeatherChanging"; + case cPluginManager::HOOK_WORLD_TICK: return "OnWorldTick"; default: return NULL; } // switch (a_Hook) } -- cgit v1.2.3