MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / add_spawnable_scene

Method add_spawnable_scene

modules/multiplayer/multiplayer_spawner.cpp:104–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void MultiplayerSpawner::add_spawnable_scene(const String &p_path) {
105 SpawnableScene sc;
106 sc.path = ResourceUID::ensure_path(p_path);
107 if (Engine::get_singleton()->is_editor_hint()) {
108 ERR_FAIL_COND(!ResourceLoader::exists(sc.path));
109 }
110 spawnable_scenes.push_back(sc);
111#ifdef TOOLS_ENABLED
112 if (Engine::get_singleton()->is_editor_hint()) {
113 return;
114 }
115#endif
116 Node *node = get_spawn_node();
117 if (spawnable_scenes.size() == 1 && node && !node->is_connected("child_entered_tree", callable_mp(this, &MultiplayerSpawner::_node_added))) {
118 node->connect("child_entered_tree", callable_mp(this, &MultiplayerSpawner::_node_added));
119 }
120}
121
122int MultiplayerSpawner::get_spawnable_scene_count() const {
123 return spawnable_scenes.size();

Callers 1

Calls 5

sizeMethod · 0.65
connectMethod · 0.65
is_editor_hintMethod · 0.45
push_backMethod · 0.45
is_connectedMethod · 0.45

Tested by

no test coverage detected