diff options
author | Blaymoira <none@none> | 2008-12-11 21:32:08 +0100 |
---|---|---|
committer | Blaymoira <none@none> | 2008-12-11 21:32:08 +0100 |
commit | 236553f40804c30d4ed8f1a29e01a76dd7be809a (patch) | |
tree | 5b7e5d38aa0e1e002a932fb86d2c01e0289b1599 /src/game/Object.cpp | |
parent | 5d003e3a6079388149473f0a3da6089b47404a29 (diff) | |
parent | f2028e1583bf935fc3d096748d5b07428cdcaa00 (diff) |
*Merged 459
--HG--
branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r-- | src/game/Object.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 35a021ac7c7..2872f29cdaf 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -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); |