Skip to content

Commit 716f480

Browse files
ShaurenOvahlord
authored andcommitted
Core/Vehicles: Remove incorrect passenger->vehicle threat redirection
1 parent d2c42d6 commit 716f480

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

src/server/game/Combat/ThreatManager.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ void ThreatReference::HeapNotifyDecreased()
192192
if (tWho->GetSummonerGUID().IsPlayer())
193193
return false;
194194

195+
// accessories are fully treated as components of the parent and cannot have threat
196+
if (cWho->HasUnitTypeMask(UNIT_MASK_ACCESSORY))
197+
return false;
198+
195199
return true;
196200
}
197201

@@ -381,18 +385,12 @@ void ThreatManager::AddThreat(Unit* target, float amount, SpellInfo const* spell
381385
return;
382386
}
383387

384-
// while riding a vehicle, all threat goes to the vehicle, not the pilot
385-
if (Unit* vehicle = target->GetVehicleBase())
386-
{
387-
AddThreat(vehicle, amount, spell, ignoreModifiers, ignoreRedirects);
388-
if (target->HasUnitTypeMask(UNIT_MASK_ACCESSORY)) // accessories are fully treated as components of the parent and cannot have threat
389-
return;
390-
amount = 0.0f;
391-
}
392-
393388
// if we cannot actually have a threat list, we instead just set combat state and avoid creating threat refs altogether
394389
if (!CanHaveThreatList())
395390
{
391+
if (ignoreRedirects)
392+
return;
393+
396394
CombatManager& combatMgr = _owner->GetCombatManager();
397395
if (!combatMgr.SetInCombatWith(target))
398396
return;

src/server/game/Entities/Vehicle/Vehicle.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,10 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ
434434
ASSERT(accessory);
435435

436436
if (minion)
437+
{
437438
accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY);
439+
accessory->GetThreatManager().Initialize(); // reinitialize CanHaveThreatList cached value
440+
}
438441

439442
(void)_me->HandleSpellClick(accessory, seatId);
440443

@@ -979,7 +982,7 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
979982
Passenger->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_SLOT_CONTROLLED);
980983

981984
for (auto const& [guid, threatRef] : Passenger->GetThreatManager().GetThreatenedByMeList())
982-
threatRef->GetOwner()->GetThreatManager().AddThreat(Target->GetBase(), threatRef->GetThreat(), nullptr, true, true);
985+
threatRef->GetOwner()->GetThreatManager().AddThreat(Target->GetBase(), 0.0f, nullptr, true, true);
983986

984987
if (Creature* creature = Target->GetBase()->ToCreature())
985988
{

0 commit comments

Comments
 (0)