2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								<?xml version="1.0" encoding="UTF-8" ?>  
						 
					
						
							
								
									
										
										
										
											2024-02-21 18:51:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								<class  name= "MultiplayerSpawner"  inherits= "Node"  keywords= "network"  xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation= "../../../doc/class.xsd" >  
						 
					
						
							
								
									
										
										
										
											2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									<brief_description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 18:30:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Automatically replicates spawnable nodes from the authority to other multiplayer peers.
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									</brief_description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									<description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 18:30:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Spawnable scenes can be configured in the editor or through code (see [method add_spawnable_scene]).
							 
						 
					
						
							
								
									
										
										
										
											2023-01-05 08:44:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Also supports custom node spawns through [method spawn], calling [member spawn_function] on all peers.
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 18:30:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Internally, [MultiplayerSpawner] uses [method MultiplayerAPI.object_configuration_add] to notify spawns passing the spawned node as the [code]object[/code] and itself as the [code]configuration[/code], and [method MultiplayerAPI.object_configuration_remove] to notify despawns in a similar way.
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									<tutorials > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</tutorials> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									<methods > 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-23 02:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "add_spawnable_scene" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "path"  type= "String"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-23 02:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 18:30:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Adds a scene path to spawnable scenes, making it automatically replicated from the multiplayer authority to other peers when added as children of the node pointed by [member spawn_path].
							 
						 
					
						
							
								
									
										
										
										
											2022-05-23 02:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<method  name= "clear_spawnable_scenes" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 18:30:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Clears all spawnable scenes. Does not despawn existing instances on remote peers.
							 
						 
					
						
							
								
									
										
										
										
											2022-05-23 02:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<method  name= "get_spawnable_scene"  qualifiers= "const" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<return  type= "String"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "index"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-23 02:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 18:30:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Returns the spawnable scene path by index.
							 
						 
					
						
							
								
									
										
										
										
											2022-05-23 02:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<method  name= "get_spawnable_scene_count"  qualifiers= "const" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<return  type= "int"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 18:30:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Returns the count of spawnable scene paths.
							 
						 
					
						
							
								
									
										
										
										
											2022-05-23 02:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										<method  name= "spawn" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<return  type= "Node"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "data"  type= "Variant"  default= "null"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-26 21:36:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Requests a custom spawn, with [param data] passed to [member spawn_function] on all peers. Returns the locally spawned node instance already inside the scene tree, and added as a child of the node pointed by [member spawn_path].
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 18:30:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												[b]Note:[/b] Spawnable scenes are spawned automatically. [method spawn] is only needed for custom spawns.
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</methods> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									<members > 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-23 10:26:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<member  name= "spawn_function"  type= "Callable"  setter= "set_spawn_function"  getter= "get_spawn_function" > 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-12 14:57:02 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Method called on all peers when a custom [method spawn] is requested by the authority. Will receive the [code]data[/code] parameter, and should return a [Node] that is not in the scene tree.
							 
						 
					
						
							
								
									
										
										
										
											2023-01-05 08:44:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											[b]Note:[/b] The returned node should [b]not[/b] be added to the scene with [method Node.add_child]. This is done automatically.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</member> 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										<member  name= "spawn_limit"  type= "int"  setter= "set_spawn_limit"  getter= "get_spawn_limit"  default= "0" > 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-12 14:57:02 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Maximum number of nodes allowed to be spawned by this spawner. Includes both spawnable scenes and custom spawns.
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 18:30:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											When set to [code]0[/code] (the default), there is no limit.
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										</member> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<member  name= "spawn_path"  type= "NodePath"  setter= "set_spawn_path"  getter= "get_spawn_path"  default= "NodePath("")" > 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 18:30:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Path to the spawn root. Spawnable scenes that are added as direct children are replicated to other peers.
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										</member> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</members> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									<signals > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<signal  name= "despawned" > 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "node"  type= "Node"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-24 23:15:51 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Emitted when a spawnable scene or custom spawn was despawned by the multiplayer authority. Only called on remote peers.
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</signal> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<signal  name= "spawned" > 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "node"  type= "Node"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-24 23:15:51 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Emitted when a spawnable scene or custom spawn was spawned by the multiplayer authority. Only called on remote peers.
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 14:13:06 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</signal> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</signals> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								</class>