Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src/server/game/Entities/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1825,16 +1825,13 @@ void WorldObject::SetMap(Map* map)
m_mapId = map->GetId();
m_InstanceId = map->GetInstanceId();
#ifdef ELUNA
// in multistate mode, always reset Map events, then recreate the Map events procesor
if (!sElunaConfig->IsElunaCompatibilityMode())
{
auto& events = GetElunaEvents(m_mapId);
if (events)
events.reset();
// always reset Map events, then recreate the Map events procesor if Eluna is enabled for the map
auto& events = GetElunaEvents(m_mapId);
if (events)
events.reset();

if (Eluna* e = map->GetEluna())
events = std::make_unique<ElunaEventProcessor>(e, this);
}
if (Eluna* e = map->GetEluna())
events = std::make_unique<ElunaEventProcessor>(e, this);

// create the World events processor
if (Eluna* e = sWorld->GetEluna())
Expand Down
12 changes: 1 addition & 11 deletions src/server/game/Maps/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ i_scriptLock(false), _respawnTimes(std::make_unique<RespawnListContainer>()), _r
// lua state begins uninitialized
eluna = nullptr;

if (sElunaConfig->IsElunaEnabled() && !sElunaConfig->IsElunaCompatibilityMode() && sElunaConfig->ShouldMapLoadEluna(id))
if (sElunaConfig->IsElunaEnabled() && sElunaConfig->ShouldMapLoadEluna(id))
if (!IsParentMap() || (IsParentMap() && !Instanceable()))
eluna = std::make_unique<Eluna>(this);
#endif
Expand Down Expand Up @@ -4891,14 +4891,4 @@ std::string InstanceMap::GetDebugInfo() const
return sstr.str();
}

#ifdef ELUNA
Eluna *Map::GetEluna() const
{
if(sElunaConfig->IsElunaCompatibilityMode())
return sWorld->GetEluna();

return eluna.get();
}
#endif

template class TC_GAME_API TypeUnorderedMapContainer<AllMapStoredObjectTypes, ObjectGuid>;
2 changes: 1 addition & 1 deletion src/server/game/Maps/Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ class TC_GAME_API Map : public GridRefManager<NGridType>
void AddFarSpellCallback(FarSpellCallback&& callback);
bool IsParentMap() const { return GetParent() == this; }
#ifdef ELUNA
Eluna* GetEluna() const;
Eluna* GetEluna() const { return eluna.get(); }

LuaVal lua_data = LuaVal({});
#endif
Expand Down
10 changes: 0 additions & 10 deletions src/server/game/Maps/MapManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include <numeric>
#ifdef ELUNA
#include "LuaEngine.h"
#include "ElunaConfig.h"
#endif

MapManager::MapManager()
Expand All @@ -55,15 +54,6 @@ void MapManager::Initialize()
Map::InitStateMachine();

int num_threads(sWorld->getIntConfig(CONFIG_NUMTHREADS));
#if ELUNA
if (sElunaConfig->IsElunaEnabled() && sElunaConfig->IsElunaCompatibilityMode() && num_threads > 1)
{
// Force 1 thread for Eluna if compatibility mode is enabled. Compatibility mode is single state and does not allow more update threads.
TC_LOG_ERROR("maps", "Map update threads set to {}, when Eluna in compatibility mode only allows 1, changing to 1", num_threads);
num_threads = 1;
}
#endif

// Start mtmaps if needed.
if (num_threads > 0)
m_updater.activate(num_threads);
Expand Down
4 changes: 1 addition & 3 deletions src/server/game/Scripting/ScriptMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1560,9 +1560,7 @@ void ScriptMgr::OnMapUpdate(Map* map, uint32 diff)
#ifdef ELUNA
if (Eluna* e = map->GetEluna())
{
if(!sElunaConfig->IsElunaCompatibilityMode())
e->UpdateEluna(diff);

e->UpdateEluna(diff);
e->OnUpdate(map, diff);
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/World/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2119,7 +2119,7 @@ void World::SetInitialWorldSettings()
if (sElunaConfig->IsElunaEnabled())
{
TC_LOG_INFO("server.loading", "Starting Eluna world state...");
eluna = std::make_unique<Eluna>(nullptr, sElunaConfig->IsElunaCompatibilityMode());
eluna = std::make_unique<Eluna>(nullptr);
}
#endif

Expand Down
7 changes: 0 additions & 7 deletions src/server/worldserver/worldserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3882,12 +3882,6 @@ AuctionHouseBot.Buyer.Recheck.Interval = 20
# Default: true - (enabled)
# false - (disabled)
#
# Eluna.CompatibilityMode
# Description: Toggles Eluna between compatibility mode (single-threaded) or multistate mode.
# Compatibility mode limits the core to a single map update thread.
# Default: true - (enabled)
# false - (disabled)
#
# Eluna.ScriptReloader
# Description: Enable or disable the automated script reloader.
# This will automatically reload Eluna when it detects changes to scripts.
Expand Down Expand Up @@ -3927,7 +3921,6 @@ AuctionHouseBot.Buyer.Recheck.Interval = 20
#

Eluna.Enabled = true
Eluna.CompatibilityMode = false
Eluna.ScriptReloader = false
Eluna.OnlyOnMaps = ""
Eluna.TraceBack = false
Expand Down