fix(Core/Vehicles): Prevent accessory double-install and respawn orphans (#25499)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
This commit is contained in:
blinkysc
2026-04-19 10:09:51 -05:00
committed by GitHub
parent b53e1b8eac
commit 687ceeea70
5 changed files with 24 additions and 8 deletions
@@ -24,6 +24,7 @@
#include "GridNotifiers.h"
#include "ObjectMgr.h"
#include "Transport.h"
#include "Vehicle.h"
template <class T>
void GridObjectLoader::AddObjectHelper(Map* map, T* obj)
@@ -53,6 +54,10 @@ void GridObjectLoader::LoadCreatures(CellGuidSet const& guid_set, Map* map)
AddObjectHelper<Creature>(map, obj);
// Grid load bypasses Map::AddToMap, so seat accessories here.
if (Vehicle* vehicle = obj->GetVehicleKit())
vehicle->Reset();
if (!obj->IsMoveInLineOfSightDisabled() && obj->GetDefaultMovementType() == IDLE_MOTION_TYPE && !obj->isNeedNotify(NOTIFY_VISIBILITY_CHANGED | NOTIFY_AI_RELOCATION))
{
if (obj->IsAlive() && !obj->HasUnitState(UNIT_STATE_SIGHTLESS) && obj->HasReactState(REACT_AGGRESSIVE) && !obj->IsImmuneToNPC())