Skip to content

Commit

Permalink
Battleground/Collision: Fixed the DS waterfall and RV pillar glitches
Browse files Browse the repository at this point in the history
  • Loading branch information
Subv committed Feb 11, 2012
1 parent 231b849 commit 0e57de5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
10 changes: 6 additions & 4 deletions src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
Expand Up @@ -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
Expand All @@ -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);
}
}
Expand All @@ -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)
Expand Down
15 changes: 10 additions & 5 deletions src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
Expand Up @@ -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)))
Expand Down

0 comments on commit 0e57de5

Please sign in to comment.