| 102 | } |
| 103 | |
| 104 | void 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 | |
| 122 | int MultiplayerSpawner::get_spawnable_scene_count() const { |
| 123 | return spawnable_scenes.size(); |
no test coverage detected