Core/Gameobject: another attempt at fixing collision. chest gameobject initial collision provided by vincent-michael
This commit is contained in:
@@ -61,6 +61,8 @@ public:
|
||||
void disable() { phasemask = 0;}
|
||||
void enable(uint32 ph_mask) { phasemask = ph_mask;}
|
||||
|
||||
bool isEnabled() const {return phasemask != 0;}
|
||||
|
||||
bool intersectRay(const G3D::Ray& Ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const;
|
||||
|
||||
static GameObjectModel* Create(const GameObject& go);
|
||||
|
||||
@@ -135,7 +135,7 @@ void GameObject::AddToWorld()
|
||||
sObjectAccessor->AddObject(this);
|
||||
bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
|
||||
// The state can be changed after GameObject::Create but before GameObject::AddToWorld
|
||||
bool toggledState = GetGOData() ? GetGOData()->go_state != GO_STATE_READY : false;
|
||||
bool toggledState = GetGoType == GAMEOBJECT_TYPE_CHEST ? getLootState () == GO_READY : GetGoState() != GO_STATE_READY;
|
||||
if (m_model)
|
||||
GetMap()->InsertGameObjectModel(*m_model);
|
||||
|
||||
@@ -1930,13 +1930,10 @@ void GameObject::SetLootState(LootState state, Unit* unit)
|
||||
bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
|
||||
|
||||
// Use the current go state
|
||||
if (GetGoState() != GO_STATE_READY)
|
||||
if ((GetGoState() != GO_STATE_READY && (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)) || state == GO_READY)
|
||||
startOpen = !startOpen;
|
||||
|
||||
if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)
|
||||
EnableCollision(startOpen);
|
||||
else if (state == GO_READY)
|
||||
EnableCollision(!startOpen);
|
||||
|
||||
EnableCollision(startOpen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1968,7 +1965,8 @@ void GameObject::SetDisplayId(uint32 displayid)
|
||||
void GameObject::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||
{
|
||||
WorldObject::SetPhaseMask(newPhaseMask, update);
|
||||
EnableCollision(true);
|
||||
if (m_model && m_model->isEnabled())
|
||||
EnableCollision(true);
|
||||
}
|
||||
|
||||
void GameObject::EnableCollision(bool enable)
|
||||
|
||||
Reference in New Issue
Block a user