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

Method _node_added

modules/multiplayer/multiplayer_spawner.cpp:232–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232void MultiplayerSpawner::_node_added(Node *p_node) {
233 if (!get_multiplayer()->has_multiplayer_peer() || !is_multiplayer_authority()) {
234 return;
235 }
236 if (tracked_nodes.has(p_node->get_instance_id())) {
237 return;
238 }
239 const Node *parent = get_spawn_node();
240 if (!parent || p_node->get_parent() != parent) {
241 return;
242 }
243 int id = find_spawnable_scene_index_from_path(p_node->get_scene_file_path());
244 if (id == INVALID_ID) {
245 return;
246 }
247 const String name = p_node->get_name();
248 ERR_FAIL_COND_MSG(name.validate_node_name() != name, vformat("Unable to auto-spawn node with reserved name: %s. Make sure to add your replicated scenes via 'add_child(node, true)' to produce valid names.", name));
249 _track(p_node, Variant(), id);
250}
251
252NodePath MultiplayerSpawner::get_spawn_path() const {
253 return spawn_path;

Callers

nothing calls this directly

Calls 9

vformatFunction · 0.85
has_multiplayer_peerMethod · 0.80
get_scene_file_pathMethod · 0.80
validate_node_nameMethod · 0.80
VariantClass · 0.50
hasMethod · 0.45
get_instance_idMethod · 0.45
get_parentMethod · 0.45
get_nameMethod · 0.45

Tested by

no test coverage detected