1
0

Added OnTeleportEntity hook for plugins.

Plugins may or may not allow teleport to the new position.
Updated the HookNotify plugin with it.
This commit is contained in:
joshi07
2015-03-05 11:52:42 +01:00
parent d4b505db02
commit f71b1fe799
8 changed files with 81 additions and 12 deletions

View File

@@ -1632,8 +1632,12 @@ void cEntity::TeleportToEntity(cEntity & a_Entity)
void cEntity::TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ)
{
SetPosition(a_PosX, a_PosY, a_PosZ);
m_World->BroadcastTeleportEntity(*this);
// ask the plugins to allow teleport to the new position.
if (!cRoot::Get()->GetPluginManager()->CallHookEntityTeleport(*this, m_LastPos, Vector3d(a_PosX, a_PosY, a_PosZ)))
{
SetPosition(a_PosX, a_PosY, a_PosZ);
m_World->BroadcastTeleportEntity(*this);
}
}