Eduardo170
Well-Known Member
I don't know if inside TFS 1.3 it has a function to get the light of the game and determine if it is day or night. I want to use for a script.
int LuaScriptInterface::luaGetWorldLight(lua_State* L)
{
//getWorldLight()
LightInfo lightInfo = g_game.getWorldLightInfo();
lua_pushnumber(L, lightInfo.level);
lua_pushnumber(L, lightInfo.color);
return 2;
}
Looking at the sources, I'm not seeing it. Internally the function is called Game::getWorldLightInfo. It should just be basic busywork to expose it via a Lua binding.
Relevant area is here.
//getWorldTime()
lua_register(luaState, "getWorldTime", LuaScriptInterface::luaGetWorldTime);
//getWorldLight()
lua_register(luaState, "getWorldLight", LuaScriptInterface::luaGetWorldLight);
//getWorldUpTime()
lua_register(luaState, "getWorldUpTime", LuaScriptInterface::luaGetWorldUpTime);