fix(Core): Activate creatures and objects during opening cinematics (#4045)

Co-authored-by: Si1ker <55638679+Sombranator@users.noreply.github.com>
Co-authored-by: Stefano Borzì <stefanoborzi32@gmail.com>
This commit is contained in:
Silker
2021-01-22 00:03:30 +00:00
committed by GitHub
parent f07966fd3e
commit 0a8a7ef149
14 changed files with 785 additions and 19 deletions

View File

@@ -785,6 +785,19 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
VisitNearbyCellsOfPlayer(player, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
// If player is using far sight, visit that object too
if (WorldObject* viewPoint = player->GetViewpoint())
{
if (Creature* viewCreature = viewPoint->ToCreature())
{
VisitNearbyCellsOf(viewCreature, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
}
else if (DynamicObject* viewObject = viewPoint->ToDynObject())
{
VisitNearbyCellsOf(viewObject, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
}
}
// handle updates for creatures in combat with player and are more than X yards away
if (player->IsInCombat())
{
@@ -2269,6 +2282,28 @@ char const* Map::GetMapName() const
return i_mapEntry ? i_mapEntry->name[sWorld->GetDefaultDbcLocale()] : "UNNAMEDMAP\x0";
}
void Map::UpdateObjectVisibility(WorldObject* obj, Cell cell, CellCoord cellpair)
{
cell.SetNoCreate();
acore::VisibleChangesNotifier notifier(*obj);
TypeContainerVisitor<acore::VisibleChangesNotifier, WorldTypeMapContainer > player_notifier(notifier);
cell.Visit(cellpair, player_notifier, *this, *obj, obj->GetVisibilityRange());
}
void Map::UpdateObjectsVisibilityFor(Player* player, Cell cell, CellCoord cellpair)
{
acore::VisibleNotifier notifier(*player, false, false);
cell.SetNoCreate();
TypeContainerVisitor<acore::VisibleNotifier, WorldTypeMapContainer > world_notifier(notifier);
TypeContainerVisitor<acore::VisibleNotifier, GridTypeMapContainer > grid_notifier(notifier);
cell.Visit(cellpair, world_notifier, *this, *player->m_seer, player->GetSightRange());
cell.Visit(cellpair, grid_notifier, *this, *player->m_seer, player->GetSightRange());
// send data
notifier.SendToSelf();
}
void Map::SendInitSelf(Player* player)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)