mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 03:32:28 -04:00
Core/Units: Allow mind controlling non-controllable vehicles (for example players that become vehicle during boss encounters or creatures that only are vehicles to show non standard power type)
Closes #24562
(cherry picked from commit 1fecbc6892)
This commit is contained in:
@@ -10911,7 +10911,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
|
||||
charmer->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
|
||||
ASSERT(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER);
|
||||
ASSERT((type == CHARM_TYPE_VEHICLE) == IsVehicle());
|
||||
ASSERT((type == CHARM_TYPE_VEHICLE) == (GetVehicleKit() && GetVehicleKit()->IsControllableVehicle()));
|
||||
|
||||
TC_LOG_DEBUG("entities.unit", "SetCharmedBy: charmer %s, charmed %s, type %u.", charmer->GetGUID().ToString().c_str(), GetGUID().ToString().c_str(), uint32(type));
|
||||
|
||||
|
||||
@@ -592,6 +592,15 @@ bool Vehicle::IsVehicleInUse() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Vehicle::IsControllableVehicle() const
|
||||
{
|
||||
for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr)
|
||||
if (itr->second.SeatInfo->HasFlag(VEHICLE_SEAT_FLAG_CAN_CONTROL))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn void Vehicle::InitMovementInfoForBase()
|
||||
*
|
||||
|
||||
@@ -61,6 +61,7 @@ class TC_GAME_API Vehicle : public TransportBase
|
||||
void RelocatePassengers();
|
||||
void RemoveAllPassengers();
|
||||
bool IsVehicleInUse() const;
|
||||
bool IsControllableVehicle() const;
|
||||
|
||||
void SetLastShootPos(Position const& pos) { _lastShootPos.Relocate(pos); }
|
||||
Position const& GetLastShootPos() const { return _lastShootPos; }
|
||||
|
||||
@@ -7529,7 +7529,7 @@ bool Spell::CheckEffectTarget(Unit const* target, SpellEffectInfo const& spellEf
|
||||
case SPELL_AURA_MOD_CHARM:
|
||||
case SPELL_AURA_MOD_POSSESS_PET:
|
||||
case SPELL_AURA_AOE_CHARM:
|
||||
if (target->GetTypeId() == TYPEID_UNIT && target->IsVehicle())
|
||||
if (target->GetVehicleKit() && target->GetVehicleKit()->IsControllableVehicle())
|
||||
return false;
|
||||
if (target->IsMounted())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user