Core/Scripts: Add ZoneScript hook for AreaTrigger creation/deletion
Port From (https://github.com/TrinityCore/TrinityCore/commit/1ab7050cb72544faa6a7fa17a0bf644e22538ff3)
This commit is contained in:
@@ -38,6 +38,9 @@ namespace Game.Entities
|
||||
// Register the AreaTrigger for guid lookup and for caster
|
||||
if (!IsInWorld)
|
||||
{
|
||||
if (m_zoneScript != null)
|
||||
m_zoneScript.OnAreaTriggerCreate(this);
|
||||
|
||||
GetMap().GetObjectsStore().Add(GetGUID(), this);
|
||||
if (_spawnId != 0)
|
||||
GetMap().GetAreaTriggerBySpawnIdStore().Add(_spawnId, this);
|
||||
@@ -51,6 +54,9 @@ namespace Game.Entities
|
||||
// Remove the AreaTrigger from the accessor and from all lists of objects in world
|
||||
if (IsInWorld)
|
||||
{
|
||||
if (m_zoneScript != null)
|
||||
m_zoneScript.OnAreaTriggerRemove(this);
|
||||
|
||||
_isRemoved = true;
|
||||
|
||||
Unit caster = GetCaster();
|
||||
@@ -90,6 +96,8 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
SetZoneScript();
|
||||
|
||||
_areaTriggerTemplate = _areaTriggerCreateProperties.Template;
|
||||
|
||||
_Create(ObjectGuid.Create(HighGuid.AreaTrigger, GetMapId(), GetTemplate() != null ? GetTemplate().Id.Id : 0, caster.GetMap().GenerateLowGuid(HighGuid.AreaTrigger)));
|
||||
@@ -229,6 +237,8 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
SetZoneScript();
|
||||
|
||||
_areaTriggerTemplate = areaTriggerTemplate;
|
||||
|
||||
_Create(ObjectGuid.Create(HighGuid.AreaTrigger, GetMapId(), areaTriggerTemplate.Id.Id, GetMap().GenerateLowGuid(HighGuid.AreaTrigger)));
|
||||
|
||||
@@ -26,6 +26,9 @@ namespace Game.Maps
|
||||
public virtual void OnGameObjectCreate(GameObject go) { }
|
||||
public virtual void OnGameObjectRemove(GameObject go) { }
|
||||
|
||||
public virtual void OnAreaTriggerCreate(AreaTrigger areaTrigger) { }
|
||||
public virtual void OnAreaTriggerRemove(AreaTrigger areaTrigger) { }
|
||||
|
||||
public virtual void OnUnitDeath(Unit unit) { }
|
||||
|
||||
//All-purpose data storage 64 bit
|
||||
|
||||
Reference in New Issue
Block a user