aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Scripting/ScriptMgr.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Scripting/ScriptMgr.h')
-rw-r--r--src/server/game/Scripting/ScriptMgr.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index 7f77a6bba1c..708c51d7196 100644
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -1213,7 +1213,7 @@ class GenericCreatureScript : public CreatureScript
};
#define RegisterCreatureAI(ai_name) new GenericCreatureScript<ai_name>(#ai_name)
-template <class AI, AI*(*AIFactory)(Creature*)>
+template <class AI, AI* (*AIFactory)(Creature*)>
class FactoryCreatureScript : public CreatureScript
{
public:
@@ -1231,6 +1231,15 @@ class GenericGameObjectScript : public GameObjectScript
};
#define RegisterGameObjectAI(ai_name) new GenericGameObjectScript<ai_name>(#ai_name)
+template <class AI, AI* (*AIFactory)(GameObject*)>
+class FactoryGameObjectScript : public GameObjectScript
+{
+ public:
+ FactoryGameObjectScript(char const* name) : GameObjectScript(name) { }
+ GameObjectAI* GetAI(GameObject* me) const override { return AIFactory(me); }
+};
+#define RegisterGameObjectAIWithFactory(ai_name, factory_fn) new FactoryGameObjectScript<ai_name, &factory_fn>(#ai_name)
+
template <class AI>
class GenericAreaTriggerEntityScript : public AreaTriggerEntityScript
{