Collision/GameObjects: Fixed LoS for all doors (open and closed). Looks like data0 for type 0 is in fact startClosed instead of startOpen

closes #5660
Signed-off-by: Subv <s.v.h21@hotmail.com>
This commit is contained in:
Subv
2012-03-17 14:34:01 -05:00
parent 41cc704bf8
commit 21ccfb8e2e

View File

@@ -134,7 +134,8 @@ void GameObject::AddToWorld()
sObjectAccessor->AddObject(this);
bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
bool toggledState = (GetGOData() ? GetGOData()->go_state == GO_STATE_ACTIVE : false);
// The state can be changed after GameObject::Create but before GameObject::AddToWorld
bool toggledState = GetGoState() == GO_STATE_READY;
if (m_model)
GetMap()->Insert(*m_model);
if ((startOpen && !toggledState) || (!startOpen && toggledState))
@@ -1904,7 +1905,8 @@ void GameObject::SetLootState(LootState state, Unit* unit)
// 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 (GetGOData() && GetGOData()->go_state == GO_NOT_READY)
// Use the current go state
if (GetGoState() == GO_STATE_ACTIVE)
startOpen = !startOpen;
if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)
@@ -1925,7 +1927,7 @@ void GameObject::SetGoState(GOState state)
// 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 (GetGOData() && GetGOData()->go_state == GO_NOT_READY)
if (GetGOData() && GetGOData()->go_state == GO_STATE_READY)
startOpen = !startOpen;
if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE)