Core/Movement: merged Collision height handling from 335 branch to reduce the probability that creatures are falling under the map
This commit is contained in:
1 parent
3357ae7940
commit
50a91bd590
16 files changed
+134
-138
No files matched your search
@@ -2062,7 +2062,7 @@ void Player::SetObjectScale(float scale)
|
||||
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, scale * DEFAULT_WORLD_OBJECT_SIZE);
|
||||
SetFloatValue(UNIT_FIELD_COMBATREACH, scale * DEFAULT_COMBAT_REACH);
|
||||
if (IsInWorld())
|
||||
SendMovementSetCollisionHeight(scale * GetCollisionHeight(IsMounted()));
|
||||
SendMovementSetCollisionHeight(scale * GetCollisionHeight());
|
||||
}
|
||||
|
||||
bool Player::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit* caster) const
|
||||
@@ -27981,39 +27981,6 @@ void Player::SendMovementSetCollisionHeight(float height)
|
||||
Movement::PacketSender(this, NULL_OPCODE, SMSG_MOVE_SET_COLLISION_HEIGHT, SMSG_MOVE_UPDATE_COLLISION_HEIGHT, &extra).Send();
|
||||
}
|
||||
|
||||
float Player::GetCollisionHeight(bool mounted) const
|
||||
{
|
||||
if (mounted)
|
||||
{
|
||||
CreatureDisplayInfoEntry const* mountDisplayInfo = sCreatureDisplayInfoStore.LookupEntry(GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID));
|
||||
if (!mountDisplayInfo)
|
||||
return GetCollisionHeight(false);
|
||||
|
||||
CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId);
|
||||
if (!mountModelData)
|
||||
return GetCollisionHeight(false);
|
||||
|
||||
CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId());
|
||||
ASSERT(displayInfo);
|
||||
CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId);
|
||||
ASSERT(modelData);
|
||||
|
||||
float scaleMod = GetObjectScale(); // 99% sure about this
|
||||
|
||||
return scaleMod * mountModelData->MountHeight + modelData->CollisionHeight * 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
//! Dismounting case - use basic default model data
|
||||
CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId());
|
||||
ASSERT(displayInfo);
|
||||
CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId);
|
||||
ASSERT(modelData);
|
||||
|
||||
return modelData->CollisionHeight;
|
||||
}
|
||||
}
|
||||
|
||||
std::string Player::GetMapAreaAndZoneString() const
|
||||
{
|
||||
uint32 areaId = GetAreaId();
|
||||
|
||||
Reference in new issue
Block a user