diff options
author | Mattes D <github@xoft.cz> | 2013-12-18 18:57:35 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2013-12-18 18:57:35 +0100 |
commit | d6d42c36ea99170635044c1c156d5388693774f8 (patch) | |
tree | 48d4d4eec9a819d9b83a40969e96cbf8f86ea206 | |
parent | Removed offending tr1/memory header inclusion. (diff) | |
parent | Renamed back EntityAnimation to PlayerAnimation (diff) | |
download | cuberite-d6d42c36ea99170635044c1c156d5388693774f8.tar cuberite-d6d42c36ea99170635044c1c156d5388693774f8.tar.gz cuberite-d6d42c36ea99170635044c1c156d5388693774f8.tar.bz2 cuberite-d6d42c36ea99170635044c1c156d5388693774f8.tar.lz cuberite-d6d42c36ea99170635044c1c156d5388693774f8.tar.xz cuberite-d6d42c36ea99170635044c1c156d5388693774f8.tar.zst cuberite-d6d42c36ea99170635044c1c156d5388693774f8.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/Bindings.cpp | 40 | ||||
-rw-r--r-- | src/Bindings/Bindings.h | 2 | ||||
-rw-r--r-- | src/Bindings/Plugin.h | 2 | ||||
-rw-r--r-- | src/Bindings/PluginLua.cpp | 8 | ||||
-rw-r--r-- | src/Bindings/PluginLua.h | 2 | ||||
-rw-r--r-- | src/Bindings/PluginManager.cpp | 6 | ||||
-rw-r--r-- | src/Bindings/PluginManager.h | 4 | ||||
-rw-r--r-- | src/ClientHandle.cpp | 2 |
8 files changed, 51 insertions, 15 deletions
diff --git a/src/Bindings/Bindings.cpp b/src/Bindings/Bindings.cpp index e46e42aa4..b53b78853 100644 --- a/src/Bindings/Bindings.cpp +++ b/src/Bindings/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/16/13 21:57:34. +** Generated automatically by tolua++-1.0.92 on 12/18/13 16:09:11. */ #ifndef __cplusplus @@ -7444,6 +7444,41 @@ static int tolua_AllToLua_cEntity_AddSpeedZ00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: HandleSpeedFromAttachee of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_HandleSpeedFromAttachee00 +static int tolua_AllToLua_cEntity_HandleSpeedFromAttachee00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + float a_Forward = ((float) tolua_tonumber(tolua_S,2,0)); + float a_Sideways = ((float) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HandleSpeedFromAttachee'", NULL); +#endif + { + self->HandleSpeedFromAttachee(a_Forward,a_Sideways); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HandleSpeedFromAttachee'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: SteerVehicle of class cEntity */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SteerVehicle00 static int tolua_AllToLua_cEntity_SteerVehicle00(lua_State* tolua_S) @@ -30110,7 +30145,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_constant(tolua_S,"HOOK_COLLECTING_PICKUP",cPluginManager::HOOK_COLLECTING_PICKUP); tolua_constant(tolua_S,"HOOK_CRAFTING_NO_RECIPE",cPluginManager::HOOK_CRAFTING_NO_RECIPE); tolua_constant(tolua_S,"HOOK_DISCONNECT",cPluginManager::HOOK_DISCONNECT); - tolua_constant(tolua_S,"HOOK_ENTITY_ANIMATION",cPluginManager::HOOK_ENTITY_ANIMATION); + tolua_constant(tolua_S,"HOOK_PLAYER_ANIMATION",cPluginManager::HOOK_PLAYER_ANIMATION); tolua_constant(tolua_S,"HOOK_EXECUTE_COMMAND",cPluginManager::HOOK_EXECUTE_COMMAND); tolua_constant(tolua_S,"HOOK_EXPLODED",cPluginManager::HOOK_EXPLODED); tolua_constant(tolua_S,"HOOK_EXPLODING",cPluginManager::HOOK_EXPLODING); @@ -31127,6 +31162,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"AddSpeedX",tolua_AllToLua_cEntity_AddSpeedX00); tolua_function(tolua_S,"AddSpeedY",tolua_AllToLua_cEntity_AddSpeedY00); tolua_function(tolua_S,"AddSpeedZ",tolua_AllToLua_cEntity_AddSpeedZ00); + tolua_function(tolua_S,"HandleSpeedFromAttachee",tolua_AllToLua_cEntity_HandleSpeedFromAttachee00); tolua_function(tolua_S,"SteerVehicle",tolua_AllToLua_cEntity_SteerVehicle00); tolua_function(tolua_S,"GetUniqueID",tolua_AllToLua_cEntity_GetUniqueID00); tolua_function(tolua_S,"IsDestroyed",tolua_AllToLua_cEntity_IsDestroyed00); diff --git a/src/Bindings/Bindings.h b/src/Bindings/Bindings.h index 012a8b13a..2fbd53dcc 100644 --- a/src/Bindings/Bindings.h +++ b/src/Bindings/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/16/13 21:57:35. +** Generated automatically by tolua++-1.0.92 on 12/18/13 16:09:11. */ /* Exported function */ diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h index 5cb35ac5a..9a3c2383e 100644 --- a/src/Bindings/Plugin.h +++ b/src/Bindings/Plugin.h @@ -64,7 +64,7 @@ public: virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) = 0; virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer) = 0; virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) = 0; - virtual bool OnEntityAnimation (cEntity & a_Entity, int a_Animation) = 0; + virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) = 0; virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerEating (cPlayer & a_Player) = 0; diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index f27cee76e..0d17c9ce2 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -550,14 +550,14 @@ bool cPluginLua::OnLogin(cClientHandle * a_Client, int a_ProtocolVersion, const -bool cPluginLua::OnEntityAnimation(cEntity & a_Entity, int a_Animation) +bool cPluginLua::OnPlayerAnimation(cPlayer & a_Player, int a_Animation) { cCSLock Lock(m_CriticalSection); bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_ENTITY_ANIMATION]; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_ANIMATION]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Entity, a_Animation, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Player, a_Animation, cLuaState::Return, res); if (res) { return true; @@ -1302,7 +1302,7 @@ const char * cPluginLua::GetHookFnName(int a_HookType) case cPluginManager::HOOK_COLLECTING_PICKUP: return "OnCollectingPickup"; case cPluginManager::HOOK_CRAFTING_NO_RECIPE: return "OnCraftingNoRecipe"; case cPluginManager::HOOK_DISCONNECT: return "OnDisconnect"; - case cPluginManager::HOOK_ENTITY_ANIMATION: return "OnEntityAnimation"; + case cPluginManager::HOOK_PLAYER_ANIMATION: return "OnPlayerAnimation"; case cPluginManager::HOOK_EXECUTE_COMMAND: return "OnExecuteCommand"; case cPluginManager::HOOK_HANDSHAKE: return "OnHandshake"; case cPluginManager::HOOK_KILLING: return "OnKilling"; diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index 188d202e0..e1e274c72 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -61,7 +61,7 @@ public: virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) override; virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer) override; virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) override; - virtual bool OnEntityAnimation (cEntity & a_Entity, int a_Animation) override; + virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) override; virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; virtual bool OnPlayerEating (cPlayer & a_Player) override; diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 12263605f..732da24fa 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -602,16 +602,16 @@ bool cPluginManager::CallHookLogin(cClientHandle * a_Client, int a_ProtocolVersi -bool cPluginManager::CallHookEntityAnimation(cEntity & a_Entity, int a_Animation) +bool cPluginManager::CallHookPlayerAnimation(cPlayer & a_Player, int a_Animation) { - HookMap::iterator Plugins = m_Hooks.find(HOOK_ENTITY_ANIMATION); + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_ANIMATION); if (Plugins == m_Hooks.end()) { return false; } for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnEntityAnimation(a_Entity, a_Animation)) + if ((*itr)->OnPlayerAnimation(a_Player, a_Animation)) { return true; } diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index 09f230475..b69f402c0 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -68,7 +68,7 @@ public: // tolua_export HOOK_COLLECTING_PICKUP, HOOK_CRAFTING_NO_RECIPE, HOOK_DISCONNECT, - HOOK_ENTITY_ANIMATION, + HOOK_PLAYER_ANIMATION, HOOK_EXECUTE_COMMAND, HOOK_EXPLODED, HOOK_EXPLODING, @@ -163,7 +163,7 @@ public: // tolua_export bool CallHookHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum); bool CallHookKilling (cEntity & a_Victim, cEntity * a_Killer); bool CallHookLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username); - bool CallHookEntityAnimation (cEntity & a_Entity, int a_Animation); + bool CallHookPlayerAnimation (cPlayer & a_Player, int a_Animation); bool CallHookPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerEating (cPlayer & a_Player); diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 8a41b5fac..9565fc41f 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1060,7 +1060,7 @@ void cClientHandle::HandlePlayerMoveLook(double a_PosX, double a_PosY, double a_ void cClientHandle::HandleAnimation(char a_Animation) { - if (cPluginManager::Get()->CallHookEntityAnimation(*m_Player, a_Animation)) + if (cPluginManager::Get()->CallHookPlayerAnimation(*m_Player, a_Animation)) { // Plugin disagrees, bail out return; |