mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
*Add function SummonTrigger and allow to override its AI.
*Remove some trigger scripts. Use default trigger AI and db data instead. *Small fix on eagle boss' electrical storm. --HG-- branch : trunk
This commit is contained in:
@@ -1534,6 +1534,25 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
|
||||
return go;
|
||||
}
|
||||
|
||||
Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint32 duration, CreatureAI* (*GetAI)(Creature*))
|
||||
{
|
||||
TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
|
||||
Creature* summon = SummonCreature(WORLD_TRIGGER, x, y, z, ang, summonType, 0);
|
||||
if(!summon)
|
||||
return NULL;
|
||||
|
||||
//summon->SetName(GetName());
|
||||
if(GetTypeId()==TYPEID_PLAYER || GetTypeId()==TYPEID_UNIT)
|
||||
{
|
||||
summon->setFaction(((Unit*)this)->getFaction());
|
||||
summon->SetLevel(((Unit*)this)->getLevel());
|
||||
}
|
||||
|
||||
if(GetAI)
|
||||
summon->AIM_Initialize(GetAI(summon));
|
||||
return summon;
|
||||
}
|
||||
|
||||
void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float absAngle ) const
|
||||
{
|
||||
x = GetPositionX() + (GetObjectSize() + distance2d) * cos(absAngle);
|
||||
|
||||
Reference in New Issue
Block a user