mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 10:56:38 +01:00
[svn] * Allow WorldObjects to keep the grid active, and prevent it from being unloaded. This can be done through calling WorldObject::setActive(bool) from the scripting library. Note that entire instances are still unloaded if no player is present on that map to save resources. This behavior can be changed if the need arises.
--HG-- branch : trunk
This commit is contained in:
@@ -974,6 +974,43 @@ WorldObject::WorldObject()
|
||||
m_name = "";
|
||||
|
||||
mSemaphoreTeleport = false;
|
||||
|
||||
m_isActive = false;
|
||||
}
|
||||
|
||||
WorldObject::~WorldObject()
|
||||
{
|
||||
if(m_isActive && IsInWorld())
|
||||
ObjectAccessor::Instance().RemoveActiveObject(this);
|
||||
}
|
||||
|
||||
void WorldObject::setActive(bool isActive)
|
||||
{
|
||||
// if already in the same activity state as we try to set, do nothing
|
||||
if(isActive == m_isActive)
|
||||
return;
|
||||
m_isActive = isActive;
|
||||
if(IsInWorld())
|
||||
{
|
||||
if(isActive)
|
||||
ObjectAccessor::Instance().AddActiveObject(this);
|
||||
else
|
||||
ObjectAccessor::Instance().RemoveActiveObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldObject::AddToWorld()
|
||||
{
|
||||
Object::AddToWorld();
|
||||
if(m_isActive)
|
||||
ObjectAccessor::Instance().AddActiveObject(this);
|
||||
}
|
||||
|
||||
void WorldObject::RemoveFromWorld()
|
||||
{
|
||||
if(m_isActive)
|
||||
ObjectAccessor::Instance().RemoveActiveObject(this);
|
||||
Object::RemoveFromWorld();
|
||||
}
|
||||
|
||||
void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 mapid )
|
||||
|
||||
Reference in New Issue
Block a user