Core/Creatures: Implemented CREATURE_STATIC_FLAG_2_ALLOW_MOUNTED_COMBAT and overriding default mount from creature addon
This commit is contained in:
1 parent
8c7b6f2bcf
commit
a4aa09de52
2 files changed
+15
-1
No files matched your search
@@ -2550,6 +2550,9 @@ bool Creature::LoadCreaturesAddon()
|
||||
if (!creatureAddon)
|
||||
return false;
|
||||
|
||||
if (uint32 mountDisplayId = _defaultMountDisplayIdOverride.value_or(creatureAddon->mount); mountDisplayId != 0)
|
||||
Mount(mountDisplayId);
|
||||
|
||||
if (creatureAddon->mount != 0)
|
||||
Mount(creatureAddon->mount);
|
||||
|
||||
@@ -2941,6 +2944,14 @@ void Creature::SetPosition(float x, float y, float z, float o)
|
||||
GetVehicleKit()->RelocatePassengers();
|
||||
}
|
||||
|
||||
void Creature::SetDefaultMount(Optional<uint32> mountCreatureDisplayId)
|
||||
{
|
||||
if (mountCreatureDisplayId && !sCreatureDisplayInfoStore.LookupEntry(*mountCreatureDisplayId))
|
||||
mountCreatureDisplayId.reset();
|
||||
|
||||
_defaultMountDisplayIdOverride = mountCreatureDisplayId;
|
||||
}
|
||||
|
||||
float Creature::GetAggroRange(Unit const* target) const
|
||||
{
|
||||
// Determines the aggro range for creatures (usually pets), used mainly for aggressive pet target selection.
|
||||
@@ -3240,7 +3251,7 @@ void Creature::AtEngage(Unit* target)
|
||||
|
||||
GetThreatManager().ResetUpdateTimer();
|
||||
|
||||
if (!(GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_MOUNTED_COMBAT_ALLOWED))
|
||||
if (!(GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_MOUNTED_COMBAT_ALLOWED) && !HasStaticFlag(CREATURE_STATIC_FLAG_2_ALLOW_MOUNTED_COMBAT))
|
||||
Dismount();
|
||||
|
||||
MovementGeneratorType const movetype = GetMotionMaster()->GetCurrentMovementGeneratorType();
|
||||
|
||||
@@ -317,6 +317,8 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
void SetCannotReachTarget(bool cannotReach) { if (cannotReach == m_cannotReachTarget) return; m_cannotReachTarget = cannotReach; m_cannotReachTimer = 0; }
|
||||
bool CanNotReachTarget() const { return m_cannotReachTarget; }
|
||||
|
||||
void SetDefaultMount(Optional<uint32> mountCreatureDisplayId);
|
||||
|
||||
void SetPosition(float x, float y, float z, float o);
|
||||
void SetPosition(const Position &pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
|
||||
|
||||
@@ -502,6 +504,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
|
||||
CreatureMovementInfo _creatureMovementInfo;
|
||||
|
||||
Optional<uint32> _defaultMountDisplayIdOverride;
|
||||
float _noNpcDamageBelowPctHealth;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user