Core/Gameobject: Properly toggle collision state when a gameobject is activated or spawned.

This commit is contained in:
e000
2012-08-12 20:04:02 +02:00
committed by kaelima
parent bd37e73fdf
commit 65469c9ee9

View File

@@ -138,9 +138,8 @@ void GameObject::AddToWorld()
bool toggledState = GetGOData() ? GetGOData()->go_state == GO_STATE_READY : false;
if (m_model)
GetMap()->Insert(*m_model);
if (startOpen ^ toggledState)
EnableCollision(false);
EnableCollision(startOpen ^ toggledState);
WorldObject::AddToWorld();
}
}
@@ -1923,7 +1922,7 @@ 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_ACTIVE)
if (GetGoState() != GO_STATE_ACTIVE)
startOpen = !startOpen;
if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)