mirror of
https://github.com/araxiaonline/AzerothCore-wotlk-with-NPCBots.git
synced 2026-06-13 03:22:24 -04:00
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:
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user