mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 03:32:28 -04:00
Core/GameObjects: Don't ignore collision for destructible gameobjects in destroyed state - they simply have a different model
This commit is contained in:
@@ -140,14 +140,11 @@ bool GameObjectModel::initialize(std::unique_ptr<GameObjectModelOwnerBase> model
|
||||
return true;
|
||||
}
|
||||
|
||||
GameObjectModel* GameObjectModel::Create(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath)
|
||||
std::unique_ptr<GameObjectModel> GameObjectModel::Create(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath)
|
||||
{
|
||||
GameObjectModel* mdl = new GameObjectModel();
|
||||
std::unique_ptr<GameObjectModel> mdl(new GameObjectModel());
|
||||
if (!mdl->initialize(std::move(modelOwner), dataPath))
|
||||
{
|
||||
delete mdl;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mdl;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
bool GetLocationInfo(G3D::Vector3 const& point, VMAP::LocationInfo& info, PhaseShift const& phaseShift) const;
|
||||
bool GetLiquidLevel(G3D::Vector3 const& point, VMAP::LocationInfo& info, float& liqHeight) const;
|
||||
|
||||
static GameObjectModel* Create(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath);
|
||||
static std::unique_ptr<GameObjectModel> Create(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath);
|
||||
|
||||
bool UpdatePosition();
|
||||
|
||||
|
||||
@@ -833,7 +833,7 @@ void SetControlZoneValue::Execute(GameObjectTypeBase& type) const
|
||||
}
|
||||
|
||||
GameObject::GameObject() : WorldObject(false), MapObject(),
|
||||
m_model(nullptr), m_goValue(), m_stringIds(), m_AI(nullptr), m_respawnCompatibilityMode(false), _animKitId(0), _worldEffectID(0)
|
||||
m_goValue(), m_stringIds(), m_AI(nullptr), m_respawnCompatibilityMode(false), _animKitId(0), _worldEffectID(0)
|
||||
{
|
||||
m_objectType |= TYPEMASK_GAMEOBJECT;
|
||||
m_objectTypeId = TYPEID_GAMEOBJECT;
|
||||
@@ -868,7 +868,6 @@ GameObject::GameObject() : WorldObject(false), MapObject(),
|
||||
GameObject::~GameObject()
|
||||
{
|
||||
delete m_AI;
|
||||
delete m_model;
|
||||
}
|
||||
|
||||
void GameObject::AIM_Destroy()
|
||||
@@ -3744,7 +3743,6 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, WorldOb
|
||||
m_goValue.Building.Health = m_goValue.Building.DestructibleHitpoint->GetMaxHealth();
|
||||
SetGoAnimProgress(255);
|
||||
}
|
||||
EnableCollision(true);
|
||||
break;
|
||||
case GO_DESTRUCTIBLE_DAMAGED:
|
||||
{
|
||||
@@ -3792,7 +3790,6 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, WorldOb
|
||||
m_goValue.Building.Health = 0;
|
||||
SetGoAnimProgress(0);
|
||||
}
|
||||
EnableCollision(false);
|
||||
break;
|
||||
}
|
||||
case GO_DESTRUCTIBLE_REBUILDING:
|
||||
@@ -3813,7 +3810,6 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, WorldOb
|
||||
m_goValue.Building.Health = m_goValue.Building.DestructibleHitpoint->GetMaxHealth();
|
||||
SetGoAnimProgress(255);
|
||||
}
|
||||
EnableCollision(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -4007,15 +4003,26 @@ void GameObject::UpdateModel()
|
||||
{
|
||||
if (!IsInWorld())
|
||||
return;
|
||||
bool modelCollisionEnabled;
|
||||
if (m_model)
|
||||
{
|
||||
modelCollisionEnabled = m_model->IsCollisionEnabled();
|
||||
if (GetMap()->ContainsGameObjectModel(*m_model))
|
||||
GetMap()->RemoveGameObjectModel(*m_model);
|
||||
}
|
||||
else
|
||||
modelCollisionEnabled = GetGoType() == GAMEOBJECT_TYPE_CHEST ? getLootState() == GO_READY : (GetGoState() == GO_STATE_READY || IsTransport());
|
||||
|
||||
RemoveFlag(GO_FLAG_MAP_OBJECT);
|
||||
delete m_model;
|
||||
m_model = nullptr;
|
||||
|
||||
CreateModel();
|
||||
if (m_model)
|
||||
{
|
||||
GetMap()->InsertGameObjectModel(*m_model);
|
||||
if (modelCollisionEnabled)
|
||||
m_model->EnableCollision(modelCollisionEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
bool GameObject::IsLootAllowedFor(Player const* player) const
|
||||
|
||||
@@ -396,7 +396,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
|
||||
uint32 GetFaction() const override { return m_gameObjectData->FactionTemplate; }
|
||||
void SetFaction(uint32 faction) override { SetUpdateFieldValue(m_values.ModifyValue(&GameObject::m_gameObjectData).ModifyValue(&UF::GameObjectData::FactionTemplate), faction); }
|
||||
|
||||
GameObjectModel* m_model;
|
||||
std::unique_ptr<GameObjectModel> m_model;
|
||||
Position GetRespawnPosition() const;
|
||||
|
||||
TransportBase* ToTransportBase() { return const_cast<TransportBase*>(const_cast<GameObject const*>(this)->ToTransportBase()); }
|
||||
|
||||
Reference in New Issue
Block a user