mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[9392] Update creature/gameobject pool at despawn instead spawn prepare.
This let solve problem with not despawned creature/gameobject at pool update in case when related grid not loaded. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
941b2edb10
commit
b2718378ef
6 changed files with 93 additions and 41 deletions
|
|
@ -256,11 +256,7 @@ void GameObject::Update(uint32 /*p_time*/)
|
|||
return;
|
||||
}
|
||||
// respawn timer
|
||||
uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<GameObject>(GetDBTableGUIDLow()) : 0;
|
||||
if (poolid)
|
||||
sPoolMgr.UpdatePool<GameObject>(poolid, GetDBTableGUIDLow());
|
||||
else
|
||||
GetMap()->Add(this);
|
||||
GetMap()->Add(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -445,13 +441,20 @@ void GameObject::Update(uint32 /*p_time*/)
|
|||
return;
|
||||
}
|
||||
|
||||
// since pool system can fail to roll unspawned object, this one can remain spawned, so must set respawn nevertheless
|
||||
m_respawnTime = time(NULL) + m_respawnDelayTime;
|
||||
|
||||
// if option not set then object will be saved at grid unload
|
||||
if(sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATLY))
|
||||
SaveRespawnTime();
|
||||
|
||||
UpdateObjectVisibility();
|
||||
// if part of pool, let pool system schedule new spawn instead of just scheduling respawn
|
||||
if(uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<GameObject>(GetDBTableGUIDLow()) : 0)
|
||||
sPoolMgr.UpdatePool<GameObject>(poolid, GetDBTableGUIDLow());
|
||||
|
||||
// can be not in world at pool despawn
|
||||
if (IsInWorld())
|
||||
UpdateObjectVisibility();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue