fix(Core/Grid): Address bugs and performance issues introduced by visibility notifier implementation (#17480)

* Bug fixes

- Corrected std::chrono from seconds to milliseconds
- Got rid of leftover code that caused objects to not show up on time

* Removed logic to set gameobject as active

- More alignement with TC.
- Reduces CPU usage drastically

* Revert back to using time_t instead of std chrono

* Invoke SetNoCreate() method to reduce CPU usage drastically

* Remove setActive from static and motion transports

* Fix performance issues

* Added SetFarVisible to WG and some dungeon scripts

- Also removed setActive(true) from creatures in Wintergrasp. As for gameobjects they are set to active upon being damaged/destroyed and removed from active on rebuild (reset)

* Removed comments related to VISIBILITY_COMPENSATION

* Fix log

* Deleted unused files + corrected a check

* Added missing header

* Removed unused parameter

* Removed another unsued parameter

* Changed vector to set for i_visibleNow

- Changed vector to set for i_visibleNow in VisibleNotifer
- Adjusted HaveAtClient to accept Object*
- Adjusted SendUpdateToPlayer to send createobject packet only if not known to client
This commit is contained in:
AG
2023-10-23 10:37:11 +02:00
committed by GitHub
parent a56a224bd7
commit 60e27511c5
53 changed files with 509 additions and 586 deletions

View File

@@ -327,6 +327,7 @@ public:
if (Creature* nefarian = me->SummonCreature(NPC_NEFARIAN, NefarianSpawn))
{
nefarian->setActive(true);
nefarian->SetFarVisible(true);
nefarian->SetCanFly(true);
nefarian->SetDisableGravity(true);
nefarian->GetMotionMaster()->MovePath(NEFARIAN_PATH, false);

View File

@@ -425,6 +425,7 @@ public:
{
nefarius->SetPhaseMask(1, true);
nefarius->setActive(true);
nefarius->SetFarVisible(true);
nefarius->Respawn();
nefarius->GetMotionMaster()->MoveTargetedHome();
}

View File

@@ -105,6 +105,7 @@ struct boss_nightbane : public BossAI
me->SetDisableGravity(_intro);
me->SetWalk(false);
me->setActive(true);
me->SetFarVisible(true);
if (instance)
{

View File

@@ -55,6 +55,7 @@ public:
void Reset() override
{
me->setActive(true);
me->SetFarVisible(true);
me->SetVisible(false);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetCanFly(true);

View File

@@ -347,6 +347,7 @@ void hyjalAI::Reset()
{
IsDummy = false;
me->setActive(true);
me->SetFarVisible(true);
// GUIDs
PlayerGUID.Clear();
BossGUID[0].Clear();
@@ -493,6 +494,7 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
creature->SetWalk(false);
creature->setActive(true);
creature->SetFarVisible(true);
switch (entry)
{
case NECROMANCER:
@@ -1021,6 +1023,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
unit->SetFarVisible(true);
}
}
for (uint8 i = 0; i < 3; ++i)//summon 3 abominations
@@ -1033,6 +1036,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
unit->SetFarVisible(true);
}
}
for (uint8 i = 0; i < 5; ++i)//summon 5 gargoyles
@@ -1045,6 +1049,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
unit->SetFarVisible(true);
}
}
break;
@@ -1062,6 +1067,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
unit->SetFarVisible(true);
}
}
for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
@@ -1074,6 +1080,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
unit->SetFarVisible(true);
}
}
for (uint8 i = 0; i < 5; ++i)//summon 5 abominations
@@ -1086,6 +1093,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
unit->SetFarVisible(true);
}
}
break;

View File

@@ -389,6 +389,7 @@ public:
if (action == ACTION_BALTHARUS_DEATH)
{
me->setActive(true);
me->SetFarVisible(true);
_isIntro = false;
_events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_0, 6s);

View File

@@ -339,6 +339,7 @@ public:
events.ScheduleEvent(EVENT_ICY_GRIP, 33s + 500ms, EVENT_GROUP_LAND_PHASE);
me->setActive(true);
me->SetFarVisible(true);
me->SetInCombatWithZone();
instance->SetBossState(DATA_SINDRAGOSA, IN_PROGRESS);
@@ -377,6 +378,7 @@ public:
return;
me->setActive(true);
me->SetFarVisible(true);
me->SetDisableGravity(true);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetSpeed(MOVE_RUN, 4.28571f);
@@ -1407,6 +1409,7 @@ public:
return;
me->setActive(true);
me->SetFarVisible(true);
me->SetImmuneToPC(true);
float moveTime = me->GetExactDist(&SpinestalkerFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f);
me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, SpinestalkerLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250));
@@ -1423,6 +1426,7 @@ public:
return;
me->setActive(false);
me->SetFarVisible(false);
me->SetDisableGravity(false);
me->SetHomePosition(SpinestalkerLandPos);
me->SetFacingTo(SpinestalkerLandPos.GetOrientation());
@@ -1538,6 +1542,7 @@ public:
return;
me->setActive(true);
me->SetFarVisible(true);
me->SetImmuneToPC(true);
float moveTime = me->GetExactDist(&RimefangFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f);
me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, RimefangLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250));
@@ -1556,6 +1561,8 @@ public:
if (point == POINT_FROSTWYRM_LAND)
{
me->setActive(false);
me->SetFarVisible(false);
me->SetFarVisible(false);
me->SetDisableGravity(false);
me->SetHomePosition(RimefangLandPos);
me->SetFacingTo(RimefangLandPos.GetOrientation());

View File

@@ -484,6 +484,7 @@ public:
uint32 introDelay = 0;
me->setActive(true);
me->SetFarVisible(true);
me->SetInCombatWithZone();
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToNPC(true);

View File

@@ -175,6 +175,7 @@ public:
{
me->SetDisableGravity(true);
me->setActive(true);
me->SetFarVisible(true);
Reset();
}

View File

@@ -517,6 +517,7 @@ public:
if (m_pInstance && !_encounterFinished)
m_pInstance->SetData(TYPE_THORIM, IN_PROGRESS);
me->setActive(true);
me->SetFarVisible(true);
DisableThorim(true);
me->CastSpell(me, SPELL_SHEATH_OF_LIGHTNING, true);
//me->CastSpell(me, SPELL_TOUCH_OF_DOMINION, true);