From 243bed54ecbc119688803c01eb88eae0157ddc35 Mon Sep 17 00:00:00 2001 From: ulukyn Date: Thu, 25 Aug 2016 18:54:35 +0200 Subject: [PATCH] Added: New getGroundZ lua function --HG-- branch : compatibility-develop --- code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp | 12 ++++++++++++ code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h | 1 + 2 files changed, 13 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 87ee0c44d..578033949 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -519,6 +519,7 @@ void CLuaIHMRyzom::RegisterRyzomFunctions( NLGUI::CLuaState &ls ) LUABIND_FUNC(getCharacterSheetRegionForce), LUABIND_FUNC(getCharacterSheetRegionLevel), LUABIND_FUNC(getRegionByAlias), + LUABIND_FUNC(getGroundZ), LUABIND_FUNC(tell), LUABIND_FUNC(isRingAccessPointInReach), LUABIND_FUNC(updateTooltipCoords), @@ -2614,6 +2615,17 @@ string CLuaIHMRyzom::getRegionByAlias(uint32 alias) return ContinentMngr.getRegionNameByAlias(alias); } + +sint32 CLuaIHMRyzom::getGroundZ(uint32 x, sint32 y) +{ + CVector vect = CVector(x, y, 0); + nlinfo("TEST"); + UserEntity->getCollisionEntity()->snapToGround(vect); + nlinfo("Ground Z of (%d,%d) = %d", x, y, vect.z); + return vect.z; +} + + // *************************************************************************** void CLuaIHMRyzom::tell(const ucstring &player, const ucstring &msg) { diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h index fd570f100..5599941e5 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h @@ -201,6 +201,7 @@ private: static sint getCharacterSheetRegionForce(const std::string &sheet); static sint getCharacterSheetRegionLevel(const std::string &sheet); static std::string getRegionByAlias(uint32 alias); + static sint getGroundZ(uint32 x, sint32 y); // open the window to do a tell to 'player', if 'msg' is not empty, then the message will be sent immediatly // else, current command of the chat window will be replaced with tell 'player' static void tell(const ucstring &player, const ucstring &msg);