summaryrefslogtreecommitdiffstats
path: root/source/cPlugin_NewLua.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-16 17:06:14 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-16 17:06:14 +0200
commit18a99085f468dfcb4ec2d9f93361b23874364d82 (patch)
tree6a610615d559eea98a9af8a2b34bac35a44b4517 /source/cPlugin_NewLua.cpp
parentProper kick reasons! (diff)
downloadcuberite-18a99085f468dfcb4ec2d9f93361b23874364d82.tar
cuberite-18a99085f468dfcb4ec2d9f93361b23874364d82.tar.gz
cuberite-18a99085f468dfcb4ec2d9f93361b23874364d82.tar.bz2
cuberite-18a99085f468dfcb4ec2d9f93361b23874364d82.tar.lz
cuberite-18a99085f468dfcb4ec2d9f93361b23874364d82.tar.xz
cuberite-18a99085f468dfcb4ec2d9f93361b23874364d82.tar.zst
cuberite-18a99085f468dfcb4ec2d9f93361b23874364d82.zip
Diffstat (limited to '')
-rw-r--r--source/cPlugin_NewLua.cpp84
1 files changed, 84 insertions, 0 deletions
diff --git a/source/cPlugin_NewLua.cpp b/source/cPlugin_NewLua.cpp
index 7254bef01..feba602ba 100644
--- a/source/cPlugin_NewLua.cpp
+++ b/source/cPlugin_NewLua.cpp
@@ -531,6 +531,90 @@ bool cPlugin_NewLua::OnWeatherChanged(cWorld * a_World)
+bool cPlugin_NewLua::OnUpdatingSign(
+ cWorld * a_World,
+ int a_BlockX, int a_BlockY, int a_BlockZ,
+ AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4
+)
+{
+ cCSLock Lock(m_CriticalSection);
+ if (!PushFunction("OnUpdatingSign"))
+ {
+ return false;
+ }
+
+ tolua_pushusertype(m_LuaState, (void *)a_World, "cWorld");
+ tolua_pushnumber (m_LuaState, a_BlockX);
+ tolua_pushnumber (m_LuaState, a_BlockY);
+ tolua_pushnumber (m_LuaState, a_BlockZ);
+ tolua_pushstring (m_LuaState, a_Line1.c_str());
+ tolua_pushstring (m_LuaState, a_Line2.c_str());
+ tolua_pushstring (m_LuaState, a_Line3.c_str());
+ tolua_pushstring (m_LuaState, a_Line4.c_str());
+
+ if (!CallFunction(8, 5, "OnUpdatingSign"))
+ {
+ return false;
+ }
+
+ bool bRetVal = (tolua_toboolean( m_LuaState, -5, 0) > 0);
+ if (lua_isstring(m_LuaState, -4))
+ {
+ a_Line1 = tolua_tostring(m_LuaState, -4, "");
+ }
+ if (lua_isstring(m_LuaState, -3))
+ {
+ a_Line2 = tolua_tostring(m_LuaState, -3, "");
+ }
+ if (lua_isstring(m_LuaState, -2))
+ {
+ a_Line3 = tolua_tostring(m_LuaState, -2, "");
+ }
+ if (lua_isstring(m_LuaState, -1))
+ {
+ a_Line4 = tolua_tostring(m_LuaState, -1, "");
+ }
+ return bRetVal;
+}
+
+
+
+
+
+bool cPlugin_NewLua::OnUpdatedSign(
+ cWorld * a_World,
+ int a_BlockX, int a_BlockY, int a_BlockZ,
+ const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4
+)
+{
+ cCSLock Lock(m_CriticalSection);
+ if (!PushFunction("OnUpdatedSign"))
+ {
+ return false;
+ }
+
+ tolua_pushusertype(m_LuaState, (void *)a_World, "cWorld");
+ tolua_pushnumber (m_LuaState, a_BlockX);
+ tolua_pushnumber (m_LuaState, a_BlockY);
+ tolua_pushnumber (m_LuaState, a_BlockZ);
+ tolua_pushstring (m_LuaState, a_Line1.c_str());
+ tolua_pushstring (m_LuaState, a_Line2.c_str());
+ tolua_pushstring (m_LuaState, a_Line3.c_str());
+ tolua_pushstring (m_LuaState, a_Line4.c_str());
+
+ if (!CallFunction(8, 1, "OnUpdatedSign"))
+ {
+ return false;
+ }
+
+ bool bRetVal = (tolua_toboolean( m_LuaState, -1, 0) > 0);
+ return bRetVal;
+}
+
+
+
+
+
cWebPlugin_Lua* cPlugin_NewLua::CreateWebPlugin(lua_State* a_LuaState)
{
cCSLock Lock( m_CriticalSection );