-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin_config.h
More file actions
116 lines (103 loc) · 2.57 KB
/
plugin_config.h
File metadata and controls
116 lines (103 loc) · 2.57 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#pragma once
#include "plugin_interface.h"
namespace MapExtensionPluginConfig
{
static constexpr const char* kPluginName = "MapExtension_Plugin";
static const ConfigEntry CONFIG_ENTRIES[] = {
{
"General",
"Enabled",
ConfigValueType::Boolean,
"1",
"Enable or disable the MapExtension_Plugin plugin"
},
{
"Diagnostics",
"VerboseLifecycleLogs",
ConfigValueType::Boolean,
"0",
"Log world/save/experience callbacks while the cargo snapshot runtime is active"
},
{
"Diagnostics",
"LogRuntimePlanOnce",
ConfigValueType::Boolean,
"0",
"Log the current runtime acquisition plan once per process"
},
{
"Diagnostics",
"LogCargoSnapshots",
ConfigValueType::Boolean,
"0",
"Log cargo sender and receiver positions collected from runtime sources"
},
{
"Diagnostics",
"LogActorScanFallback",
ConfigValueType::Boolean,
"0",
"Log actor-scan fallback counts for BP_PackageSender and BP_PackageReceiver"
},
{
"Http",
"Port",
ConfigValueType::Integer,
"9000",
"Local HTTP port used to publish cargo snapshot JSON"
},
{
"Runtime",
"RefreshIntervalMs",
ConfigValueType::Integer,
"500",
"Realtime snapshot refresh interval in milliseconds while gameplay is running"
}
};
static const ConfigSchema SCHEMA = {
CONFIG_ENTRIES,
static_cast<int>(sizeof(CONFIG_ENTRIES) / sizeof(ConfigEntry))
};
class Config
{
public:
static void Initialize(IPluginConfig* config)
{
s_config = config;
if (s_config)
{
s_config->InitializeFromSchema(kPluginName, &SCHEMA);
}
}
static bool IsEnabled()
{
return s_config ? s_config->ReadBool(kPluginName, "General", "Enabled", true) : true;
}
static bool VerboseLifecycleLogs()
{
return s_config ? s_config->ReadBool(kPluginName, "Diagnostics", "VerboseLifecycleLogs", false) : false;
}
static bool LogRuntimePlanOnce()
{
return s_config ? s_config->ReadBool(kPluginName, "Diagnostics", "LogRuntimePlanOnce", false) : false;
}
static bool LogCargoSnapshots()
{
return s_config ? s_config->ReadBool(kPluginName, "Diagnostics", "LogCargoSnapshots", false) : false;
}
static bool LogActorScanFallback()
{
return s_config ? s_config->ReadBool(kPluginName, "Diagnostics", "LogActorScanFallback", false) : false;
}
static int HttpPort()
{
return s_config ? s_config->ReadInt(kPluginName, "Http", "Port", 9000) : 9000;
}
static int RefreshIntervalMs()
{
return s_config ? s_config->ReadInt(kPluginName, "Runtime", "RefreshIntervalMs", 500) : 500;
}
private:
static IPluginConfig* s_config;
};
}