Wintergrasp Fix Collision Wall work: Open / Close collision wall when battle started/ended (#22342)

* Open / Close collision wall when battle started/ended

(cherry picked from commit c4e561ee13)
This commit is contained in:
Lighto
2018-09-25 18:18:28 +03:00
committed by Shauren
parent ebf8f46aed
commit e79cb1da2c
2 changed files with 20 additions and 1 deletions

View File

@@ -652,6 +652,12 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
relic->RemoveFromWorld();
m_titansRelicGUID.Clear();
// change collision wall state closed
for (BfWGGameObjectBuilding* building : BuildingsInZone)
{
building->RebuildGate();
}
// successful defense
if (endByTimer)
UpdateData(GetDefenderTeam() == TEAM_HORDE ? BATTLEFIELD_WG_DATA_DEF_H : BATTLEFIELD_WG_DATA_DEF_A, 1);
@@ -1424,7 +1430,7 @@ void BfWGGameObjectBuilding::Rebuild()
build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, nullptr, true);
if (build->GetEntry() == GO_WINTERGRASP_VAULT_GATE)
if (GameObject* go = build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 50.0f))
go->SetGoState(GO_STATE_READY);
go->SetGoState(GO_STATE_ACTIVE);
// Update worldstate
_state = WintergraspGameObjectState(BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (_teamControl * 3));
@@ -1435,6 +1441,18 @@ void BfWGGameObjectBuilding::Rebuild()
}
}
void BfWGGameObjectBuilding::RebuildGate()
{
if (GameObject* build = _wg->GetGameObject(_buildGUID))
{
if (build->IsDestructibleBuilding() && build->GetEntry() == GO_WINTERGRASP_VAULT_GATE)
{
if (GameObject* go = build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 50.0f))
go->SetGoState(GO_STATE_READY); //not GO_STATE_ACTIVE
}
}
}
void BfWGGameObjectBuilding::Damaged()
{
// Update worldstate

View File

@@ -572,6 +572,7 @@ public:
ObjectGuid const& GetGUID() const { return _buildGUID; }
void Rebuild();
void RebuildGate();
// Called when associated gameobject is damaged
void Damaged();