Battleground/Collision: Fixed the DS waterfall and RV pillar glitches

This commit is contained in:
Subv
2012-02-11 13:47:43 -05:00
parent 231b849ac4
commit 0e57de54fb
2 changed files with 16 additions and 9 deletions

View File

@@ -54,7 +54,7 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff)
SpawnBGObject(BG_DS_OBJECT_WATER_2, getWaterFallTimer());
// turn off collision
if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[BG_DS_OBJECT_WATER_1]))
gob->EnableCollision(false);
gob->SetGoState(GO_STATE_ACTIVE);
setWaterFallActive(false);
}
else
@@ -63,7 +63,7 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff)
SpawnBGObject(BG_DS_OBJECT_WATER_2, RESPAWN_IMMEDIATELY);
// Turn on collision
if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[BG_DS_OBJECT_WATER_1]))
gob->EnableCollision(true);
gob->SetGoState(GO_STATE_READY);
setWaterFallActive(true);
}
}
@@ -88,8 +88,10 @@ void BattlegroundDS::StartingEventOpenDoors()
setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
setWaterFallActive(false);
for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
SpawnBGObject(i, getWaterFallTimer());
SpawnBGObject(BG_DS_OBJECT_WATER_2, getWaterFallTimer());
// Turn off collision
if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[BG_DS_OBJECT_WATER_1]))
gob->SetGoState(GO_STATE_ACTIVE);
}
void BattlegroundDS::AddPlayer(Player* player)

View File

@@ -231,11 +231,16 @@ void BattlegroundRV::TogglePillarCollision(bool apply)
{
if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[i]))
{
bool startOpen = (gob->GetGoType() == GAMEOBJECT_TYPE_DOOR || gob->GetGoType() == GAMEOBJECT_TYPE_BUTTON ? gob->GetGOInfo()->door.startOpen : false);
if (startOpen)
gob->EnableCollision(!apply);
else
gob->EnableCollision(apply);
if (i >= BG_RV_OBJECT_PILAR_COLLISION_1)
{
uint32 _state = GO_STATE_READY;
if (gob->GetGOInfo()->door.startOpen)
_state = GO_STATE_ACTIVE;
gob->SetGoState(apply ? (GOState)_state : (GOState)(!_state));
if (gob->GetGOInfo()->door.startOpen)
gob->EnableCollision(apply); // Forced collision toggle
}
for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))