mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Gameobject: fix collision handling.
This commit is contained in:
@@ -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 = GetGOData() ? GetGOData()->go_state != GO_STATE_READY : false;
|
||||
if (m_model)
|
||||
GetMap()->InsertGameObjectModel(*m_model);
|
||||
|
||||
@@ -1929,7 +1929,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_READY)
|
||||
startOpen = !startOpen;
|
||||
|
||||
if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)
|
||||
@@ -1951,13 +1951,10 @@ 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_STATE_READY)
|
||||
startOpen = !startOpen;
|
||||
if (state != GO_STATE_READY)
|
||||
startOpen = !startOpen
|
||||
|
||||
if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE)
|
||||
EnableCollision(startOpen);
|
||||
else if (state == GO_STATE_READY)
|
||||
EnableCollision(!startOpen);
|
||||
EnableCollision(startOpen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user