mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
* Add new TransportScript::OnRelocate hook.
* TransportScript::OnUpdate is now called on every tick, not just on movement update. --HG-- branch : trunk
This commit is contained in:
@@ -564,20 +564,22 @@ void Transport::Update(uint32 p_diff)
|
||||
}
|
||||
else
|
||||
{
|
||||
Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z, GetAngle(m_next->second.x,m_next->second.y) + 3.1415926f);
|
||||
Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z, GetAngle(m_next->second.x,m_next->second.y) + float(M_PI));
|
||||
UpdateNPCPositions(); // COME BACK MARKER
|
||||
}
|
||||
|
||||
sScriptMgr.OnRelocate(this, m_curr->second.mapid, m_curr->second.x, m_curr->second.y, m_curr->second.z);
|
||||
|
||||
m_nextNodeTime = m_curr->first;
|
||||
|
||||
if (m_curr == m_WayPoints.begin() && (sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES) == 0)
|
||||
sLog.outDetail(" ************ BEGIN ************** %s", this->m_name.c_str());
|
||||
sLog.outDetail(" ************ BEGIN ************** %s", m_name.c_str());
|
||||
|
||||
if ((sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES) == 0)
|
||||
sLog.outDetail("%s moved to %d %f %f %f %d", this->m_name.c_str(), m_curr->second.id, m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid);
|
||||
|
||||
sScriptMgr.OnTransportUpdate(this, p_diff);
|
||||
sLog.outDetail("%s moved to %d %f %f %f %d", m_name.c_str(), m_curr->second.id, m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid);
|
||||
}
|
||||
|
||||
sScriptMgr.OnTransportUpdate(this, p_diff);
|
||||
}
|
||||
|
||||
void Transport::UpdateForMap(Map const* targetMap)
|
||||
|
||||
@@ -1006,6 +1006,12 @@ void ScriptMgr::OnTransportUpdate(Transport* transport, uint32 diff)
|
||||
tmpscript->OnUpdate(transport, diff);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnRelocate(Transport* transport, uint32 mapId, float x, float y, float z)
|
||||
{
|
||||
GET_SCRIPT(TransportScript, transport->GetScriptId(), tmpscript);
|
||||
tmpscript->OnRelocate(transport, mapId, x, y, z);
|
||||
}
|
||||
|
||||
void SpellHandlerScript::RegisterSelf()
|
||||
{
|
||||
ScriptMgr::ScriptRegistry<SpellHandlerScript>::AddScript(this);
|
||||
|
||||
@@ -729,6 +729,9 @@ class TransportScript : public ScriptObject, public UpdatableScript<Transport>
|
||||
|
||||
// Called when a player exits the transport.
|
||||
virtual void OnRemovePassenger(Transport* transport, Player* player) { }
|
||||
|
||||
// Called when a transport moves.
|
||||
virtual void OnRelocate(Transport* transport, uint32 mapId, float x, float y, float z) { }
|
||||
};
|
||||
|
||||
// Placed here due to ScriptRegistry::AddScript dependency.
|
||||
@@ -895,6 +898,7 @@ class ScriptMgr
|
||||
void OnAddCreaturePassenger(Transport* transport, Creature* creature);
|
||||
void OnRemovePassenger(Transport* transport, Player* player);
|
||||
void OnTransportUpdate(Transport* transport, uint32 diff);
|
||||
void OnRelocate(Transport* transport, uint32 mapId, float x, float y, float z);
|
||||
|
||||
public: /* ScriptRegistry */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user