-
Notifications
You must be signed in to change notification settings - Fork 222
/
World.cpp
60 lines (53 loc) · 2.19 KB
/
World.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <World.h>
#include <Components.h>
#include <Services/CharacterService.h>
#include <Services/ObjectService.h>
#include <Services/QuestService.h>
#include <Services/ServerListService.h>
#include <Services/ActorValueService.h>
#include <Services/AdminService.h>
#include <Services/InventoryService.h>
#include <Services/MagicService.h>
#include <Services/OverlayService.h>
#include <Services/CommandService.h>
#include <Services/StringCacheService.h>
#include <Services/CombatService.h>
#include <Services/WeatherService.h>
#include <Services/ScriptService.h>
#include <Services/MapService.h>
#include <es_loader/ESLoader.h>
World::World()
{
m_spAdminService = std::make_shared<AdminService>(*this, m_dispatcher);
spdlog::default_logger()->sinks().push_back(std::static_pointer_cast<spdlog::sinks::sink>(m_spAdminService));
ctx().emplace<CharacterService>(*this, m_dispatcher);
ctx().emplace<PlayerService>(*this, m_dispatcher);
ctx().emplace<CalendarService>(*this, m_dispatcher);
ctx().emplace<ObjectService>(*this, m_dispatcher);
ctx().emplace<ModsComponent>();
ctx().emplace<ServerListService>(*this, m_dispatcher);
ctx().emplace<QuestService>(*this, m_dispatcher);
ctx().emplace<PartyService>(*this, m_dispatcher);
ctx().emplace<ActorValueService>(*this, m_dispatcher);
ctx().emplace<InventoryService>(*this, m_dispatcher);
ctx().emplace<MagicService>(*this, m_dispatcher);
ctx().emplace<OverlayService>(*this, m_dispatcher);
ctx().emplace<CommandService>(*this, m_dispatcher);
ctx().emplace<StringCacheService>(*this, m_dispatcher);
ctx().emplace<CombatService>(*this, m_dispatcher);
ctx().emplace<WeatherService>(*this, m_dispatcher);
ctx().emplace<MapService>(*this, m_dispatcher);
ESLoader::ESLoader loader;
// emplace loaded mods into modscomponent.
m_recordCollection = loader.BuildRecordCollection();
for (const auto& it : loader.GetLoadOrder())
{
ctx().emplace<ModsComponent>().AddServerMod(it);
}
// late initialize the ScriptService to ensure all components are valid
m_pScriptService = TiltedPhoques::MakeUnique<ScriptService>(*this, m_dispatcher);
}
World::~World()
{
m_pScriptService.reset();
}