[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:
1 parent
0e18e4330c
commit
e72a13c3dd
13 files changed
+97
-29
No files matched your search
@@ -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