feat(Script/Misc): Implement missing FactoryGameObjectScript (#9388)
This commit is contained in:
@@ -2567,15 +2567,25 @@ class FactoryCreatureScript : public CreatureScript
|
|||||||
};
|
};
|
||||||
#define RegisterCreatureAIWithFactory(ai_name, factory_fn) new FactoryCreatureScript<ai_name, &factory_fn>(#ai_name)
|
#define RegisterCreatureAIWithFactory(ai_name, factory_fn) new FactoryCreatureScript<ai_name, &factory_fn>(#ai_name)
|
||||||
|
|
||||||
|
// Cannot be used due gob scripts not working like this
|
||||||
template <class AI>
|
template <class AI>
|
||||||
class GenericGameObjectScript : public GameObjectScript
|
class GenericGameObjectScript : public GameObjectScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GenericGameObjectScript(char const* name) : GameObjectScript(name) { }
|
GenericGameObjectScript(char const* name) : GameObjectScript(name) { }
|
||||||
GameObjectAI* GetAI(GameObject* go) const override { return new AI(go); }
|
GameObjectAI* GetAI(GameObject* me) const override { return new AI(me); }
|
||||||
};
|
};
|
||||||
#define RegisterGameObjectAI(ai_name) new GenericGameObjectScript<ai_name>(#ai_name)
|
#define RegisterGameObjectAI(ai_name) new GenericGameObjectScript<ai_name>(#ai_name)
|
||||||
|
|
||||||
|
// Cannot be used due gob scripts not working like this
|
||||||
|
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)
|
||||||
|
|
||||||
#define sScriptMgr ScriptMgr::instance()
|
#define sScriptMgr ScriptMgr::instance()
|
||||||
|
|
||||||
template<class TScript>
|
template<class TScript>
|
||||||
|
|||||||
Reference in New Issue
Block a user