feat(Core/GameObject): Implement OnGameObjectModifyHealth() hook (#17374)

This commit is contained in:
KJack
2023-09-28 16:39:57 -04:00
committed by GitHub
parent 2779833768
commit c25d0b38e8
3 changed files with 30 additions and 1 deletions

View File

@@ -2279,7 +2279,14 @@ void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= nullptr*/
if (!IsDestructibleBuilding())
return;
if (!m_goValue.Building.MaxHealth || !change)
// if this building doesn't have health, return
if (!m_goValue.Building.MaxHealth)
return;
sScriptMgr->OnGameObjectModifyHealth(this, attackerOrHealer, change, sSpellMgr->GetSpellInfo(spellId));
// if the health isn't being changed, return
if (!change)
return;
if (!m_allowModifyDestructibleBuilding)