mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
Core/AI: use NullGameObjectAI for gameobjects with ScriptName
- use GameObjectAI with Transports too --HG-- branch : trunk
This commit is contained in:
@@ -137,7 +137,7 @@ namespace FactorySelector
|
||||
|
||||
//future goAI types go here
|
||||
|
||||
std::string ainame = (ai_factory == NULL) ? "NullGameObjectAI" : ai_factory->key();
|
||||
std::string ainame = (ai_factory == NULL || go->GetScriptId()) ? "NullGameObjectAI" : ai_factory->key();
|
||||
|
||||
sLog.outStaticDebug("GameObject %u used AI is %s.", go->GetGUIDLow(), ainame.c_str());
|
||||
|
||||
|
||||
@@ -239,9 +239,12 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
|
||||
|
||||
void GameObject::Update(uint32 diff)
|
||||
{
|
||||
if(!m_AI)
|
||||
if(!AI())
|
||||
{
|
||||
if (!AIM_Initialize())
|
||||
sLog.outError("Could not initialize GameObjectAI");
|
||||
} else
|
||||
AI()->UpdateAI(diff);
|
||||
|
||||
if (IS_MO_TRANSPORT(GetGUID()))
|
||||
{
|
||||
@@ -550,7 +553,6 @@ void GameObject::Update(uint32 diff)
|
||||
break;
|
||||
}
|
||||
}
|
||||
AI()->UpdateAI(diff);
|
||||
sScriptMgr.OnGameObjectUpdate(this, diff);
|
||||
}
|
||||
|
||||
|
||||
@@ -752,6 +752,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
|
||||
|
||||
std::string GetAIName() const;
|
||||
protected:
|
||||
bool AIM_Initialize();
|
||||
uint32 m_spellId;
|
||||
time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()),
|
||||
uint32 m_respawnDelayTime; // (secs) if 0 then current GO state no dependent from timer
|
||||
@@ -779,6 +780,5 @@ class GameObject : public WorldObject, public GridObject<GameObject>
|
||||
private:
|
||||
void SwitchDoorOrButton(bool activate, bool alternative = false);
|
||||
GameObjectAI* m_AI;
|
||||
bool AIM_Initialize();
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "DBCStores.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "World.h"
|
||||
#include "GameObjectAI.h"
|
||||
|
||||
void MapManager::LoadTransports()
|
||||
{
|
||||
@@ -544,6 +545,13 @@ bool Transport::RemovePassenger(Player* passenger)
|
||||
|
||||
void Transport::Update(uint32 p_diff)
|
||||
{
|
||||
if(!AI())
|
||||
{
|
||||
if (!AIM_Initialize())
|
||||
sLog.outError("Could not initialize GameObjectAI for Transport");
|
||||
} else
|
||||
AI()->UpdateAI(p_diff);
|
||||
|
||||
if (m_WayPoints.size() <= 1)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user