Core/Vehicles: Remove incorrect passenger->vehicle threat redirection

This commit is contained in:
Shauren authored and Ovahlord committed 2026-05-05 11:31:32 +02:00
1 parent d2c42d6f0f
commit 716f480b79
2 files changed
+11 -10

No files matched your search

+7 -9
View File
@@ -192,6 +192,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;
}
@@ -381,18 +385,12 @@ 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())
{
if (ignoreRedirects)
return;
CombatManager& combatMgr = _owner->GetCombatManager();
if (!combatMgr.SetInCombatWith(target))
return;
+4 -1
View File
@@ -434,7 +434,10 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ
ASSERT(accessory);
if (minion)
{
accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY);
accessory->GetThreatManager().Initialize(); // reinitialize CanHaveThreatList cached value
}
(void)_me->HandleSpellClick(accessory, seatId);
@@ -979,7 +982,7 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
Passenger->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_SLOT_CONTROLLED);
for (auto const& [guid, threatRef] : Passenger->GetThreatManager().GetThreatenedByMeList())
threatRef->GetOwner()->GetThreatManager().AddThreat(Target->GetBase(), threatRef->GetThreat(), nullptr, true, true);
threatRef->GetOwner()->GetThreatManager().AddThreat(Target->GetBase(), 0.0f, nullptr, true, true);
if (Creature* creature = Target->GetBase()->ToCreature())
{