diff options
| author | Nay <dnpd.dd@gmail.com> | 2012-09-06 18:01:51 +0100 |
|---|---|---|
| committer | Nay <dnpd.dd@gmail.com> | 2012-09-06 18:01:51 +0100 |
| commit | 0522e50c8670a34698b15003ceb5e514db72e427 (patch) | |
| tree | d6406bcbd2e836f5f08be8e67f1a01de4c938d48 /src/server/game/Entities/GameObject | |
| parent | 42a899a90eabae2ce6fc8ca103e7692c07153315 (diff) | |
| parent | 9f09713b3e286ba94948c15d64b76b2aed16f8cd (diff) | |
Merge remote-tracking branch 'origin/master' into mmaps
Conflicts:
src/server/game/Spells/Spell.cpp
Diffstat (limited to 'src/server/game/Entities/GameObject')
| -rwxr-xr-x | src/server/game/Entities/GameObject/GameObject.cpp | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 751107ac011..808cbd9a5e4 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -133,13 +133,13 @@ void GameObject::AddToWorld() m_zoneScript->OnGameObjectCreate(this); 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); - EnableCollision(startOpen ^ toggledState); + EnableCollision(toggledState); WorldObject::AddToWorld(); } } @@ -1926,17 +1926,12 @@ void GameObject::SetLootState(LootState state, Unit* unit) sScriptMgr->OnGameObjectLootStateChanged(this, state, unit); if (m_model) { - // startOpen determines whether we are going to add or remove the LoS on activation - bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); - + bool collision = false; // Use the current go state - if (GetGoState() != GO_STATE_READY) - startOpen = !startOpen; + if ((GetGoState() != GO_STATE_READY && (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)) || state == GO_READY) + collision = !collision; - if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED) - EnableCollision(startOpen); - else if (state == GO_READY) - EnableCollision(!startOpen); + EnableCollision(collision); } } @@ -1950,12 +1945,11 @@ void GameObject::SetGoState(GOState state) return; // startOpen determines whether we are going to add or remove the LoS on activation - bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); - - if (state != GO_STATE_READY) - startOpen = !startOpen; + bool collision = false; + if (state == GO_STATE_READY) + collision = !collision; - EnableCollision(startOpen); + EnableCollision(collision); } } @@ -1968,7 +1962,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) |
