Updated register_types.h

This commit is contained in:
Relintai 2023-12-25 19:41:37 +01:00
parent b6648f707e
commit d8eec349a5
2 changed files with 33 additions and 20 deletions

View File

@ -36,20 +36,15 @@
#include "core/engine.h" #include "core/engine.h"
#include "data_buffer.h" #include "data_buffer.h"
#include "input_network_encoder.h"
#include "networked_controller.h" #include "networked_controller.h"
#include "scene_diff.h" #include "scene_diff.h"
#include "scene_synchronizer.h" #include "scene_synchronizer.h"
#include "scene_synchronizer_debugger.h" #include "scene_synchronizer_debugger.h"
#include "input_network_encoder.h"
void register_network_synchronizer_types() { void register_network_synchronizer_types(ModuleRegistrationLevel p_level) {
ClassDB::register_class<DataBuffer>(); if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) {
ClassDB::register_class<SceneDiff>();
ClassDB::register_class<NetworkedController>();
ClassDB::register_class<SceneSynchronizer>();
ClassDB::register_class<SceneSynchronizerDebugger>(); ClassDB::register_class<SceneSynchronizerDebugger>();
ClassDB::register_class<InputNetworkEncoder>();
memnew(SceneSynchronizerDebugger); memnew(SceneSynchronizerDebugger);
Engine::get_singleton()->add_singleton(Engine::Singleton("SceneSynchronizerDebugger", SceneSynchronizerDebugger::singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("SceneSynchronizerDebugger", SceneSynchronizerDebugger::singleton()));
@ -59,8 +54,19 @@ void register_network_synchronizer_types() {
GLOBAL_DEF("NetworkSynchronizer/debugger/dump_enabled", false); GLOBAL_DEF("NetworkSynchronizer/debugger/dump_enabled", false);
GLOBAL_DEF("NetworkSynchronizer/debugger/dump_classes", Array()); GLOBAL_DEF("NetworkSynchronizer/debugger/dump_classes", Array());
GLOBAL_DEF("NetworkSynchronizer/debugger/log_debug_fps_warnings", true); GLOBAL_DEF("NetworkSynchronizer/debugger/log_debug_fps_warnings", true);
}
if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) {
ClassDB::register_class<DataBuffer>();
ClassDB::register_class<SceneDiff>();
ClassDB::register_class<NetworkedController>();
ClassDB::register_class<SceneSynchronizer>();
ClassDB::register_class<InputNetworkEncoder>();
}
} }
void unregister_network_synchronizer_types() { void unregister_network_synchronizer_types(ModuleRegistrationLevel p_level) {
if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) {
memdelete(SceneSynchronizerDebugger::singleton()); memdelete(SceneSynchronizerDebugger::singleton());
}
} }

View File

@ -1,3 +1,6 @@
#ifndef REGISTER_NETWORK_SYNCHRONIZER_TYPES_H
#define REGISTER_NETWORK_SYNCHRONIZER_TYPES_H
/*************************************************************************/ /*************************************************************************/
/* register_types.h */ /* register_types.h */
/*************************************************************************/ /*************************************************************************/
@ -32,5 +35,9 @@
@author AndreaCatania @author AndreaCatania
*/ */
void register_network_synchronizer_types(); #include "modules/register_module_types.h"
void unregister_network_synchronizer_types();
void register_network_synchronizer_types(ModuleRegistrationLevel p_level);
void unregister_network_synchronizer_types(ModuleRegistrationLevel p_level);
#endif