aboutsummaryrefslogtreecommitdiff
path: root/src/game/Object.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2008-12-10 20:25:47 -0600
committermegamage <none@none>2008-12-10 20:25:47 -0600
commit39083f4ff837d23cc886338fc9bc74df90fe9613 (patch)
tree5c2e0860894a6ac435f6035b9fab166a35c3d278 /src/game/Object.cpp
parent0029017e17b9a2fded77e1680cef9dbc3aebacff (diff)
*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
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r--src/game/Object.cpp19
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);