feat(Core/Modules): add separated lib for modules (#9281)

This commit is contained in:
Kargatum
2021-12-02 20:28:58 +07:00
committed by GitHub
parent 8668a03e14
commit 51adbffae4
56 changed files with 1904 additions and 1014 deletions

View File

@@ -38,10 +38,6 @@
#include <G3D/CoordinateFrame.h>
#include <G3D/Quat.h>
#ifdef ELUNA
#include "LuaEngine.h"
#endif
GameObject::GameObject() : WorldObject(false), MovableMapObject(),
m_model(nullptr), m_goValue(), m_AI(nullptr)
{
@@ -161,9 +157,8 @@ void GameObject::AddToWorld()
EnableCollision(GetGoState() == GO_STATE_READY || IsTransport()); // pussywizard: this startOpen is unneeded here, collision depends entirely on GOState
WorldObject::AddToWorld();
#ifdef ELUNA
sEluna->OnAddToWorld(this);
#endif
sScriptMgr->OnGameObjectAddWorld(this);
}
}
@@ -172,9 +167,8 @@ void GameObject::RemoveFromWorld()
///- Remove the gameobject from the accessor
if (IsInWorld())
{
#ifdef ELUNA
sEluna->OnRemoveFromWorld(this);
#endif
sScriptMgr->OnGameObjectRemoveWorld(this);
if (m_zoneScript)
m_zoneScript->OnGameObjectRemove(this);
@@ -411,9 +405,6 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u
void GameObject::Update(uint32 diff)
{
#ifdef ELUNA
sEluna->UpdateAI(this, diff);
#endif
if (AI())
AI()->UpdateAI(diff);
else if (!AIM_Initialize())
@@ -840,6 +831,7 @@ void GameObject::Update(uint32 diff)
break;
}
}
sScriptMgr->OnGameObjectUpdate(this, diff);
}
@@ -1424,10 +1416,6 @@ void GameObject::Use(Unit* user)
if (Player* playerUser = user->ToPlayer())
{
#ifdef ELUNA
if (sEluna->OnGossipHello(playerUser, this))
return;
#endif
if (sScriptMgr->OnGossipHello(playerUser, this))
return;
@@ -2287,11 +2275,10 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
break;
case GO_DESTRUCTIBLE_DAMAGED:
{
#ifdef ELUNA
sEluna->OnDamaged(this, eventInvoker);
#endif
EventInform(m_goInfo->building.damagedEvent);
sScriptMgr->OnGameObjectDamaged(this, eventInvoker);
if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
if (Battleground* bg = bgMap->GetBG())
bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.damagedEvent);
@@ -2318,11 +2305,10 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
}
case GO_DESTRUCTIBLE_DESTROYED:
{
#ifdef ELUNA
sEluna->OnDestroyed(this, eventInvoker);
#endif
sScriptMgr->OnGameObjectDestroyed(this, eventInvoker);
EventInform(m_goInfo->building.destroyedEvent);
if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
{
if (Battleground* bg = bgMap->GetBG())
@@ -2375,9 +2361,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
void GameObject::SetLootState(LootState state, Unit* unit)
{
m_lootState = state;
#ifdef ELUNA
sEluna->OnLootStateChanged(this, state);
#endif
AI()->OnStateChanged(state, unit);
sScriptMgr->OnGameObjectLootStateChanged(this, state, unit);
// pussywizard: lootState has nothing to do with collision, it depends entirely on GOState. Loot state is for timed close/open door and respawning, which then sets GOState
@@ -2400,10 +2384,9 @@ void GameObject::SetLootState(LootState state, Unit* unit)
void GameObject::SetGoState(GOState state)
{
SetByteValue(GAMEOBJECT_BYTES_1, 0, state);
#ifdef ELUNA
sEluna->OnGameObjectStateChanged(this, state);
#endif
sScriptMgr->OnGameObjectStateChanged(this, state);
if (m_model)
{
if (!IsInWorld())