Revert "fix(Core/Vehicles): defer accessory init to avoid double install" (#25491)
This commit is contained in:
@@ -713,13 +713,6 @@ void Creature::Update(uint32 diff)
|
|||||||
m_vehicleKit->Reset();
|
m_vehicleKit->Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_triggerVehicleKitInit)
|
|
||||||
{
|
|
||||||
_triggerVehicleKitInit = false;
|
|
||||||
if (m_vehicleKit)
|
|
||||||
m_vehicleKit->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (m_deathState)
|
switch (m_deathState)
|
||||||
{
|
{
|
||||||
case DeathState::JustRespawned:
|
case DeathState::JustRespawned:
|
||||||
@@ -1120,10 +1113,9 @@ bool Creature::AIM_Initialize(CreatureAI* ai)
|
|||||||
IsAIEnabled = true;
|
IsAIEnabled = true;
|
||||||
i_AI->InitializeAI();
|
i_AI->InitializeAI();
|
||||||
|
|
||||||
// Defer vehicle kit init to the next Creature::Update tick so accessories
|
// Xinef: Initialize vehicle if it is not summoned!
|
||||||
// install after visibility sync.
|
if (GetVehicleKit() && m_spawnId)
|
||||||
if (GetVehicleKit())
|
GetVehicleKit()->Reset();
|
||||||
_triggerVehicleKitInit = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -536,9 +536,6 @@ private:
|
|||||||
// Formation variable
|
// Formation variable
|
||||||
CreatureGroup* m_formation;
|
CreatureGroup* m_formation;
|
||||||
bool TriggerJustRespawned;
|
bool TriggerJustRespawned;
|
||||||
// Deferred vehicle init: set in AIM_Initialize, consumed on the next
|
|
||||||
// Creature::Update tick so accessories install after visibility sync.
|
|
||||||
bool _triggerVehicleKitInit = false;
|
|
||||||
|
|
||||||
// Shared timer between mobs who assist another.
|
// Shared timer between mobs who assist another.
|
||||||
// Damaging one extends leash range on all of them.
|
// Damaging one extends leash range on all of them.
|
||||||
|
|||||||
@@ -346,6 +346,11 @@ bool Map::AddToMap(T* obj, bool checkTransport)
|
|||||||
//also, trigger needs to cast spell, if not update, cannot see visual
|
//also, trigger needs to cast spell, if not update, cannot see visual
|
||||||
obj->UpdateObjectVisibility(true);
|
obj->UpdateObjectVisibility(true);
|
||||||
|
|
||||||
|
// Xinef: little hack for vehicles, accessories have to be added after visibility update so they wont fall off the vehicle, moved from Creature::AIM_Initialize
|
||||||
|
// Initialize vehicle, this is done only for summoned npcs, DB creatures are handled by grid loaders
|
||||||
|
if (obj->IsCreature())
|
||||||
|
if (Vehicle* vehicle = obj->ToCreature()->GetVehicleKit())
|
||||||
|
vehicle->Reset();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user