fix(Core/Vehicles): Remove incorrect passenger->vehicle threat redirection (#25719)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
blinkysc
2026-05-08 10:37:06 -05:00
committed by GitHub
parent db4bf267a8
commit fa2ce2b12f
2 changed files with 9 additions and 11 deletions

View File

@@ -206,6 +206,10 @@ void ThreatReference::HeapNotifyDecreased()
if (tWho->GetSummonerGUID().IsPlayer())
return false;
// accessories are fully treated as components of the parent and cannot have threat
if (cWho->HasUnitTypeMask(UNIT_MASK_ACCESSORY))
return false;
return true;
}
@@ -396,15 +400,6 @@ void ThreatManager::AddThreat(Unit* target, float amount, SpellInfo const* spell
return;
}
// while riding a vehicle, all threat goes to the vehicle, not the pilot
if (Unit* vehicle = target->GetVehicleBase())
{
AddThreat(vehicle, amount, spell, ignoreModifiers, ignoreRedirects);
if (target->HasUnitTypeMask(UNIT_MASK_ACCESSORY)) // accessories are fully treated as components of the parent and cannot have threat
return;
amount = 0.0f;
}
// if we cannot actually have a threat list, we instead just set combat state and avoid creating threat refs altogether
if (!CanHaveThreatList())
{

View File

@@ -313,7 +313,10 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ
if (TempSummon* accessory = _me->SummonCreature(entry, *_me, TempSummonType(type), summonTime))
{
if (minion)
{
accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY);
accessory->GetThreatMgr().Initialize(); // reinitialize CanHaveThreatList cached value
}
if (!_me->HandleSpellClick(accessory, seatId))
{
@@ -455,9 +458,9 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
init.SetTransportEnter();
init.Launch();
// Transfer threat from passenger to vehicle
// Put the vehicle in combat with anything that was threatening the passenger; the threat itself stays on the passenger
for (auto const& [guid, threatRef] : unit->GetThreatMgr().GetThreatenedByMeList())
threatRef->GetOwner()->GetThreatMgr().AddThreat(_me, threatRef->GetThreat(), nullptr, true, true);
threatRef->GetOwner()->GetThreatMgr().AddThreat(_me, 0.0f, nullptr, true, true);
if (_me->IsCreature())
{